// // Programmer: Craig Stuart Sapp // Creation Date: Sun Feb 2 05:51:23 PST 2003 // Last Modified: Sun Feb 2 05:58:35 PST 2003 // Filename: intin.c // Web Address: http://peabody.sapp.org/class/dmp2/lab/intin/intin.c // Syntax: C; Max4/MSP2 External Object; CodeWarrior 6.0 // OS: Mac OS 9; PPC // // Description: Demonstration of how to receive multiple integers for object. // #include "ext.h" typedef struct { t_object max_data; // Max/MSP data, MUST come first in struct void* output; // output bang function pointer } MyObject; void* object_data = NULL; // function declarations: void main (void); void* create_object (void); void Input1 (MyObject* mo, long value); void Input2 (MyObject* mo, long value); void Input3 (MyObject* mo, long value); void Input4 (MyObject* mo, long value); void Input5 (MyObject* mo, long value); ////////////////////////////// // // main -- called once when the object is created in a patcher window. // void main(void) { setup((t_messlist**)&object_data, (method)create_object, NULL, sizeof(MyObject), NULL, A_NOTHING); addint ((method)Input1); // inlet 1 addinx ((method)Input2, 4); // inlet 2 addinx ((method)Input3, 3); // inlet 3 addinx ((method)Input4, 2); // inlet 4 addinx ((method)Input5, 1); // inlet 5 } ////////////////////////////// // // create_object -- create the data storage for the mydiff object and // and setup input 1. // void* create_object(void) { MyObject* mo = (MyObject*)newobject(object_data); mo->output = intout(mo); intin(mo, 1); intin(mo, 2); intin(mo, 3); intin(mo, 4); return mo; } ////////////////////////////// // // InputX -- behavior of the object when a new number comes // in on each inlet. // void Input1(MyObject* mo, long value) { outlet_int(mo->output, 1); } void Input2(MyObject* mo, long value) { outlet_int(mo->output, 2); } void Input3(MyObject* mo, long value) { outlet_int(mo->output, 3); } void Input4(MyObject* mo, long value) { outlet_int(mo->output, 4); } void Input5(MyObject* mo, long value) { outlet_int(mo->output, 5); }