void ui_internals_createColors(t_ui* obj) { uiInternalObject *anObject; t_atom a[2]; anObject = new uiInternalObject("jcom.parameter", "view/color/contentBackground", obj->box.b_patcher, "array", "none", "The background color of the module in the format RGBA where values range [0.0, 1.0].", NULL, NULL, NULL, NULL); anObject->setAction((method)ui_color_contentBackground, (t_object*)obj); hashtab_store(obj->hash_internals, gensym("view/color/contentBackground"), (t_object*)anObject); anObject = new uiInternalObject("jcom.parameter", "view/color/toolbarBackground", obj->box.b_patcher, "array", "none", "The background color of the module's toolbar in the format RGBA where values range [0.0, 1.0].", NULL, NULL, NULL, NULL); anObject->setAction((method)ui_color_toolbarBackground, (t_object*)obj); hashtab_store(obj->hash_internals, gensym("view/color/toolbarBackground"), (t_object*)anObject); anObject = new uiInternalObject("jcom.parameter", "view/color/toolbarText", obj->box.b_patcher, "array", "none", "The color of the module's toolbar text in the format RGBA where values range [0.0, 1.0].", NULL, NULL, NULL, NULL); anObject->setAction((method)ui_color_toolbarText, (t_object*)obj); hashtab_store(obj->hash_internals, gensym("view/color/toolbarText"), (t_object*)anObject); anObject = new uiInternalObject("jcom.parameter", "view/color/border", obj->box.b_patcher, "array", "none", "The border color of the module in the format RGBA where values range [0.0, 1.0].", NULL, NULL, NULL, NULL); anObject->setAction((method)ui_color_border, (t_object*)obj); hashtab_store(obj->hash_internals, gensym("view/color/border"), (t_object*)anObject); anObject = new uiInternalObject("jcom.parameter", "view/size", obj->box.b_patcher, "array", "none", "The size of the module's UI.", NULL, NULL, NULL, NULL); //anObject->setAction((method)ui_color_border, (t_object*)obj); anObject->setReadonly(true); atom_setlong(a+0, obj->box.b_patching_rect.width); atom_setlong(a+1, obj->box.b_patching_rect.height); anObject->setValue(2, a); hashtab_store(obj->hash_internals, gensym("view/size"), (t_object*)anObject); }
void a_list(t_toascii *x, t_symbol *s, short ac, t_atom *av) { short i, j; t_atom *outlist; char outbuf[MAXSIZE]; char inbuf[MAXSIZE]; long position = 0; char *outptr, *inptr; inptr = inbuf; outptr = outbuf; outlist = x->a_outlist; for(i=0;i<ac;i++){ switch(av[i].a_type){ case A_LONG: sprintf(inbuf, "%ld", (long)av[i].a_w.w_long); break; case A_FLOAT: sprintf(inbuf, "%.6f", av[i].a_w.w_float); break; case A_SYM: sprintf(inbuf, "%s", av[i].a_w.w_sym->s_name); break; } for(j=0;j<strlen(inbuf);j++){ atom_setlong(outlist+(position+j), inbuf[j]); } atom_setlong(outlist+(position+j),32); position += j + 1; } x->a_len = position-1; outlet_list(x->a_out, 0L, x->a_len, outlist); }
void SDIFfileinfo_output(t_sdif_fileinfo *x) { int i; t_atom arguments[5]; // ID, type, start, end, #frames // post("File %s has %d streams:", x->x_filenameSymbol->s_name, x->x_ns); atom_setsym(arguments, x->x_filenameSymbol); atom_setlong(arguments+1, x->x_ns); outlet_anything(x->outlet, ps_file, 2, arguments); for (i = 0; i < x->x_ns; ++i) { /* post(" ID %d, type %c%c%c%c, start %g end %g, %d frames", x->x_streamID[i], x->x_frameType[i][0], x->x_frameType[i][1], x->x_frameType[i][2], x->x_frameType[i][3], x->x_starttime[i], x->x_endtime[i], x->x_numframes[i]); */ atom_setlong(arguments, x->x_streamID[i]); atom_setsym(arguments+1, x->x_frameTypeSymbol[i]); atom_setfloat(arguments+2, x->x_starttime[i]); atom_setfloat(arguments+3, x->x_endtime[i]); atom_setlong(arguments+4, x->x_numframes[i]); outlet_anything(x->outlet, ps_stream, 5, arguments); } }
void omax_object_ioReport(t_object *x, t_symbol *msg, int argc, t_atom *argv) { long buflen; char *buf = NULL; if(argc == 0){ t_atom a; atom_setsym(&a, gensym("/*")); omax_object_createIOReport(x, msg, 1, &a, &buflen, &buf); }else{ omax_object_createIOReport(x, msg, argc, argv, &buflen, &buf); } if(!buf){ return; } char bundle[buflen + OSC_HEADER_SIZE]; osc_bundle_s_setBundleID(bundle); memcpy(bundle + OSC_HEADER_SIZE, buf, buflen); void *outlet = omax_object_getInfoOutlet(x); if(outlet){ t_atom out[2]; atom_setlong(out, buflen + OSC_HEADER_SIZE); atom_setlong(out + 1, (long)bundle); outlet_anything(outlet, gensym("FullPacket"), 2, out); } if(buf){ sysmem_freeptr(buf); } }
t_max_err hoa_gain_getvalueof(t_hoa_gain *x, long *ac, t_atom **av) { if (ac && av) { if (*ac && *av) { atom_setlong(*av+0, (long)x->f_inputMode); if (x->f_inputMode == MIDI) { atom_setlong(*av+1, (long)hoa_gain_get_input_mode_value(x)); } else { atom_setfloat(*av+1, hoa_gain_get_input_mode_value(x)); } } else { *ac = 2; *av = (t_atom *)getbytes(2 * sizeof(t_atom)); } atom_setlong(*av+0, (long)x->f_inputMode); if (x->f_inputMode == MIDI) { atom_setlong(*av+1, (long)hoa_gain_get_input_mode_value(x)); } else { atom_setfloat(*av+1, hoa_gain_get_input_mode_value(x)); } } return MAX_ERR_NONE; }
short posit_enumnames(t_patcher *p, t_posit *x) { t_object *jb; t_rect jr; t_symbol *scriptingname; t_symbol *patchername; t_symbol *classname; t_atom *outlist; outlist = x->p_outlist; patchername = jpatcher_get_name(p); if(patchername && patchername != ps_nothing) { // post("patchername is %s", patchername->s_name jb = jpatcher_get_firstobject(p); // get the first BOX in the object list while(jb) { // iterate through patcher classname = jbox_get_maxclass(jb); // class name scriptingname = jbox_get_varname(jb); // scripting name if (scriptingname && scriptingname != ps_nothing) { jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, scriptingname); // scripting name atom_setlong(outlist+2, (long)((long)jr.x)); atom_setlong(outlist+3, (long)((long)jr.y)); atom_setlong(outlist+4, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+5, (long)((long)jr.y + (long)jr.height)); atom_setsym(outlist+6, patchername); // patcher name outlet_list(x->p_outlet,0L,7,outlist); } jb = jbox_get_nextobject(jb); // iterate } } return 0; }
short posit_enumquery(t_patcher *p, t_posit *x) { t_object *jb; t_rect jr; t_symbol *scriptingname; t_symbol *patchername; t_symbol *classname; t_atom *outlist; outlist = x->p_outlist; jb = jpatcher_get_firstobject(p); // get the first BOX in the object list patchername = jpatcher_get_name(p); while(jb) { // iterate through patcher classname = jbox_get_maxclass(jb); // class name scriptingname = jbox_get_varname(jb); // scripting name if (scriptingname && scriptingname == x->p_query[0].a_w.w_sym) { jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, scriptingname); // scripting name atom_setlong(outlist+2, (long)((long)jr.x)); atom_setlong(outlist+3, (long)((long)jr.y)); atom_setlong(outlist+4, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+5, (long)((long)jr.y + (long)jr.height)); atom_setsym(outlist+6, patchername); // patcher name outlet_list(x->p_outlet,0L,7,outlist); x->p_state = 1; break; } jb = jbox_get_nextobject(jb); // iterate } return 0; }
// Method for list input (converts a list of bits into a long) void bits_list(t_bits *x, t_symbol *msg, short argc, t_atom *argv) { int i, j; // counters long val = 0; // Our bit-constructed number long temp; Atom templist[3]; // used in matrixctrl mode if(x->mode==ps_bits2ints){ // *** BIT-LIST TO INTEGER(LIST) MODE *** for(i=(argc - 1); i>=0; i--){ temp = argv[i].a_w.w_long; val |= temp<<(argc-(i+1)); // bit shift, then or it with the val } outlet_int(x->my_outlet[0], val); // spit it out } else if(x->mode==ps_matrixctrl2ints){ // *** MATRIX-CTRL TO INTEGER-LIST MODE *** object_post((t_object *)x, "tap.bits: This mode is not yet implemented"); } else if(x->mode==ps_ints2matrixctrl){ // *** INTEGER-LIST TO MATRIX-CTRL MODE *** for(j=0; j<argc; j++){ atom_setlong(templist+1, j); // Store the row in the output list temp = argv[j].a_w.w_long; // Get the value in the input list (for the moment we assume it is an int - should also handle floats) for(i=0; i < x->matrix_width; i++){ atom_setlong(templist+0, i); // Store the column in the output list atom_setlong(templist+2, 1 & temp); // Store the switch value in the output list temp = temp>>1; // Bit shift to the next one outlet_list(x->my_outlet[0], 0L, 3, templist); // output the result } } } else // use the Jitter attribute dumpout outlet to report an error
void wsserver::outputData() { t_atom argv[2]; for (int i=0; i<getMaxNConnections(); i++) { wsserver::ws_connection* ws_conn = getConnection(i); WDL_MutexLock(&ws_conn->mutex); if(ws_conn->newdatatoserver && ws_conn->toserver.GetLength()) { atom_setlong(&argv[0], i); if (strncmp(ws_conn->toserver.Get(), "cx", 2) == 0) // connected { atom_setlong(&argv[1], 1); outlet_anything(m_outlets[0], gensym("cx"), 2, argv); } else if (strncmp(ws_conn->toserver.Get(), "dx", 2) == 0) // disconnected { atom_setlong(&argv[1], 0); outlet_anything(m_outlets[0], gensym("cx"), 2, argv); } else // message { atom_setsym(&argv[1], gensym(ws_conn->toserver.Get())); outlet_anything(m_outlets[0], gensym("rx"), 2, argv); } ws_conn->newdatatoserver = false; } } }
void *hoa_dac_new(t_symbol *s, int argc, t_atom *argv) { int i, j, count = 0; t_hoa_dac *x; t_atom channels[512]; int min, max; int symPrepend = 0; x = (t_hoa_dac *)object_alloc(hoa_dac_class); if (argc && atom_gettype(argv) == A_SYM) { char *dac_bus_name = atom_getsym(argv)->s_name; if (isalpha(dac_bus_name[0])) // only works if the first letter isn't a number { symPrepend = 1; atom_setsym(channels, atom_getsym(argv)); } } for(i = 0; i < (argc-symPrepend); i++) { if(atom_gettype(argv+i+symPrepend) == A_SYM) { min = atoi(atom_getsym(argv+i+symPrepend)->s_name); if (min < 10) max = atoi(atom_getsym(argv+i+symPrepend)->s_name+2); else if (min < 100) max = atoi(atom_getsym(argv+i+symPrepend)->s_name+3); else if (min < 1000) max = atoi(atom_getsym(argv+i+symPrepend)->s_name+4); else max = atoi(atom_getsym(argv+i+symPrepend)->s_name+5); if (max > min) { for(j = min; j <= max; j++) { atom_setlong(channels + symPrepend + count++, j); } } else { for(j = min; j >= max; j--) { atom_setlong(channels + symPrepend + count++, j); } } } else if(atom_gettype(argv + symPrepend + i) == A_LONG) { atom_setlong(channels + symPrepend + count++, atom_getlong(argv + symPrepend + i)); } } x->f_number_of_channels = count; dsp_setup((t_pxobject *)x, x->f_number_of_channels); x->f_dac = (t_object *)object_new_typed(CLASS_BOX, gensym("dac~"), count + symPrepend, channels); return x; }
void *record_new(t_symbol *s, int argc, t_atom *argv) { // @arg 0 @ambisonic-order @optional 0 @type int @digest The ambisonic order // @description The ambisonic order, must be at least equal to 1 t_object *x; t_atom arguments[2]; int order = 1; if(atom_gettype(argv) == A_LONG) order = atom_getlong(argv); else if(atom_gettype(argv) == A_FLOAT) order = atom_getfloat(argv); if(order < 1) order = 1; int is2D = 1; if (s == gensym("hoa.3d.record~")) is2D = 0; int number_of_channels = is2D ? (order * 2 + 1) : ( (order+1)*(order+1) ); atom_setlong(arguments, number_of_channels); switch (number_of_channels) { case 9: atom_setlong(arguments+1, 181440); break; case 10: atom_setlong(arguments+1, 20160); break; case 11: atom_setlong(arguments+1, 221760); break; case 12: atom_setlong(arguments+1, 60480); break; case 13: atom_setlong(arguments+1, 262080); break; case 14: atom_setlong(arguments+1, 20160); break; case 15: atom_setlong(arguments+1, 60480); break; case 16: atom_setlong(arguments+1, 40320); break; default: atom_setlong(arguments+1, 20160); break; } x = (t_object *)object_new_typed(CLASS_BOX, gensym("sfrecord~"), 2, arguments); return x; }
void OutputTrend(TrendReport *x) { t_atom outputList[4]; atom_setfloat(outputList+0, x->initialValue); atom_setlong(outputList+1, x->direction); atom_setlong(outputList+2, x->numInTrend); atom_setfloat(outputList+3, x->prev); outlet_list(x->outlet, 0L, 4, outputList); }
void tralala_mouseAddNote(t_tll *x) { t_atom a[2]; atom_setlong(a, TLL_X_TO_POSITION(x->cursor.x)); atom_setlong(a + 1, TLL_Y_TO_PITCH(x->cursor.y)); tralala_parseEntry(x, TLL_SYM_NOTE, 2, a, TLL_FLAG_LOW); }
// DUMP: use for debugging - dump state to the Max window void return_dump(t_return *x) { char s[256]; t_atom a[4]; if (x->common.hub != NULL) { snprintf(s, 256, "%s:/description", x->common.attr_name->s_name); atom_setsym(&a[0], gensym(s)); atom_setsym(&a[1], x->common.attr_description); object_method_typed(x->common.hub, jps_feedback, 2, a, NULL); snprintf(s, 256, "%s:/dataspace", x->common.attr_name->s_name); atom_setsym(&a[0], gensym(s)); atom_setsym(&a[1], x->attrDataspace); object_method_typed(x->common.hub, jps_feedback, 2, a, NULL); snprintf(s, 256, "%s:/dataspace/unit/native", x->common.attr_name->s_name); atom_setsym(&a[0], gensym(s)); atom_setsym(&a[1], x->attrUnitNative); object_method_typed(x->common.hub, jps_feedback, 2, a, NULL); snprintf(s, 256, "%s:/enable", x->common.attr_name->s_name); atom_setsym(&a[0], gensym(s)); atom_setlong(&a[1], x->attrEnable); object_method_typed(x->common.hub, jps_feedback, 2, a, NULL); /* TODO: Should we add ramping ability to this object? snprintf(s, 256, "%s:ramp", x->common.attr_name->s_name); atom_setsym(&a[0], gensym(s)); atom_setsym(&a[1], x->attr_ramp); object_method_typed(x->common.hub, jps_feedback, 2, a, NULL); */ snprintf(s, 256, "%s:/range/bounds", x->common.attr_name->s_name); atom_setsym(&a[0], gensym(s)); atom_setfloat(&a[1], x->common.attr_range[0]); atom_setfloat(&a[2], x->common.attr_range[1]); object_method_typed(x->common.hub, jps_feedback, 3, a, NULL); snprintf(s, 256, "%s:/range/clipmode", x->common.attr_name->s_name); atom_setsym(&a[0], gensym(s)); atom_setsym(&a[1], x->common.attr_clipmode); object_method_typed(x->common.hub, jps_feedback, 2, a, NULL); snprintf(s, 256, "%s:/repetitions/allow", x->common.attr_name->s_name); atom_setsym(&a[0], gensym(s)); atom_setlong(&a[1], x->common.attr_repetitions); object_method_typed(x->common.hub, jps_feedback, 2, a, NULL); snprintf(s, 256, "%s:/type", x->common.attr_name->s_name); atom_setsym(&a[0], gensym(s)); atom_setsym(&a[1], x->common.attr_type); object_method_typed(x->common.hub, jps_feedback, 2, a, NULL); } }
void simplemax_anything(t_simplemax *x,t_symbol* s,int argc,t_atom* argv){ // msg is a dispatch name (/foo), argc is # of elements, argv is element vector if (!s){object_error((t_object*)x, "NOOOOOO!!!!");} //object_post((t_object*)x, "%s",msg->s_name); t_osc_bundle_u *bundle = osc_bundle_u_alloc();//alloc creates memory for and initializes the bundle t_osc_message_u *msg = osc_message_u_alloc(); osc_message_u_setAddress(msg, s->s_name); for(int i=0;i < argc;i++){ //going through all the arguments (arg vector) whos length is argc t_osc_atom_u* a = osc_atom_u_alloc(); switch(atom_gettype(argv+i)){ case A_LONG: osc_atom_u_setInt32(a, atom_getlong(argv+i)); break; case A_FLOAT: osc_atom_u_setFloat(a, atom_getfloat(argv+i)); break; case A_SYM: osc_atom_u_setString(a, atom_getsym(argv+i)->s_name); break; } osc_message_u_appendAtom(msg, a); //osc_message_u_appendFloat(msg, 15.0); } osc_bundle_u_addMsg(bundle, msg); long bytes = 0;//length of byte array char* pointer = NULL; osc_bundle_u_serialize(bundle, &bytes, &pointer);//& is adress of the variable //post("%ld %p", bytes,pointer); t_atom out[2]; atom_setlong(out, bytes); atom_setlong(out+1, (long)pointer); outlet_anything(x->outlet, gensym("FullPacket"), 2, out); osc_bundle_u_free(bundle);//get rid of stuff in osc message osc_mem_free(pointer);//marks pointer address as being free (clear if you want to keep using same pointer) }
void connect_connect(t_object *x, t_object *send, int outlet, t_object *receive, int inlet) { t_atom msg[4]; t_atom rv; atom_setobj(msg, send); atom_setlong(msg + 1, outlet); atom_setobj(msg + 2, receive); atom_setlong(msg + 3, inlet); object_method_typed(x , gensym("connect"), 4, msg, &rv); }
void iterator_notify(t_iterator *x, t_symbol *s, t_symbol *msg, void *sender, void *data) { // post("got %s message from %X (%s)", msg->s_name, sender, s->s_name); if (msg == gensym("attr_modified") && sender == x->a_patcherview) { // sent when an attribute of the sender changes t_symbol *attrname; // 'data' arg is the modified attribute object // get its name: attrname = (t_symbol *)object_method(data, gensym("getname")); post("'%s' attribute was modified", attrname->s_name); if (attrname == gensym("rect")) { t_atom *av = NULL; long ac = 0; object_attr_getvalueof(sender, attrname, &ac, &av); if (ac && av) { t_object *jb; post("new rect: %ld %ld %ld %ld", atom_getlong(av), atom_getlong(av+1), atom_getlong(av+2), atom_getlong(av+3)); object_obex_lookup(x, gensym("#B"), &jb); if (jb) { t_atom *rv = NULL; long rc = 0; object_attr_getvalueof(jb, gensym("patching_rect"), &rc, &rv); if (rc && rv) { // we have box rect // compare cached view size to current view long dx = atom_getlong(av+2) - x->a_cached.x; long dy = atom_getlong(av+3) - x->a_cached.y; long boxw = atom_getlong(rv+2); long boxh = atom_getlong(rv+3); // recache new size x->a_cached.x = atom_getlong(av+2); x->a_cached.y = atom_getlong(av+3); // modify my box width atom_setlong(rv+2, boxw + dx); // (height is ignored by jnewobj) atom_setlong(rv+3, boxh + dy); object_attr_setvalueof(jb, gensym("patching_rect"), rc, rv); freebytes(rv, sizeof(t_atom) * rc); } } freebytes(av, sizeof(t_atom) * ac); } } } }
void oedge_perform64(t_oedge *x, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long vectorsize, long flags, void *userparam) { omax_realtime_clock_tick(x); t_osc_timetag now; omax_realtime_clock_now(&now); atom_setlong(x->av + 1, x->blockcount++); atom_setlong(x->av + 2, osc_timetag_ntp_getSeconds(now));//(((uint64_t)now) & 0xffffffff00000000) >> 32); atom_setlong(x->av + 3, osc_timetag_ntp_getFraction(now));//(((uint64_t)now) & 0xffffffff)); atom_setdouble_array(x->ac, x->av + 4, vectorsize, ins[0]); schedule_delay(x, (method)oedge_callback, 0, NULL, vectorsize + 4, x->av); }
void changelist_int(t_changelist *x, long i) { long in = SECT_PROXY_GETINLET(x); if(in == 0){ x->c_len = 1; atom_setlong(x->c_input, i); do_comparison(x) ; }else if(in == 1){ atom_setlong(x->c_compare, i); x->c_complen = 1; } }
void connect_connect(t_patcher *p, t_object *send, int outlet, t_object *receive, int inlet) { t_atom msg[4]; t_atom rv; atom_setobj(msg, send); atom_setlong(msg + 1, outlet); atom_setobj(msg + 2, receive); atom_setlong(msg + 3, inlet); object_method_typed(p , hoa_sym_connect, 4, msg, &rv); }
void bench_anything(t_bench *x, t_symbol *msg, short argc, t_atom *argv){ t_atom out[2]; if(x->t_objmode == BENCH_IN){ uint64_t t = mach_absolute_time(); uint32_t l1, l2; l1 = (uint32_t)((t & 0xffffffff00000000LL) >> 32); l2 = (uint32_t)(t & 0xffffffffLL); atom_setlong(&out[0], l1); atom_setlong(&out[1], l2); outlet_list(x->out1, NULL, 2, out); outlet_anything(x->out0, msg, argc, argv); }else{
void deferred_startup(void) { t_atom a[2]; atom_setlong(a+0, g_port_send); atom_setlong(a+1, g_port_listen); // cannot load classes from disk at the time that the extensions folder is processed ps_testport->s_thing = (t_object*)object_new_typed(_sym_nobox, ps_testport, 2, a); // notify anyone who is listening (e.g. a ruby script that launched max) that we are ready object_method(ps_testport->s_thing, _sym_send, gensym("/testport/ready"), 0, NULL); }
void posit_getinfo(t_posit *x) { t_object *jp; t_object *jb; t_object *pbox; t_rect jr; t_symbol *scriptingname = ps_none; t_symbol *patchername = ps_none; t_symbol *patcherscriptingname = ps_none; t_max_err err; t_symbol *classname; t_atom *outlist; outlist = x->p_outlist; err = object_obex_lookup(x, gensym("#P"), (t_object **)&jp); // get the object's parent patcher if (err != MAX_ERR_NONE) return; err = object_obex_lookup(x, gensym("#B"), (t_object **)&jb); // get the object's wrapping box if (err != MAX_ERR_NONE) return; patchername = jpatcher_get_name(jp); classname = jbox_get_maxclass(jb); // class name scriptingname = jbox_get_varname(jb); // scripting name if (scriptingname == NULL || scriptingname == ps_nothing) { scriptingname = ps_none; } pbox = jpatcher_get_box(jp); if(pbox) patcherscriptingname = jbox_get_varname(pbox); // scripting name if (patcherscriptingname == NULL || patcherscriptingname == ps_nothing) { patcherscriptingname = ps_none; } jbox_get_patching_rect(jb, &jr); // x, y, width, height (double) atom_setsym(outlist+0, classname); // class name atom_setsym(outlist+1, scriptingname); // scripting name atom_setlong(outlist+2, (long)((long)jr.x)); atom_setlong(outlist+3, (long)((long)jr.y)); atom_setlong(outlist+4, (long)((long)jr.x + (long)jr.width)); atom_setlong(outlist+5, (long)((long)jr.y + (long)jr.height)); atom_setsym(outlist+6, patchername); // patcher name atom_setsym(outlist+7, patcherscriptingname); outlet_list(x->p_outlet,0L,8,outlist); outlet_bang(x->p_outlet2); //bang to notify of end of dump }
void in_int(TTPtr self, long value) { t_atom a; atom_setlong(&a, value); in_list(self, _sym_int, 1, &a); }
// INT INPUT void return_int(t_return *x, long value) { if (!x->attrEnable) return; if (x->common.attr_repetitions == 0) { if (value == atom_getlong(&x->output[1])) return; } if (x->common.attr_clipmode != _sym_none) { if (x->common.attr_clipmode == jps_both) TTLimit<TTInt32>(value, x->common.attr_range[0], x->common.attr_range[1]); else if (x->common.attr_clipmode == jps_low) TTLimitMin<TTInt32>(value, x->common.attr_range[0]); else if (x->common.attr_clipmode == jps_high) TTLimitMax<TTInt32>(value, x->common.attr_range[1]); else if (x->common.attr_clipmode == jps_wrap) value = TTInfWrap<TTInt32>(value,x->common.attr_range[0], x->common.attr_range[1]); else if (x->common.attr_clipmode == jps_fold) value = TTFold<TTInt32>(value, x->common.attr_range[0], x->common.attr_range[1]); } atom_setlong(&x->output[1], value); x->output_len = 2; return_send_feedback(x); outlet_int(x->outlets[k_outlet_thru], value); }
/*------------------------------------ spaceballPerformWriteCommand ---*/ void spaceballPerformWriteCommand(SpaceballData * xx, const short numBytesToSend, unsigned char * bytesToFollow) { unsigned char dataValue; static t_atom dataList[OUT_BUFFER_SIZE]; if (xx) { short prevLock = lockout_set(1); /* Make sure serialX is in 'chunk' mode. */ if (! xx->fChunkPulseSent) { outlet_bang(xx->fChunkSendOut); xx->fChunkPulseSent = true; } /* Send data. */ for (short ii = 0; ii < numBytesToSend; ++ii, ++bytesToFollow) { dataValue = *bytesToFollow; atom_setlong(dataList + ii, dataValue); } outlet_list(xx->fDataSendOut, 0L, numBytesToSend, dataList); lockout_set(prevLock); } } // spaceballPerformWriteCommand
void max_jit_openni_post_events(t_jit_openni *x, enum JitOpenNIEvents iEventType, XnUserID userID) { t_atom osc_argv; atom_setlong(&osc_argv, userID); outlet_anything(((t_max_jit_openni *)(x->pParent))->osc_outlet, gensym(strSkeletonEvents[((t_max_jit_openni *)(x->pParent))->chrSkeletonOutputFormat][iEventType]), 1, &osc_argv); }
void minimum_int(t_minimum *x, long n) { systhread_mutex_lock(x->m_mutex); atom_setlong(x->m_args,n); systhread_mutex_unlock(x->m_mutex); minimum_bang(x); }
// INTEGER INPUT void pack_int(t_pack *x, long value) { atom_setlong(x->mylist+(x->inletnum), value); if (x->triggerlist[(x->inletnum)] != 0) outlet_list(x->my_outlet, 0L, x->mylistlen, x->mylist); // output the result }
void howbigisyourp_dump(t_howbigisyourp *x) { t_an_item *item; t_atom a; t_linklist *list = linklist_new(); linklist_flags(list, OBJ_FLAG_MEMORY); // will use sysmem_freeptr on the objects // first item of list contains the totalnumberofobjects item = an_item_new(gensym("totalnumberofobjects"), 0); linklist_append(list, item); // copy the hash table to a linklist, and count the total number of object hashtab_funall(x->hash, (method)howbigisyourp_cp_to_linklist, list); // get the first item totalnumberofobjects which now contains the total number of objects item = linklist_getindex(list, 0); post("The total number of objects is %d", item->val); linklist_deleteindex(list, 0); // remove it so we can proceed // sorting is nicer linklist_sort(list, linklist_ascending); // iterate through the linklist and output {name, instances} out the outlet. item = linklist_getindex(list, 0); while (item) { atom_setlong(&a, item->val); outlet_anything(x->out, item->name, 1, &a); linklist_next(list, item, (void **)&item); } // free the linklist items, the hashtab items are not removed). if (list) object_free(list); }