17 #include "jit.common.h"
18 #include "TTClassWrapperMax.h"
22 typedef struct _j_gain {
31 t_jit_err GainClassInit (
void);
32 t_gain* GainNew (
void);
33 void GainFree (t_gain*
self);
34 t_jit_err GainMatrixCalc (t_gain*
self,
void *inputs,
void *outputs);
35 t_jit_err GainGetGain (t_gain*
self, Ptr attr,
long* ac, t_atom** av);
36 t_jit_err GainSetGain (t_gain*
self, Ptr attr,
long ac, t_atom* av);
40 static t_class* s_gain_class = NULL;
45 t_jit_err GainClassInit(
void)
51 s_gain_class = (t_class*)jit_class_new((
char*)
"j_gain", (method)GainNew, (method)GainFree,
sizeof(t_gain), 0);
54 mop = (t_jit_object*)jit_object_new(_jit_sym_jit_mop, 1, 1);
55 jit_class_addadornment(s_gain_class, mop);
58 jit_class_addmethod(s_gain_class, (method)GainMatrixCalc, (
char*)
"matrix_calc", A_CANT, 0);
61 attr = (t_jit_object*)jit_object_new(_jit_sym_jit_attr_offset,
65 (method)GainGetGain, (method)GainSetGain,
67 jit_class_addattr(s_gain_class, attr);
70 jit_class_register(s_gain_class);
80 t_gain*
self = (t_gain*)jit_object_alloc(s_gain_class);
91 void GainFree(t_gain*
self)
102 t_jit_err GainMatrixCalc(t_gain*
self,
void *inputs,
void *outputs)
104 t_jit_err err = JIT_ERR_NONE;
110 in_matrix = jit_object_method(inputs,_jit_sym_getindex,0);
111 out_matrix = jit_object_method(outputs,_jit_sym_getindex,0);
113 if (
self && in_matrix && out_matrix) {
114 in_savelock = TTMatrixReferenceJitterMatrix(*self->m_x, in_matrix,
false);
115 out_savelock = TTMatrixReferenceJitterMatrix(*self->m_y, out_matrix,
false);
117 self->m_gain->calculate(*self->m_x, *self->m_y);
119 jit_object_method(out_matrix, _jit_sym_lock, out_savelock);
120 jit_object_method(in_matrix, _jit_sym_lock, in_savelock);
123 return JIT_ERR_INVALID_PTR;
132 t_jit_err GainGetGain(t_gain*
self, Ptr attr,
long* ac, t_atom** av)
140 *av = (t_atom*)sysmem_newptr(
sizeof(t_atom));
144 self->m_gain->get(kTTSym_gain, gain);
145 atom_setfloat(*av, gain);
150 t_jit_err GainSetGain(t_gain*
self, Ptr attr,
long ac, t_atom* av)
152 self->m_gain->set(kTTSym_gain, atom_getfloat(av));
double TTFloat64
64 bit floating point number
Wrap TTMatrixBase instances.
Wrap TTMatrixBase instances.
[doxygenAppendixC_copyExample]