Exemple #1
0
void ext_main(void *r)
{
	t_class *c;

	c = class_new("smoov", (method)smoov_new, (method)smoov_free, sizeof(t_smoov), 0L, A_GIMME, 0); // class_new() loads our external's class into Max's memory so it can be used in a patch

	class_addmethod(c, (method)smoov_bang,		"bang",		0);                 // the method it uses when it gets a bang in the left inlet
    class_addmethod(c, (method)smoov_set,		"set",		A_GIMME,    0);     // the method to set and int or a float in the left inlet       (inlet 0)
	class_addmethod(c, (method)smoov_int,		"int",		A_LONG,     0);     // the method for an int in the left inlet                      (inlet 0)
    class_addmethod(c, (method)smoov_list,		"list",		A_GIMME,     0);    // the method for a list in the left inlet                      (inlet 0)
    class_addmethod(c, (method)smoov_float,		"float",	A_FLOAT,    0);     // the method for a float in the left inlet                     (inlet 0)
	class_addmethod(c, (method)smoov_assist,	"assist",	A_CANT,     0);     // (optional) assistance method needs to be declared like this

    CLASS_ATTR_CHAR(c, "active", 0, t_smoov, s_active);
    CLASS_ATTR_ORDER(c, "active", 0, "1");
    CLASS_ATTR_STYLE_LABEL(c, "active", 0, "onoff", "Toggle smoothing");

    CLASS_ATTR_DOUBLE(c, "smooth", 0, t_smoov, s_smooth);
    CLASS_ATTR_LABEL(c, "smooth", 0, "Smoothing value");
    CLASS_ATTR_ORDER(c, "smooth", 0, "2");
    CLASS_ATTR_FILTER_CLIP(c, "smooth", 0., 1.);
    
    CLASS_ATTR_CHAR(c, "force_output", 0, t_smoov, s_force_output);
    CLASS_ATTR_ORDER(c, "force_output", 0, "3");
    CLASS_ATTR_ENUMINDEX3(c, "force_output",0,"as input","int output","float output");
    CLASS_ATTR_LABEL(c, "force_output", 0, "Fore output style");
    
	class_register(CLASS_BOX, c);
	smoov_class = c;
}
Exemple #2
0
int main(void)
{
	t_class *c = class_new("polywave~", (method)polywave_new, (method)polywave_free, (long)sizeof(t_polywave), NULL,   A_GIMME, 0);
	
	class_addmethod(c, (method)polywave_dsp64,		"dsp64",	A_CANT, 0);
    class_addmethod(c, (method)polywave_assist,     "assist",	A_CANT, 0);
    
    CLASS_ATTR_SYM_VARSIZE(c, "buffer", 0, t_polywave, buf_name, numbufs, POLYWAVE_MAX_BUFFERS);
    CLASS_ATTR_ACCESSORS(c, "buffer", polywave_buf_get, polywave_buf_set);
    CLASS_ATTR_LABEL(c, "buffer", 0, "buffer list");

    CLASS_ATTR_INT32(c, "interpolation", 0, t_polywave, interp_type);
    CLASS_ATTR_ACCESSORS(c, "interpolation", polywave_interp_get, polywave_interp_set);
    CLASS_ATTR_ENUMINDEX3(c, "interpolation", 0, "none", "linear", "cubic");
    
    CLASS_ATTR_INT32(c, "dimensions", ATTR_SET_OPAQUE_USER, t_polywave, dims);
//    CLASS_ATTR_ENUMINDEX3(c, "dimensions", ATTR_SET_OPAQUE_USER, "0D", "1D", "2D");
    
    t_class *bufpxy = class_new("bufferproxy", NULL, NULL, sizeof(t_buffer_proxy), 0L, 0);
    class_addmethod(bufpxy, (method)buffer_proxy_notify, "notify",	A_CANT, 0);
    class_register(CLASS_NOBOX, bufpxy);
    buffer_proxy_class = bufpxy;
    
    class_dspinit(c);
	class_register(CLASS_BOX, c);
	polywave_class = c;
    
    ps_buffer_modified = gensym("buffer_modified");
    
    post("%s by %s.", NAME, AUTHORS);
    post("Copyright (c) " COPYRIGHT_YEARS " Regents of the University of California.  All rights reserved.");
    
	return 0;
}
void ext_main(void *r)
#endif
{
    t_class *c;
    
    c = class_new("hoa.gain~", (method)hoa_gain_new, (method)hoa_gain_free, sizeof(t_hoa_gain), (method)NULL, A_GIMME, 0L);
    class_setname((char *)"hoa.gain~", (char *)"hoa.gain~");
    
    c->c_flags |= CLASS_FLAG_NEWDICTIONARY;
    class_dspinitjbox(c);
    jbox_initclass(c, JBOX_FIXWIDTH | JBOX_COLOR );
    
    hoa_initclass(c, (method)hoa_getinfos);
    
    class_addmethod (c, (method) hoa_gain_assist,              "assist",               A_CANT, 0);
    class_addmethod (c, (method) hoa_gain_paint,               "paint",                A_CANT, 0);
    
    // @method signal @digest The inputs signals to be scaled by the slider.
    // @description The inputs signals to be scaled by the slider.
    class_addmethod (c, (method) hoa_gain_dsp64,               "dsp64",                A_CANT, 0);
    
    // @method int @digest Set the value of the slider
    // @description The <m>int</m> method sets the value of the slider, ramps the output signal to the level corresponding to the new value over the specified ramp time, and outputs the slider's value out the right outlet.
    // @marg 0 @name value @optional 0 @type int
    class_addmethod (c, (method) hoa_gain_int,                 "int",                  A_LONG, 0);
    
    // @method float @digest Set the value of the slider
    // @description The <m>float</m> method sets the value of the slider, ramps the output signal to the level corresponding to the new value over the specified ramp time, and outputs the slider's value out the right outlet.
    // @marg 0 @name value @optional 0 @type int
    class_addmethod (c, (method) hoa_gain_float,               "float",                A_FLOAT, 0);
    
    // @method contextvalue @digest Set the value of the slider with DeciBels, Amplitude or MIDI value type.
    // @description Set the value of the slider with DeciBels, Amplitude or MIDI value type.
    // @marg 0 @name inputmode @optional 0 @type int @description 0 = DeciBels, 1 = 1mplitude, 2 = MIDI.
    // @marg 1 @name value @optional 0 @type float @description The slider value
    class_addmethod (c, (method) hoa_gain_contextValue,        "contextvalue", A_LONG, A_FLOAT, 0);
    
    // @method bang @digest Send current value out right outlet.
    // @description The <m>bang</m> message send current value out right outlet.
    class_addmethod (c, (method) hoa_gain_bang,                "bang",                         0);
    
    // @method set @digest Set the value of the slider without outputting slider value.
    // @description The word set, followed by a number, sets the value of the slider, ramps the output signal to the level corresponding to the new value over the specified ramp time, but does not output the slider's value out the right outlet.
    // @marg 1 @name value @optional 0 @type float @description The slider value
    class_addmethod (c, (method) hoa_gain_set,                 "set",                  A_GIMME, 0);
    //class_addmethod (c, (method) hoa_gain_tometer,             "anything",             A_GIMME, 0);
    class_addmethod (c, (method) hoa_gain_anything,            "anything",             A_GIMME, 0);
    
    // @method (mouse) @digest click and drag to set the slider outlet.
    // @description Clicking and dragging with the mouse sets the value of the slider, ramps the output signal to the level corresponding to the new value over the specified ramp time, and outputs the slider’s value out the right outlet. double-click to set the slider value to <m>defvaldb</m>
    
    class_addmethod (c, (method) hoa_gain_mousedoubleclick,    "mousedoubleclick",     A_CANT, 0);
    class_addmethod (c, (method) hoa_gain_mousedown,           "mousedown",            A_CANT, 0);
    class_addmethod (c, (method) hoa_gain_mousedragdelta,      "mousedragdelta",       A_CANT, 0);
    class_addmethod (c, (method) hoa_gain_mouseup,             "mouseup",              A_CANT, 0);
    class_addmethod (c, (method) hoa_gain_getvalueof,          "getvalueof",           A_CANT, 0);
    class_addmethod (c, (method) hoa_gain_setvalueof,          "setvalueof",           A_CANT, 0);
    class_addmethod (c, (method) hoa_gain_preset,              "preset",                       0);
    class_addmethod (c, (method) hoa_gain_notify,              "notify",               A_CANT, 0);
    class_addmethod (c, (method) hoa_gain_oksize,              "oksize",               A_CANT, 0);
    
    CLASS_ATTR_DEFAULT(c,"patching_rect",0, "0. 0. 140. 22.");
    
    CLASS_STICKY_CATEGORY		(c,0,"Value");
    
    CLASS_ATTR_DOUBLE			(c, "interp", 0, t_hoa_gain, f_interp);
    CLASS_ATTR_ACCESSORS		(c, "interp",(method)NULL,(method)hoa_gain_setattr_interp);
    CLASS_ATTR_LABEL			(c, "interp", 0, "Ramp Time (ms)");
    CLASS_ATTR_FILTER_MIN		(c, "interp", 0);
    // @description Ramp time in milliseconds
    
    CLASS_ATTR_CHAR				(c,"relative", 0, t_hoa_gain, j_relative);
    CLASS_ATTR_LABEL			(c,"relative", 0, "Mousing Mode");
    CLASS_ATTR_ENUMINDEX2		(c, "relative", 0, "Absolute", "Relative");
    CLASS_ATTR_BASIC			(c, "relative", 0);
    // @description Mousing can either be <b>absolute</b> or <b>relative</b>
    
    CLASS_ATTR_CHAR				(c,"inputmode", 0, t_hoa_gain, f_inputMode);
    CLASS_ATTR_LABEL			(c,"inputmode", 0, "Input Mode");
    CLASS_ATTR_ENUMINDEX3		(c, "inputmode", 0, "DeciBels", "Amplitude", "Midi");
    // @description Input mode can either be in <b>DeciBels</b>, <b>Amplitude</b> or <b>Midi</b>
    
    CLASS_ATTR_DOUBLE			(c, "defvaldb", 0, t_hoa_gain, j_defaultValuedB);
    CLASS_ATTR_LABEL			(c, "defvaldb", 0, "Default Value (dB)");
    // @description Default value in <b>DeciBels</b>, <b>Amplitude</b> or <b>Midi</b>
    
    CLASS_STICKY_CATEGORY_CLEAR(c);
    
    CLASS_ATTR_CHAR				(c,"orientation",0,t_hoa_gain,j_orientation);
    CLASS_ATTR_LABEL			(c,"orientation",0,"Orientation");
    CLASS_ATTR_ENUMINDEX3		(c,"orientation", 0,"Automatic", "Horizontal", "Vertical");
    CLASS_ATTR_CATEGORY			(c, "orientation", 0, "Appearance");
    CLASS_ATTR_DEFAULT_SAVE_PAINT(c, "orientation", 0, "0");
    // @description Orientation can either be in <b>Automatic</b>, <b>Horizontal</b> or <b>Vertical</b>
    
    CLASS_STICKY_CATEGORY(c, 0, "Color");
    
    CLASS_ATTR_INVISIBLE(c, "color", 0);
    // @exclude hoa.gain~
    
    CLASS_ATTR_RGBA_LEGACY		(c, "bgcolor", "brgb", 0, t_hoa_gain, j_brgba);
    CLASS_ATTR_ALIAS			(c,"bgcolor", "brgba");
    CLASS_ATTR_DEFAULTNAME_SAVE_PAINT(c,"bgcolor",0,"0.611765 0.611765 0.611765 1.");
    CLASS_ATTR_STYLE_LABEL		(c, "bgcolor", 0, "rgba", "Background Color");
    CLASS_ATTR_BASIC			(c, "bgcolor", 0);
    // @description Sets the RGBA values for the background color of the <o>hoa.gain~</o> object
    
    CLASS_ATTR_RGBA				(c, "knobcolor", 0, t_hoa_gain, j_knobcolor);
    CLASS_ATTR_STYLE_LABEL      (c, "knobcolor", 0, "rgba","Knob Color");
    CLASS_ATTR_DEFAULT_SAVE_PAINT(c, "knobcolor", 0, "0.396078 0.396078 0.396078 1.");
    // @description Sets the RGBA values for the knob color of the <o>hoa.gain~</o> object
    
    CLASS_ATTR_RGBA				(c, "barcolor", 0, t_hoa_gain, j_barcolor);
    CLASS_ATTR_STYLE_LABEL      (c, "barcolor", 0, "rgba","Value Bar Color");
    CLASS_ATTR_DEFAULT_SAVE_PAINT(c, "barcolor", 0, "0.396078 0.396078 0.396078 0.6");
    // @description Sets the RGBA values for the value bar color of the <o>hoa.gain~</o> object
    
    CLASS_STICKY_CATEGORY_CLEAR(c);
    
    CLASS_ATTR_DEFAULT_SAVE		(c,"relative",0,"0");
    CLASS_ATTR_DEFAULT_SAVE		(c,"defvaldb",0,"0");
    CLASS_ATTR_DEFAULT_SAVE		(c,"inputmode",0,"0");
    CLASS_ATTR_DEFAULT_SAVE		(c,"interp",0,"20");
    CLASS_ATTR_LABEL			(c,"min", 0, "Output Minimum");
    CLASS_ATTR_LABEL			(c,"mult", 0, "Output Multiplier");
    CLASS_ATTR_STYLE_LABEL		(c,"floatoutput",0,"onoff","Float Output");
    
    CLASS_ATTR_ORDER			(c, "relative",		0, "2");
    CLASS_ATTR_ORDER			(c, "size",			0, "3");
    CLASS_ATTR_ORDER			(c, "min",			0, "4");
    CLASS_ATTR_ORDER			(c, "mult",			0, "5");
    
    CLASS_ATTR_CATEGORY			(c, "channels", 0, "Custom");
    CLASS_ATTR_LONG				(c, "channels", 0, t_hoa_gain, f_number_of_channels);
    CLASS_ATTR_ACCESSORS        (c, "channels", NULL, hoa_gain_setattr_channels);
    CLASS_ATTR_ORDER			(c, "channels", 0, "1");
    CLASS_ATTR_LABEL			(c, "channels", 0, "Number of Channels");
    CLASS_ATTR_FILTER_CLIP		(c, "channels", 1, MAX_IO);
    CLASS_ATTR_DEFAULT			(c, "channels", 0, "8");
    CLASS_ATTR_SAVE				(c, "channels", 1);
    
    CLASS_ATTR_CATEGORY			(c, "range", 0, "Value");
    CLASS_ATTR_DOUBLE_ARRAY     (c, "range", 0, t_hoa_gain, f_range, 2);
    CLASS_ATTR_ACCESSORS        (c, "range", NULL, hoa_gain_setattr_range);
    CLASS_ATTR_ORDER			(c, "range", 0, "2");
    CLASS_ATTR_LABEL			(c, "range", 0, "Range (dB)");
    CLASS_ATTR_DEFAULT			(c, "range", 0, "-70. 18.");
    CLASS_ATTR_SAVE             (c, "range", 1);
    
    class_register(CLASS_BOX, c);
    s_hoa_gain_class = c;    
}
t_jit_err jit_keyscreen_init(void)
{
	long attrflags=0;
	t_jit_object *attr, *mop;

	_jit_keyscreen_class = jit_class_new("jit_keyscreen",(method)jit_keyscreen_new,(method)jit_keyscreen_free,
										 sizeof(t_jit_keyscreen),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,3,1);
	jit_mop_single_type(mop,_jit_sym_char);
	jit_mop_single_planecount(mop,4);
	jit_class_addadornment(_jit_keyscreen_class,mop);

	//add methods
	jit_class_addmethod(_jit_keyscreen_class, (method)jit_keyscreen_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);


	//add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;

	CLASS_STICKY_CATEGORY(_jit_keyscreen_class,0,"Behavior");
	CLASS_STICKY_ATTR(_jit_keyscreen_class,"basic",0,"1");

	// mode -- switches keying states
	attr = jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_long,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,mode));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"mode",0,"Keying Mode");
	CLASS_ATTR_ENUMINDEX3(_jit_keyscreen_class, "mode", 0, "Wrap", "Clip", "Fold");

	// key,target,mask -- switches who gets keyed with whom by whom
	attr = jit_object_new(_jit_sym_jit_attr_offset,"key",_jit_sym_long,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,key));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"key",0,"Key Input");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"target",_jit_sym_long,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,target));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"target",0,"Target Input");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"mask",_jit_sym_long,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,mask));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"mask",0,"Mask Input");

	// red, green, blue, tols -- changes colors and tolerances of the key
	attr = jit_object_new(_jit_sym_jit_attr_offset,"alpha",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,alpha));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"alpha",0,"Alpha");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"red",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,red));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"red",0,"Red");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"green",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,green));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"green",0,"Green");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"blue",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,blue));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"blue",0,"Blue");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"alphatol",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,alphatol));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"alphatol",0,"Alpha Tolerance");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"redtol",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,redtol));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"redtol",0,"Red Tolerance");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"greentol",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,greentol));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"greentol",0,"Green Tolerance");

	attr = jit_object_new(_jit_sym_jit_attr_offset,"bluetol",_jit_sym_float32,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_keyscreen,bluetol));
	jit_class_addattr(_jit_keyscreen_class,attr);
	CLASS_ATTR_LABEL(_jit_keyscreen_class,"bluetol",0,"Blue Tolerance");

	CLASS_STICKY_CATEGORY_CLEAR(_jit_keyscreen_class);
	CLASS_STICKY_ATTR_CLEAR(_jit_keyscreen_class, "basic");

	jit_class_register(_jit_keyscreen_class);

	return JIT_ERR_NONE;
}