Update of /cvsroot/pure-data/externals/postlude/dssi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8805/src
Modified Files: dssi~.c dssi~.h jsearch.c Log Message: Restructed loader/free.Added plug facility, which currently doesn't work with DSP on.
Index: jsearch.c =================================================================== RCS file: /cvsroot/pure-data/externals/postlude/dssi/src/jsearch.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** jsearch.c 11 Mar 2006 20:32:51 -0000 1.1 --- jsearch.c 17 Mar 2006 17:08:49 -0000 1.2 *************** *** 38,42 **** struct dirent * psDirectoryEntry; void * pvPluginHandle; ! int is_DSSI;
lDirLength = strlen(pcDirectory); --- 38,42 ---- struct dirent * psDirectoryEntry; void * pvPluginHandle; ! int is_DSSI = 0;
lDirLength = strlen(pcDirectory);
Index: dssi~.c =================================================================== RCS file: /cvsroot/pure-data/externals/postlude/dssi/src/dssi~.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dssi~.c 15 Mar 2006 17:29:14 -0000 1.8 --- dssi~.c 17 Mar 2006 17:08:49 -0000 1.9 *************** *** 112,116 **** return (DSSI_Descriptor *)dssiDesc; } ! static void dssi_tilde_load_plugin(const char *dll_path, void **dll_handle){
--- 112,116 ---- return (DSSI_Descriptor *)dssiDesc; } ! /* static void dssi_tilde_load_plugin(const char *dll_path, void **dll_handle){
*************** *** 123,127 ****
} ! static void dssi_tilde_port_info(t_dssi_tilde *x){ t_int i; --- 123,127 ----
} ! */ static void dssi_tilde_port_info(t_dssi_tilde *x){ t_int i; *************** *** 253,257 **** }
! static void dssi_tilde_initialize(t_dssi_tilde *x, t_int instance){
x->instances[instance].pluginPrograms = NULL; --- 253,257 ---- }
! static void dssi_tilde_init_instance(t_dssi_tilde *x, t_int instance){
x->instances[instance].pluginPrograms = NULL; *************** *** 272,275 **** --- 272,276 ---- x->instances[instance].ui_hidden = 1; x->instances[instance].ui_show = 0; + x->instances[instance].gui_pid = 0; #if DEBUG post("Instance %d initialized!", instance); *************** *** 531,536 **** x->plugin_ControlDataInput[portno] = value;
! lo_send(x->instances[instance].uiTarget, ! x->instances[instance].ui_osc_control_path, "if", port, value); }
--- 532,538 ---- x->plugin_ControlDataInput[portno] = value;
! if(x->is_DSSI) ! lo_send(x->instances[instance].uiTarget, ! x->instances[instance].ui_osc_control_path, "if", port, value); }
*************** *** 738,741 **** --- 740,758 ---- }
+ static void dssi_tilde_get_current_program(t_dssi_tilde *x, int instance){ + int i; + t_atom argv[2]; + + argv[0].a_type = A_FLOAT; + argv[1].a_type = A_SYMBOL; + i = x->instances[instance].currentProgram; + + argv[0].a_w.w_float = x->instances[instance].pluginPrograms[i].Program; + argv[1].a_w.w_symbol = + gensym ((char*)x->instances[instance].pluginPrograms[i].Name); + outlet_anything (x->control_outlet, gensym ("program"), 2, argv); + + } + static void dssi_tilde_program_change(t_dssi_tilde *x, int instance){ /* jack-dssi-host queues program changes by using pending program change variables. In the audio callback, if a program change is received via MIDI it over writes the pending value (if any) set by the GUI. If unset, or processed the value will default back to -1. The following call to select_program is then made. I don't think it eventually needs to be done this way - i.e. do we need 'pending'? */ *************** *** 777,780 **** --- 794,798 ---- x->instances[instance].pendingBankLSB = -1; } + dssi_tilde_get_current_program(x, instance); }
*************** *** 1270,1274 **** x->instanceHandles[instance], key, value); ! if(x->instances[instance].uiTarget != NULL) lo_send(x->instances[instance].uiTarget, x->instances[instance].ui_osc_configure_path, --- 1288,1292 ---- x->instanceHandles[instance], key, value); ! if(x->instances[instance].uiTarget != NULL && x->is_DSSI) lo_send(x->instances[instance].uiTarget, x->instances[instance].ui_osc_configure_path, *************** *** 1467,1470 **** --- 1485,1489 ----
static t_int dssi_tilde_dssi_methods(t_dssi_tilde *x, t_symbol *s, int argc, t_atom *argv) { + if(x->is_DSSI){ char *msg_type, *debug, *filename, *key, *value; msg_type = (char *)malloc(TYPE_STRING_SIZE); *************** *** 1705,1708 **** --- 1724,1730 ---- free(msg_type); free(patchbuf); + } + else + post("dssi~: plugin is not a DSSI plugin, operation not supported"); return 0;
*************** *** 1720,1808 **** int i, n, timediff, framediff, instance = 0;
! for(i = 0; i < x->plugin_ins; i++) ! memcpy(x->plugin_InputBuffers[i], x->inlets[i], N * ! sizeof(LADSPA_Data));
! for (i = 0; i < x->n_instances; i++) ! x->instanceEventCounts[i] = 0;
! for (;x->bufReadIndex != x->bufWriteIndex; x->bufReadIndex = ! (x->bufReadIndex + 1) % EVENT_BUFSIZE) {
! instance = x->midiEventBuf[x->bufReadIndex].data.note.channel; ! /*This should never happen, but check anyway*/ ! if(instance > x->n_instances || instance < 0){ ! post( ! "%s: discarding spurious MIDI data, for instance %d", ! x->descriptor->LADSPA_Plugin->Label, ! instance); #if DEBUG ! post("n_instances = %d", x->n_instances); #endif ! continue; ! }
! if (x->instanceEventCounts[instance] == EVENT_BUFSIZE){ ! post("MIDI overflow on channel %d", instance); ! continue; ! }
! timediff = (t_int)(clock_gettimesince(x->time_ref) * 1000) - ! x->midiEventBuf[x->bufReadIndex].time.time.tv_nsec; ! framediff = (t_int)((t_float)timediff * .000001 / x->sr_inv);
! if (framediff >= N || framediff < 0) ! x->midiEventBuf[x->bufReadIndex].time.tick = 0; ! else ! x->midiEventBuf[x->bufReadIndex].time.tick = ! N - framediff - 1;
! x->instanceEventBuffers[instance] ! [x->instanceEventCounts[instance]] = ! x->midiEventBuf[x->bufReadIndex]; #if DEBUG ! post("%s, note received on channel %d", ! x->descriptor->LADSPA_Plugin->Label, ! x->instanceEventBuffers[instance] ! [x->instanceEventCounts[instance]].data.note.channel); #endif ! x->instanceEventCounts[instance]++;
#if DEBUG ! post("Instance event count for instance %d of %d: %d\n", ! instance + 1, x->n_instances, x->instanceEventCounts[instance]); #endif
- } - - i = 0; - while(i < x->n_instances){ - if(x->instanceHandles[i] && - x->descriptor->run_multiple_synths){ - x->descriptor->run_multiple_synths - (x->n_instances, x->instanceHandles, - (unsigned long)N, x->instanceEventBuffers, - &x->instanceEventCounts[0]); - break; } - else if (x->instanceHandles[i] && - x->descriptor->run_synth){ - x->descriptor->run_synth(x->instanceHandles[i], - (unsigned long)N, x->instanceEventBuffers[i], - x->instanceEventCounts[i]); - i++; - } - else if (x->instanceHandles[i] && - x->descriptor->LADSPA_Plugin->run){ - x->descriptor->LADSPA_Plugin->run - (x->instanceHandles[i], N); - i++; - } - }
! for(i = 0; i < x->plugin_outs; i++) ! memcpy(x->outlets[i], x->plugin_OutputBuffers[i], N * ! sizeof(LADSPA_Data));
return (w+3); } --- 1742,1832 ---- int i, n, timediff, framediff, instance = 0;
! if(x->dsp){
! for(i = 0; i < x->plugin_ins; i++) ! memcpy(x->plugin_InputBuffers[i], x->inlets[i], N * ! sizeof(LADSPA_Data));
! for (i = 0; i < x->n_instances; i++) ! x->instanceEventCounts[i] = 0;
! for (;x->bufReadIndex != x->bufWriteIndex; x->bufReadIndex = ! (x->bufReadIndex + 1) % EVENT_BUFSIZE) { ! ! instance = x->midiEventBuf[x->bufReadIndex].data.note.channel; ! /*This should never happen, but check anyway*/ ! if(instance > x->n_instances || instance < 0){ ! post( ! "%s: discarding spurious MIDI data, for instance %d", ! x->descriptor->LADSPA_Plugin->Label, ! instance); #if DEBUG ! post("n_instances = %d", x->n_instances); #endif ! continue; ! }
! if (x->instanceEventCounts[instance] == EVENT_BUFSIZE){ ! post("MIDI overflow on channel %d", instance); ! continue; ! }
! timediff = (t_int)(clock_gettimesince(x->time_ref) * 1000) - ! x->midiEventBuf[x->bufReadIndex].time.time.tv_nsec; ! framediff = (t_int)((t_float)timediff * .000001 / x->sr_inv);
! if (framediff >= N || framediff < 0) ! x->midiEventBuf[x->bufReadIndex].time.tick = 0; ! else ! x->midiEventBuf[x->bufReadIndex].time.tick = ! N - framediff - 1;
! x->instanceEventBuffers[instance] ! [x->instanceEventCounts[instance]] = ! x->midiEventBuf[x->bufReadIndex]; #if DEBUG ! post("%s, note received on channel %d", ! x->descriptor->LADSPA_Plugin->Label, ! x->instanceEventBuffers[instance] ! [x->instanceEventCounts[instance]].data.note.channel); #endif ! x->instanceEventCounts[instance]++;
#if DEBUG ! post("Instance event count for instance %d of %d: %d\n", ! instance + 1, x->n_instances, x->instanceEventCounts[instance]); #endif
}
! i = 0; ! while(i < x->n_instances){ ! if(x->instanceHandles[i] && ! x->descriptor->run_multiple_synths){ ! x->descriptor->run_multiple_synths ! (x->n_instances, x->instanceHandles, ! (unsigned long)N, x->instanceEventBuffers, ! &x->instanceEventCounts[0]); ! break; ! } ! else if (x->instanceHandles[i] && ! x->descriptor->run_synth){ ! x->descriptor->run_synth(x->instanceHandles[i], ! (unsigned long)N, x->instanceEventBuffers[i], ! x->instanceEventCounts[i]); ! i++; ! } ! else if (x->instanceHandles[i] && ! x->descriptor->LADSPA_Plugin->run){ ! x->descriptor->LADSPA_Plugin->run ! (x->instanceHandles[i], N); ! i++; ! } ! }
+ for(i = 0; i < x->plugin_outs; i++) + memcpy(x->outlets[i], x->plugin_OutputBuffers[i], N * + sizeof(LADSPA_Data)); + } return (w+3); } *************** *** 1812,1817 **** if(x->n_instances){ int n, m; ! t_float **outlets = x->outlets; ! t_float **inlets = x->inlets;
m = 1; --- 1836,1841 ---- if(x->n_instances){ int n, m; ! t_float **outlets = (t_float **)x->outlets; ! t_float **inlets = (t_float **)x->inlets;
m = 1; *************** *** 1826,1845 **** }
! static void *dssi_tilde_new(t_symbol *s, t_int argc, t_atom *argv){
! int i, ! stop; ! char *tmpstr, ! *argstr, ! *dll_arg, ! *dll_name, ! *plugin_label; ! ! stop = 0; ! tmpstr = argstr = dll_name = dll_arg = NULL; ! ! t_dssi_tilde *x = (t_dssi_tilde *)pd_new(dssi_tilde_class); ! post("==============================\ndssi~ %.2f\n a DSSI/LADSPA host for Pure Data\n==============================", VERSION); ! x->project_dir = NULL; x->configure_buffer_head = NULL; --- 1850,1949 ---- }
! static void dssi_tilde_quit_plugin(t_dssi_tilde *x){
! t_int i, instance; ! for(instance = 0; instance < x->n_instances; instance++) { ! if(x->instances[instance].uiTarget && x->is_DSSI){ ! lo_send(x->instances[instance].uiTarget, ! x->instances[instance].ui_osc_quit_path, ""); ! lo_address_free(x->instances[instance].uiTarget); ! x->instances[instance].uiTarget = NULL; ! } ! /* no -- see comment in osc_exiting_handler */ ! /* if (!instances[i].inactive) { */ ! if (x->descriptor->LADSPA_Plugin->deactivate) { ! x->descriptor->LADSPA_Plugin->deactivate ! (x->instanceHandles[instance]); ! } ! /* } */ ! if (x->descriptor->LADSPA_Plugin && ! x->descriptor->LADSPA_Plugin->cleanup) { ! x->descriptor->LADSPA_Plugin->cleanup ! (x->instanceHandles[instance]); ! } ! } ! } ! ! static void dssi_tilde_free_plugin(t_dssi_tilde *x){ ! ! t_int i, instance; ! if(x->dll_arg != NULL) ! free((char *)x->dll_arg); ! if(x->plugin_label != NULL) ! free((char *)x->plugin_label); ! if(x->dll_handle != NULL){ ! instance = x->n_instances; ! free((LADSPA_Handle)x->instanceHandles); ! free(x->plugin_ControlInPortNumbers); ! free((t_float *)x->plugin_InputBuffers); ! free(x->instanceEventCounts); ! free(x->plugin_ControlDataInput); ! free(x->plugin_ControlDataOutput); ! ! while(instance--){ ! ! if(x->instances[instance].gui_pid){ ! #if DEBUG ! post("Killing GUI process PID = %d", x->instances[instance].gui_pid); ! #endif ! kill(x->instances[instance].gui_pid, SIGKILL); ! } ! if (x->instances[instance].pluginPrograms) { ! for (i = 0; i < ! x->instances[instance].plugin_ProgramCount; i++) ! free((void *) ! x->instances[instance].pluginPrograms[i].Name); ! free((char *)x->instances[instance].pluginPrograms); ! x->instances[instance].pluginPrograms = NULL; ! x->instances[instance].plugin_ProgramCount = 0; ! } ! free(x->instanceEventBuffers[instance]); ! if(x->is_DSSI){ ! free(x->instances[instance].ui_osc_control_path); ! free(x->instances[instance].ui_osc_configure_path); ! free(x->instances[instance].ui_osc_program_path); ! free(x->instances[instance].ui_osc_show_path); ! free(x->instances[instance].ui_osc_hide_path); ! free(x->instances[instance].ui_osc_quit_path); ! free(x->instances[instance].osc_url_path); ! } ! free(x->instances[instance].plugin_PortControlInNumbers); ! if(x->plugin_outs) ! free(x->plugin_OutputBuffers[instance]); ! } ! if(x->is_DSSI){ ! if(x->project_dir != NULL) ! free(x->project_dir); ! free(x->osc_url_base); ! dssi_tilde_configure_buffer_free(x); ! } ! free((snd_seq_event_t *)x->instanceEventBuffers); ! free(x->instances); ! free((t_float *)x->plugin_OutputBuffers); ! ! /* Have a little nap so PD can catch up */ ! /*sleep(1);*/ ! for(i = 0; i < x->plugin_outs; i++) ! outlet_free(x->outlets[i]); ! for(i = 0; i < x->plugin_ins; i++) ! inlet_free(x->inlets[i]); ! outlet_free(x->control_outlet); ! free(x->dll_name); ! free(x->port_info); ! } ! } ! ! static void dssi_tilde_init_plugin(t_dssi_tilde *x){ ! x->project_dir = NULL; x->configure_buffer_head = NULL; *************** *** 1851,1865 **** x->dll_arg = NULL; x->plugin_label = NULL; ! x->sr = (t_int)sys_getsr(); ! x->sr_inv = 1 / (t_float)x->sr; ! x->time_ref = (t_int)clock_getlogicaltime; ! x->blksize = sys_getblksize(); x->ports_in = x->ports_out = x->ports_controlIn = x->ports_controlOut = 0; x->bufWriteIndex = x->bufReadIndex = 0; - x->n_instances = 0;
! ! if (argc){ argstr = (char *)malloc((strlen(argv[0].a_w.w_symbol->s_name) + 1) * sizeof(char)); --- 1955,1994 ---- x->dll_arg = NULL; x->plugin_label = NULL; ! x->dll_name = NULL; ! x->osc_url_base = NULL; ! x->plugin_ControlDataInput = x->plugin_ControlDataOutput = NULL; ! x->plugin_InputBuffers = x->plugin_OutputBuffers = NULL; ! x->plugin_ControlInPortNumbers = NULL; ! x->port_info = NULL; ! x->descriptor = NULL; ! x->instanceEventCounts = NULL; ! x->instances = NULL; ! x->instanceHandles = NULL; ! x->is_DSSI = 0; ! x->n_instances = 0; ! x->dsp = 0; ! x->plugin_ins = x->plugin_outs = ! x->plugin_controlIns = x->plugin_controlOuts = 0; x->ports_in = x->ports_out = x->ports_controlIn = x->ports_controlOut = 0; x->bufWriteIndex = x->bufReadIndex = 0;
! } ! ! static void *dssi_tilde_load_plugin(t_dssi_tilde *x, t_int argc, t_atom *argv){ ! char *tmpstr, ! *argstr, ! *dll_arg, ! *dll_name, ! *plugin_label; ! #if DEBUG ! post("argc = %d", argc); ! #endif ! int i, ! stop; ! ! stop = 0; ! if (argc){ + tmpstr = argstr = dll_name = dll_arg = NULL; argstr = (char *)malloc((strlen(argv[0].a_w.w_symbol->s_name) + 1) * sizeof(char)); *************** *** 1885,1894 **** } } - #if DEBUG post("plugin library = %s", x->dll_arg); post("plugin name = %s", x->plugin_label); #endif ! if(x->dll_arg != NULL){ x->dll_handle = loadLADSPAPluginLibrary(x->dll_arg); --- 2014,2022 ---- } } #if DEBUG post("plugin library = %s", x->dll_arg); post("plugin name = %s", x->plugin_label); #endif ! if(x->dll_arg != NULL){ x->dll_handle = loadLADSPAPluginLibrary(x->dll_arg); *************** *** 1896,1900 **** }
- if (x->dll_handle != NULL){ tmpstr = (char *)malloc((strlen(x->dll_arg) + 1) * sizeof(char)); --- 2024,2027 ---- *************** *** 1934,1937 **** --- 2061,2068 ---- x->n_instances = 1;
+ + #if DEBUG + post("n_instances = %d", x->n_instances); + #endif x->instances = (t_dssi_instance *)malloc(sizeof(t_dssi_instance) * x->n_instances); *************** *** 1952,1956 **** dssi_tilde_assign_ports(x); for(i = 0; i < x->n_instances; i++){ ! x->instanceHandles[i] = x->descriptor->LADSPA_Plugin->instantiate(x->descriptor->LADSPA_Plugin, x->sr); if (!x->instanceHandles[i]){ post("instantiation of instance %d failed", i); --- 2083,2089 ---- dssi_tilde_assign_ports(x); for(i = 0; i < x->n_instances; i++){ ! x->instanceHandles[i] = ! x->descriptor->LADSPA_Plugin-> ! instantiate(x->descriptor->LADSPA_Plugin, x->sr); if (!x->instanceHandles[i]){ post("instantiation of instance %d failed", i); *************** *** 1959,1978 **** } } - pthread_mutex_init(&x->midiEventBufferMutex, NULL); if(!stop){ for(i = 0;i < x->n_instances; i++) ! dssi_tilde_initialize(x, i); for(i = 0;i < x->n_instances; i++) dssi_tilde_connect_ports(x, i); for(i = 0;i < x->n_instances; i++) - dssi_tilde_osc_setup(x, i); - for(i = 0;i < x->n_instances; i++) dssi_tilde_activate(x, i); ! for(i = 0;i < x->n_instances; i++) ! dssi_tilde_init_programs(x, i); #if LOADGUI ! for(i = 0;i < x->n_instances; i++) ! dssi_tilde_load_gui(x, i); #endif } } --- 2092,2111 ---- } } if(!stop){ for(i = 0;i < x->n_instances; i++) ! dssi_tilde_init_instance(x, i); for(i = 0;i < x->n_instances; i++) dssi_tilde_connect_ports(x, i); for(i = 0;i < x->n_instances; i++) dssi_tilde_activate(x, i); ! if(x->is_DSSI) ! for(i = 0;i < x->n_instances; i++) ! dssi_tilde_osc_setup(x, i); #if LOADGUI ! for(i = 0;i < x->n_instances; i++) ! dssi_tilde_load_gui(x, i); #endif + for(i = 0;i < x->n_instances; i++) + dssi_tilde_init_programs(x, i); } } *************** *** 1987,2095 **** outlet_new (&x->x_obj, gensym("control"));
! if(x->plugin_outs){ ! for(i = 0;i < x->plugin_outs; i++) ! outlet_new(&x->x_obj, &s_signal); ! x->outlets = ! (t_float **)calloc(x->plugin_outs, ! sizeof(t_float *)); ! } ! if(x->plugin_ins){ ! for(i = 0;i < x->plugin_ins; i++) ! inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); ! x->inlets = ! (t_float **)calloc(x->plugin_ins, ! sizeof(t_float *)); } ! ! return (void *)x; }
! static void dssi_tilde_free(t_dssi_tilde *x){ ! ! t_int i; ! ! #if DEBUG ! post("Calling dssi_tilde_free"); ! #endif ! ! t_int instance; ! for(instance = 0; instance < x->n_instances; instance++) { ! if(x->instances[instance].uiTarget && x->is_DSSI){ ! lo_send(x->instances[instance].uiTarget, ! x->instances[instance].ui_osc_quit_path, ""); ! lo_address_free(x->instances[instance].uiTarget); ! x->instances[instance].uiTarget = NULL; ! } ! /* no -- see comment in osc_exiting_handler */ ! /* if (!instances[i].inactive) { */ ! if (x->descriptor->LADSPA_Plugin->deactivate) { ! x->descriptor->LADSPA_Plugin->deactivate ! (x->instanceHandles[instance]); ! } ! /* } */ ! if (x->descriptor->LADSPA_Plugin && ! x->descriptor->LADSPA_Plugin->cleanup) { ! x->descriptor->LADSPA_Plugin->cleanup ! (x->instanceHandles[instance]); ! } ! }
! if(x->dll_arg != NULL) ! free((char *)x->dll_arg);
! if(x->plugin_label != NULL) ! free((char *)x->plugin_label);
! if(x->dll_handle){ ! instance = x->n_instances; ! free((LADSPA_Handle)x->instanceHandles); ! free(x->plugin_ControlInPortNumbers); ! free((t_float *)x->plugin_InputBuffers); ! free(x->instanceEventCounts); ! free(x->plugin_ControlDataInput); ! free(x->plugin_ControlDataOutput);
! while(instance--){
- if(x->instances[instance].gui_pid){ #if DEBUG ! post("Freeing GUI process PID = %d", x->instances[instance].gui_pid); #endif - kill(x->instances[instance].gui_pid, SIGKILL); - } - if (x->instances[instance].pluginPrograms) { - for (i = 0; i < - x->instances[instance].plugin_ProgramCount; i++) - free((void *) - x->instances[instance].pluginPrograms[i].Name); - free((char *)x->instances[instance].pluginPrograms); - x->instances[instance].pluginPrograms = NULL; - x->instances[instance].plugin_ProgramCount = 0; - } - if(x->plugin_outs) - free(x->plugin_OutputBuffers[instance]); - free(x->instanceEventBuffers[instance]); - free(x->instances[instance].ui_osc_control_path); - free(x->instances[instance].ui_osc_configure_path); - free(x->instances[instance].ui_osc_program_path); - free(x->instances[instance].ui_osc_show_path); - free(x->instances[instance].ui_osc_hide_path); - free(x->instances[instance].ui_osc_quit_path); - free(x->instances[instance].osc_url_path); - free(x->instances[instance].plugin_PortControlInNumbers); - } - free((t_float *)x->plugin_OutputBuffers); - free((snd_seq_event_t *)x->instanceEventBuffers); - free(x->instances); - free(x->project_dir); - free((t_float *)x->outlets); - free(x->osc_url_base); - free(x->dll_name); - free(x->port_info); - dssi_tilde_configure_buffer_free(x); - /* free(x->configure_buffer_head);*/ - /* free(x->dll_path);*/ - }
}
--- 2120,2183 ---- outlet_new (&x->x_obj, gensym("control"));
! if (x->dll_handle != NULL){ ! if(x->plugin_outs){ ! x->outlets = (t_outlet **)getbytes(x->plugin_outs * sizeof(t_outlet *)); ! for(i = 0;i < x->plugin_outs; i++) ! x->outlets[i] = outlet_new(&x->x_obj, &s_signal); ! /* x->outlets = ! (t_float **)calloc(x->plugin_outs, ! sizeof(t_float *)); ! */} ! if(x->plugin_ins){ ! x->inlets = (t_inlet **)getbytes(x->plugin_ins * sizeof(t_inlet *)); ! for(i = 0;i < x->plugin_ins; i++) ! x->inlets[i] = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); ! /* x->inlets = ! (t_float **)calloc(x->plugin_ins, ! sizeof(t_float *)); ! */} ! ! post("dssi~: ready for input"); ! x->dsp = 1; } ! return (void *)x; }
! static void dssi_tilde_plug_plugin(t_dssi_tilde *x, t_symbol *s, int argc, t_atom *argv){ ! ! x->dsp = 0; ! dssi_tilde_quit_plugin(x); ! dssi_tilde_free_plugin(x); ! dssi_tilde_init_plugin(x); ! dssi_tilde_load_plugin(x, argc, argv); ! ! }
! static void *dssi_tilde_new(t_symbol *s, t_int argc, t_atom *argv){
! t_dssi_tilde *x = (t_dssi_tilde *)pd_new(dssi_tilde_class); ! post("==============================\ndssi~ %.2f\n a DSSI/LADSPA host for Pure Data\n==============================", VERSION); ! ! dssi_tilde_init_plugin(x);
! x->sr = (t_int)sys_getsr(); ! x->sr_inv = 1 / (t_float)x->sr; ! x->time_ref = (t_int)clock_getlogicaltime; ! x->blksize = sys_getblksize(); ! ! pthread_mutex_init(&x->midiEventBufferMutex, NULL); ! return dssi_tilde_load_plugin(x, argc, argv); ! ! }
! static void dssi_tilde_free(t_dssi_tilde *x){
#if DEBUG ! post("Calling dssi_tilde_free"); #endif
+ dssi_tilde_quit_plugin(x); + dssi_tilde_free_plugin(x); + }
*************** *** 2112,2117 **** class_addmethod (dssi_tilde_class,(t_method)dssi_tilde_reset, gensym ("reset"), A_DEFFLOAT, 0); ! /* class_addmethod (dssi_tilde_class,(t_method)dssi_tilde_plug, ! gensym ("plug"),A_DEFSYM,0); class_addmethod (dssi_tilde_class,(t_method)dssi_tilde_active, gensym ("active"),A_DEFFLOAT,0);*/ --- 2200,2205 ---- class_addmethod (dssi_tilde_class,(t_method)dssi_tilde_reset, gensym ("reset"), A_DEFFLOAT, 0); ! class_addmethod (dssi_tilde_class,(t_method)dssi_tilde_plug_plugin, ! gensym ("plug"),A_GIMME,0);/* class_addmethod (dssi_tilde_class,(t_method)dssi_tilde_active, gensym ("active"),A_DEFFLOAT,0);*/
Index: dssi~.h =================================================================== RCS file: /cvsroot/pure-data/externals/postlude/dssi/src/dssi~.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dssi~.h 11 Mar 2006 20:32:51 -0000 1.5 --- dssi~.h 17 Mar 2006 17:08:49 -0000 1.6 *************** *** 53,57 ****
#define LOADGUI 1 /* FIX: depracate this */ ! #define DEBUG 1 #ifdef DEBUG #define CHECKSUM_PATCH_FILES_ON_LOAD 1 --- 53,57 ----
#define LOADGUI 1 /* FIX: depracate this */ ! #define DEBUG 0 #ifdef DEBUG #define CHECKSUM_PATCH_FILES_ON_LOAD 1 *************** *** 119,127 **** t_object x_obj; t_int is_DSSI; ! const char *dll_arg, /*arg given by user - either path or dll name*/ ! *plugin_label; char *dll_path; /*absolute path to plugin */ void *dll_handle; ! char *dir; /* project dircetory */ LADSPA_Handle *instanceHandles; /*was handle*/ t_dssi_instance *instances; --- 119,127 ---- t_object x_obj; t_int is_DSSI; ! char *dll_arg, /*arg given by user - either path or dll name*/ ! *plugin_label; char *dll_path; /*absolute path to plugin */ void *dll_handle; ! char *project_dir; /* project dircetory */ LADSPA_Handle *instanceHandles; /*was handle*/ t_dssi_instance *instances; *************** *** 161,168 **** t_float f;
! t_float **outlets, **inlets; t_outlet *control_outlet;
t_dssi_configure_pair *configure_buffer_head;
} t_dssi_tilde; --- 161,171 ---- t_float f;
! t_outlet **outlets; ! t_inlet **inlets; t_outlet *control_outlet;
t_dssi_configure_pair *configure_buffer_head; + + t_int dsp; /* boolean dsp setting */
} t_dssi_tilde;