void hoa_3d_decoder_resize_outlets(t_hoa_3d_decoder *x) { t_object *b = NULL; object_obex_lookup(x, hoa_sym_pound_B, (t_object **)&b); if (b) { object_method(hoa_sym_dsp->s_thing, hoa_sym_stop); object_method(b, hoa_sym_dynlet_begin); if(outlet_count((t_object *)x) > x->f_decoder->getNumberOfPlanewaves()) { for(int i = outlet_count((t_object *)x); i > x->f_decoder->getNumberOfPlanewaves(); i--) { outlet_delete(outlet_nth((t_object*)x, i-1)); } } else if(outlet_count((t_object *)x) < x->f_decoder->getNumberOfPlanewaves()) { for(int i = outlet_count((t_object *)x); i < x->f_decoder->getNumberOfPlanewaves(); i++) { outlet_append((t_object*)x, NULL, hoa_sym_signal); } } object_method(b, hoa_sym_dynlet_end); } }
void make_patchline(t_connect *x) { int connexions, valid_objects, i, j; valid_objects = 0; t_object *obj1, *obj2; t_hoa_err err[2]; t_hoa_boxinfos* startobj_infos; t_hoa_boxinfos* endobj_infos; short startobj_type, endobj_type; long outlets, inlets; if (x->f_nbSelected > 1) { for (i = 0; i < x->f_nbSelected; i++) { obj1 = jbox_get_object(x->f_objects[i]); if(object_is_hoa(obj1) || is_obj_hoa_exotic(obj1)) x->f_objects[valid_objects++] = x->f_objects[i]; // ! store BOX objects } if (valid_objects > 1) { startobj_infos = (t_hoa_boxinfos*) malloc( sizeof(t_hoa_boxinfos)); endobj_infos = (t_hoa_boxinfos*) malloc( sizeof(t_hoa_boxinfos)); for(i = 1; i < valid_objects; i++) { obj1 = jbox_get_object(x->f_objects[i-1]); obj2 = jbox_get_object(x->f_objects[ i ]); outlets = inlets = 0; // referenced object or exotic hoa one; startobj_type = object_is_hoa(obj1); endobj_type = object_is_hoa(obj2); hoa_boxinfos_init(startobj_infos); hoa_boxinfos_init(endobj_infos); err[0] = (t_hoa_err) object_method(obj1, hoa_sym_hoa_getinfos, startobj_infos, NULL); err[1] = (t_hoa_err) object_method(obj2, hoa_sym_hoa_getinfos, endobj_infos, NULL); // get number of outlets if (startobj_type == 1 && err[0] == HOA_ERR_NONE) outlets = startobj_infos->autoconnect_outputs; else outlets = outlet_count(obj1); // get number of inlets if (endobj_type == 1 && err[1] == HOA_ERR_NONE) inlets = endobj_infos->autoconnect_inputs; else inlets = inlet_count(obj2); connexions = MIN(outlets, inlets); for(j = 0; j < connexions; j++) connect_connect(x->f_patcher, x->f_objects[i-1], j, x->f_objects[i], j); } free(startobj_infos); free(endobj_infos); } for(i = 0; i < CONNECT_MAX_TAB; i++) x->f_objects[i] = NULL; jpatcher_set_dirty(x->f_patcherview, true); } x->f_nbSelected = 0; }