26 typedef struct extra {
29 #define EXTRA ((t_extra*)x->extra)
66 void ramp_set(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
72 void ramp_list(
TTPtr self, t_symbol *msg,
long argc, t_atom *argv);
91 ModularSpec *spec =
new ModularSpec;
102 class_addmethod(c->maxClass, (method)
ramp_assist,
"assist", A_CANT, 0);
104 class_addmethod(c->maxClass, (method)
ramp_return_value,
"return_value", A_CANT, 0);
106 class_addmethod(c->maxClass, (method)
ramp_bang,
"bang", 0);
107 class_addmethod(c->maxClass, (method)
ramp_int,
"int", A_DEFLONG, 0);
108 class_addmethod(c->maxClass, (method)
ramp_float,
"float", A_DEFFLOAT, 0);
109 class_addmethod(c->maxClass, (method)
ramp_list,
"list", A_GIMME, 0);
111 class_addmethod(c->maxClass, (method)
ramp_set,
"set", A_GIMME, 0);
112 class_addmethod(c->maxClass, (method)
ramp_stop,
"stop", 0);
120 #pragma mark life cycle
133 x->
outlets[k_outlet_value] = outlet_new(x, 0L);
140 EXTRA->currentValue =
new TTValue(0.);
143 attr_args_process(x, argc, argv);
150 delete EXTRA->currentValue;
151 EXTRA->currentValue = NULL;
165 strcpy(dst,
"input");
169 strcpy(dst,
"ramping value");
171 case k_outlet_dumpout:
172 strcpy(dst,
"dumpout");
195 *(EXTRA->currentValue) =
TTFloat64(value);
196 outlet_float(x->
outlets[k_outlet_value], value);
208 *(EXTRA->currentValue) =
TTFloat64(value);
209 outlet_float(x->
outlets[k_outlet_value], value);
222 *(EXTRA->currentValue) = v;
240 short ramp_keyword_index = -1;
244 for (i = 0; i < argc; i++) {
247 if (argv[i].a_type == A_SYM) {
249 if (atom_getsym(argv+i) == gensym(
"ramp")) {
250 ramp_keyword_index = i;
258 if (ramp_keyword_index == -1) {
261 *(EXTRA->currentValue) = v;
262 outlet_anything(x->
outlets[k_outlet_value], _sym_list, argc, argv);
266 if (argc != (ramp_keyword_index + 2)) {
268 error(
"invalid syntax -- wrong number of args following the 'ramp' keyword");
273 if (EXTRA->currentValue->size() == v.
size())
287 if (EXTRA->currentValue != NULL)
290 outlet_anything(x->
outlets[k_outlet_value], msg, argc, argv);
294 #pragma mark attributes of attributes
305 error(
"j.ramp: not enough arguments to get or set scheduler/parameter/value");
312 v =
TTSymbol(atom_getsym(argv)->s_name);
318 object_obex_dumpout(x, gensym(
"drive/parameter/value"), ac, av);
336 error(
"j.ramp: not enough arguments to get or set function/parameter/value");
343 v =
TTSymbol(atom_getsym(argv)->s_name);
349 object_obex_dumpout(x, gensym(
"function/parameter/value"), ac, av);
void ramp_set(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
Set current value while surpressing new value(s from being output.
void WrappedRampClass_new(TTPtr self, long argc, t_atom *argv)
Wrapper for the j.ramp constructor class, called when an instance is created.
TTErr send(const TTSymbol aName)
Send a message to this object with no arguments.
TTHandle outlets
an array of outlet
TTErr wrapTTModularClassAsMaxClass(TTSymbol &ttblueClassName, const char *maxClassName, WrappedClassPtr *c, ModularSpec *specificities)
Wrap a Jamoma class as a Max class.
int C74_EXPORT main(void)
Set up this class as a Max external the first time an object of this kind is instantiated.
void ramp_schedulerParameter(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
Get or set value of scheduler parameter.
size_type size() const noexcept
Return the number of elements.
void * extra
used to keep very specific things
void ramp_stop(TTPtr self)
Stop ongoing ramp.
void ramp_return_value(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
Return the ramped values out.
void WrapTTRampClass(WrappedClassPtr c)
Wrap the TTRamp class as a Max object.
double TTFloat64
64 bit floating point number
void prepend(const TTValue &aValueToPrepend)
Insert another TTValue before the first element.
void append(const T &anElementValueToAppend)
Insert a single TTElement at the end.
void * TTPtr
A generic pointer.
TTErr get(const TTSymbol aName, T &aReturnedValue) const
Get an attribute value for an object.
TTErr set(const TTSymbol aName, T aValue)
Set an attribute value for an object.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
TTObject wrappedObject
The instance of the Jamoma object we are wrapping.
void ramp_functionParameter(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
Get or set value of function parameter.
Data Structure for this object.
Wraps Jamoma Core classes as objects for Max/MSP.
void ramp_int(TTPtr self, long n)
Method for int input, instantly updates current value of the object.
void ramp_list(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
Method for list input
void ramp_bang(TTPtr self)
Get a new value now.
void ramp_float(TTPtr self, double f)
Method for float input, instantly updates current value of the object.
void ramp_assist(TTPtr self, void *b, long msg, long arg, char *dst)
Method for Assistance Messages.
void WrappedRampClass_free(TTPtr self)
Wrapper for the j.ramp destructor class, called when an instance is deleted.
WrappedModularInstance * WrappedModularInstancePtr
Pointer to a wrapped instance of our object.
[doxygenAppendixC_copyExample]