23 typedef struct _noisemod {
34 void* noisemod_new(t_symbol *s,
long argc, t_atom *argv);
35 void noisemod_free(t_noisemod *x);
36 void noisemod_dsp64(t_noisemod *x, t_object *dsp64,
short *count,
double samplerate,
long maxvectorsize,
long flags);
37 void noisemod_assist(t_noisemod *x,
void *b,
long m,
long a,
char *s);
38 void noisemod_parameter_mode_callback(
const TTValue& baton,
const TTValue& v);
42 static t_class* s_noisemod_class;
50 t_class *c = class_new(
"noise~.model", (method)noisemod_new, (method)noisemod_free,
sizeof(t_noisemod), (method)0L, A_GIMME, 0);
54 class_addmethod(c, (method)noisemod_dsp64,
"dsp64", A_CANT, 0);
55 class_addmethod(c, (method)object_obex_dumpout,
"dumpout", A_CANT,0);
56 class_addmethod(c, (method)noisemod_assist,
"assist", A_CANT, 0L);
59 class_register(CLASS_BOX, c);
69 void* noisemod_new(t_symbol* s,
long argc, t_atom* argv)
71 t_noisemod* x = (t_noisemod*)object_alloc(s_noisemod_class);
72 long attrstart = attr_args_offset(argc, argv);
78 if (atom_getsym(argv)->s_name[0] ==
'/')
79 name += atom_getsym(argv)->s_name + 1;
81 name += atom_getsym(argv)->s_name;
88 object_obex_lookup(x, gensym(
"#P"), (t_object**)&context);
92 assert(x->noise.valid());
93 x->signalOut =
TTObject(kTTSym_audiosignal, 2);
94 x->signalIn =
TTObject(kTTSym_audiosignal, 2);
97 x->model =
new TTModel(name, context);
101 x->model->createOutput(
"", x->out);
102 x->model->createPresetManager();
108 dsp_setup((t_pxobject*)x, 1);
109 x->obj.z_misc = Z_NO_INPLACE;
110 outlet_new((t_pxobject*)x,
"signal");
111 attr_args_process(x, argc, argv);
117 void noisemod_free(t_noisemod *x)
119 dsp_free((t_pxobject *)x);
127 void noisemod_assist(t_noisemod *x,
void *b,
long msg,
long arg,
char *dst)
133 void noisemod_parameter_mode_callback(
const TTValue& baton,
const TTValue& v)
135 t_noisemod *x = (t_noisemod*)
TTPtr(baton[0]);
136 x->noise.set(
"mode", v);
140 void noisemod_perform64(t_noisemod *x, t_object *dsp64,
double **ins,
long numins,
double **outs,
long numouts,
long sampleframes,
long flags,
void *userparam)
146 TTAudioSignalPtr(x->signalOut.instance())->getVectorCopy(0, sampleframes, ins[0]);
148 TTOutputAudioPtr(x->out.instance())->process(ins[0], outs[0], sampleframes);
152 void noisemod_dsp64(t_noisemod *x, t_object *dsp64,
short *count,
double samplerate,
long maxvectorsize,
long flags)
154 x->signalOut.set(kTTSym_numChannels, 1);
155 x->signalOut.set(kTTSym_vectorSize, (
TTUInt16)maxvectorsize);;
156 x->signalOut.send(kTTSym_alloc);
158 x->noise.set(kTTSym_sampleRate, samplerate);
159 object_method(dsp64, gensym(
"dsp_add64"), x, noisemod_perform64, 0, NULL);
161 TTOutputAudioPtr(x->out.instance())->setupAudioSignals(maxvectorsize, samplerate);
std::uint16_t TTUInt16
16 bit unsigned integer
int C74_EXPORT main(void)
Set up this class as a Max external the first time an object of this kind is instantiated.
Create and use Jamoma object instances.
Wrap audio objects for convenience.
void * TTPtr
A generic pointer.
TTAudioObjectBase * TTAudioObjectBasePtr
Pointer to a TTAudioObjectBase.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
The TTAudioSignal class represents N vectors of audio samples for M channels.
void TTDSP_EXPORT TTDSPInit(const char *pathToBinaries=NULL)
Initialise the Jamoma DSP library, as well as Jamoma Foundation foundation if needed.
TTErr(* TTFunctionWithBatonAndValue)(const TTValue &, const TTValue &)
A simple/generic function pointer with a baton as TTValueRef and the value to send back as a TTValueR...
Wraps Jamoma Core classes as objects for Max/MSP.
The TTString class is used to represent a string.
An audio output component for Jamoma models.
[doxygenAppendixC_copyExample]