[PD-cvs] externals/postlude/dssi/src dssi~.c, 1.10, 1.11 dssi~.h, 1.6, 1.7

Jamie Bullock postlude at users.sourceforge.net
Thu Mar 23 09:48:08 CET 2006


Update of /cvsroot/pure-data/externals/postlude/dssi/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21163/src

Modified Files:
	dssi~.c dssi~.h 
Log Message:
Fixed plug_plugin.


Index: dssi~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/postlude/dssi/src/dssi~.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dssi~.c	20 Mar 2006 14:54:19 -0000	1.10
--- dssi~.c	23 Mar 2006 08:48:06 -0000	1.11
***************
*** 353,357 ****
  static void osc_error(int num, const char *msg, const char *where)
  {
!     post("osc error %d in path %s: %s\n",num, where, msg);
  }
  
--- 353,357 ----
  static void osc_error(int num, const char *msg, const char *where)
  {
!     post("dssi~: osc error %d in path %s: %s\n",num, where, msg);
  }
  
***************
*** 511,515 ****
  
      if (ctrl_input_index >= x->plugin_controlIns) {
! 	post("plugin~: control port number %d is out of range [1, %d]",
  		ctrl_input_index + 1, x->plugin_controlIns);
  	return;
--- 511,515 ----
  
      if (ctrl_input_index >= x->plugin_controlIns) {
! 	post("dssi~: control port number %d is out of range [1, %d]",
  		ctrl_input_index + 1, x->plugin_controlIns);
  	return;
***************
*** 522,528 ****
      port = x->plugin_ControlInPortNumbers[ctrl_input_index];
  
-     portno = 
- 	x->instances[instance].plugin_PortControlInNumbers[ctrl_input_index + 1];
  
  #if DEBUG
      post("Global ctrl input number = %d", ctrl_input_index);
--- 522,533 ----
      port = x->plugin_ControlInPortNumbers[ctrl_input_index];
  
  
+     /* FIX - temporary hack */
+     if(x->is_DSSI)
+ 	portno = 
+ 	    x->instances[instance].plugin_PortControlInNumbers[ctrl_input_index + 1];
+     else
+ 	portno = 
+ 	    x->instances[instance].plugin_PortControlInNumbers[ctrl_input_index];
  #if DEBUG
      post("Global ctrl input number = %d", ctrl_input_index);
***************
*** 602,606 ****
  
      if (instance > x->n_instances || instance < 0){
! 	post("dssi~: control: Invalid instance number");
  	return;
      }
--- 607,611 ----
  
      if (instance > x->n_instances || instance < 0){
! 	post("dssi~: control: invalid instance number");
  	return;
      }
***************
*** 787,795 ****
  #if DEBUG
  	    post("Updating GUI program");
! #endif 
! 	    lo_send(x->instances[instance].uiTarget, 
! 		    x->instances[instance].ui_osc_program_path, "ii", 
! 		    x->instances[instance].currentBank, 
! 		    x->instances[instance].currentProgram);
  	}
  	x->instances[instance].uiNeedsProgramUpdate = 0;
--- 792,803 ----
  #if DEBUG
  	    post("Updating GUI program");
! #endif
! 	    /* FIX - this is a hack to make text ui work*/
! 	    if(x->instances[instance].uiTarget)
! 		lo_send(x->instances[instance].uiTarget, 
! 			x->instances[instance].ui_osc_program_path, "ii", 
! 			x->instances[instance].currentBank, 
! 			x->instances[instance].currentProgram);
! 	    
  	}
  	x->instances[instance].uiNeedsProgramUpdate = 0;
***************
*** 817,821 ****
  	if (x->instances[instance].pluginPrograms[i].Bank == bank &&
  		x->instances[instance].pluginPrograms[i].Program == program) {
! 	    post("OSC: setting bank %u, program %u, name %s\n",
  		    bank, program, x->instances[instance].pluginPrograms[i].Name);
  
--- 825,829 ----
  	if (x->instances[instance].pluginPrograms[i].Bank == bank &&
  		x->instances[instance].pluginPrograms[i].Program == program) {
! 	    post("dssi~: OSC: setting bank %u, program %u, name %s\n",
  		    bank, program, x->instances[instance].pluginPrograms[i].Name);
  
***************
*** 1127,1131 ****
  
      if(!(dp = opendir(gui_base))){
! 	post("can't open %s, unable to find GUI", gui_base);
  	return;
      }
--- 1135,1139 ----
  
      if(!(dp = opendir(gui_base))){
! 	post("dssi~: can't open %s, unable to find GUI", gui_base);
  	return;
      }
***************
*** 1135,1139 ****
  	    if (strchr(dir_entry->d_name, '_')){
  		if (strstr(dir_entry->d_name, "gtk") ||
! 			strstr(dir_entry->d_name, "qt"))
  		    break;
  	    }
--- 1143,1148 ----
  	    if (strchr(dir_entry->d_name, '_')){
  		if (strstr(dir_entry->d_name, "gtk") ||
! 			strstr(dir_entry->d_name, "qt") || 
! 			strstr(dir_entry->d_name, "text"))
  		    break;
  	    }
***************
*** 1161,1165 ****
      sprintf(osc_url, "%s/%s", x->osc_url_base, 
  	    x->instances[instance].osc_url_path);
!     post("Instance %d OSC URL is: %s",instance, osc_url);
  #if DEBUG
      post("Trying to open GUI!");
--- 1170,1174 ----
      sprintf(osc_url, "%s/%s", x->osc_url_base, 
  	    x->instances[instance].osc_url_path);
!     post("dssi~: instance %d URL: %s",instance, osc_url);
  #if DEBUG
      post("Trying to open GUI!");
***************
*** 1192,1196 ****
  
      if(chan > x->n_instances - 1 || chan < 0){
! 	post("Note discarded: MIDI data is destined for a channel that doesn't exist");
  	return;
      }
--- 1201,1205 ----
  
      if(chan > x->n_instances - 1 || chan < 0){
! 	post("dssi~: note discarded: MIDI data is destined for a channel that doesn't exist");
  	return;
      }
***************
*** 1516,1520 ****
  	if(!strcmp(msg_type, "load") && x->descriptor->configure){
  	    filename = argv[1].a_w.w_symbol->s_name;
! 	    post("loading patch: %s for instance %d", filename, instance);
  
  	    if(!strcmp(x->descriptor->LADSPA_Plugin->Label, "hexter") || 
--- 1525,1529 ----
  	if(!strcmp(msg_type, "load") && x->descriptor->configure){
  	    filename = argv[1].a_w.w_symbol->s_name;
! 	    post("dssi~: loading patch: %s for instance %d", filename, instance);
  
  	    if(!strcmp(x->descriptor->LADSPA_Plugin->Label, "hexter") || 
***************
*** 1528,1532 ****
  		/*From dx7_voice_data by Sean Bolton */
  		if(fp == NULL){
! 		    post("Unable to open patch file: %s", filename);
  		    return 0;
  		}
--- 1537,1541 ----
  		/*From dx7_voice_data by Sean Bolton */
  		if(fp == NULL){
! 		    post("dssi~: unable to open patch file: %s", filename);
  		    return 0;
  		}
***************
*** 1534,1538 ****
  			(filelength = ftell(fp)) == -1 ||
  			fseek(fp, 0, SEEK_SET)) {
! 		    post("couldn't get length of patch file: %s", 
  			    filename);
  		    fclose(fp);
--- 1543,1547 ----
  			(filelength = ftell(fp)) == -1 ||
  			fseek(fp, 0, SEEK_SET)) {
! 		    post("dssi~: couldn't get length of patch file: %s", 
  			    filename);
  		    fclose(fp);
***************
*** 1540,1548 ****
  		}
  		if (filelength == 0) {
! 		    post("patch file has zero length");
  		    fclose(fp);
  		    return 0;
  		} else if (filelength > 16384) {
! 		    post("patch file is too large");
  		    fclose(fp);
  		    return 0;
--- 1549,1557 ----
  		}
  		if (filelength == 0) {
! 		    post("dssi~: patch file has zero length");
  		    fclose(fp);
  		    return 0;
  		} else if (filelength > 16384) {
! 		    post("dssi~: patch file is too large");
  		    fclose(fp);
  		    return 0;
***************
*** 1551,1555 ****
  			    malloc(filelength))) 		     			 {
  		    post(
! 			    "couldn't allocate memory for raw patch file");
  		    fclose(fp);
  		    return 0;
--- 1560,1564 ----
  			    malloc(filelength))) 		     			 {
  		    post(
! 			    "dssi~: couldn't allocate memory for raw patch file");
  		    fclose(fp);
  		    return 0;
***************
*** 1557,1561 ****
  		if (fread(raw_patch_data, 1, filelength, fp) 
  			!= (size_t)filelength) {
! 		    post("short read on patch file: %s", filename);
  		    free(raw_patch_data);
  		    fclose(fp);
--- 1566,1570 ----
  		if (fread(raw_patch_data, 1, filelength, fp) 
  			!= (size_t)filelength) {
! 		    post("dssi~: short read on patch file: %s", filename);
  		    free(raw_patch_data);
  		    fclose(fp);
***************
*** 1602,1606 ****
  		    if (filelength != DX7_DUMP_SIZE_BULK ||
  			    raw_patch_data[DX7_DUMP_SIZE_BULK - 1] != 0xf7) {
! 			post("badly formatted DX7 32 voice dump!");
  			count = 0;
  
--- 1611,1615 ----
  		    if (filelength != DX7_DUMP_SIZE_BULK ||
  			    raw_patch_data[DX7_DUMP_SIZE_BULK - 1] != 0xf7) {
! 			post("dssi~: badly formatted DX7 32 voice dump!");
  			count = 0;
  
***************
*** 1610,1614 ****
  			    raw_patch_data[DX7_DUMP_SIZE_BULK - 2]) {
  
! 			post("DX7 32 voice dump with bad checksum!");
  			count = 0;
  
--- 1619,1623 ----
  			    raw_patch_data[DX7_DUMP_SIZE_BULK - 2]) {
  
! 			post("dssi~: DX7 32 voice dump with bad checksum!");
  			count = 0;
  
***************
*** 1625,1629 ****
  
  		    /* unsuccessful load */
! 		    post("unknown patch bank file format!");
  		    count = 0;
  
--- 1634,1638 ----
  
  		    /* unsuccessful load */
! 		    post("dssi~: unknown patch bank file format!");
  		    count = 0;
  
***************
*** 1644,1648 ****
  	    }
  	    else{
! 		post("Sorry, %s patches are not supported", 
  			x->descriptor->LADSPA_Plugin->Label);
  	    }
--- 1653,1657 ----
  	    }
  	    else{
! 		post("dssi~: %s patches are not supported", 
  			x->descriptor->LADSPA_Plugin->Label);
  	    }
***************
*** 1654,1658 ****
  	    x->project_dir = malloc((pathlen) * sizeof(char));
  	    atom_string(&argv[1], x->project_dir, pathlen);
! 	    post("Project directory for instance %d has been set to: %s", instance, x->project_dir);
  	    key = DSSI_PROJECT_DIRECTORY_KEY;
  	    value = x->project_dir;
--- 1663,1667 ----
  	    x->project_dir = malloc((pathlen) * sizeof(char));
  	    atom_string(&argv[1], x->project_dir, pathlen);
! 	    post("dssi~: project directory for instance %d has been set to: %s", instance, x->project_dir);
  	    key = DSSI_PROJECT_DIRECTORY_KEY;
  	    value = x->project_dir;
***************
*** 1660,1664 ****
  
  	else if(!strcmp(msg_type, "dir"))
! 	    post("%s %s: operation not supported", msg_type, 
  		    argv[1].a_w.w_symbol->s_name);
  
--- 1669,1673 ----
  
  	else if(!strcmp(msg_type, "dir"))
! 	    post("dssi~: %s %s: operation not supported", msg_type, 
  		    argv[1].a_w.w_symbol->s_name);
  
***************
*** 1735,1742 ****
  }
  
! static void dssi_bang(t_dssi_tilde *x)
  {
!     post("dssi~: running %d instances of %s", x->n_instances,
! 	    x->descriptor->LADSPA_Plugin->Label);
  }
  
--- 1744,1765 ----
  }
  
! static void dssi_tilde_bang(t_dssi_tilde *x)
  {
!     t_atom at[3];
! 
!     at[0].a_type = A_FLOAT;
!     at[1].a_type = A_SYMBOL;
!     at[2].a_type = A_SYMBOL;
!     
!     if(x->plugin_label != NULL){
! 	at[0].a_w.w_float = x->n_instances;
! 	at[1].a_w.w_symbol = gensym ((char *)x->plugin_label); 
!     }
!     else{
! 	at[0].a_w.w_float = 0;
! 	at[1].a_w.w_symbol = gensym ("plugin"); 
!     }	
!     at[2].a_w.w_symbol = gensym ("instances"); 
!     outlet_anything (x->control_outlet, gensym ("running"), 3, at);
  }
  
***************
*** 1748,1754 ****
      t_float **outputs = (t_float **)(&w[3] + x->plugin_ins);
      int i, n, timediff, framediff, instance = 0; 
! /*See comment for dssi_tilde_plug_plugin 
      if(x->dsp){
! 	x->dsp_loop = 1;*/
  
  	for(i = 0; i < x->plugin_ins; i++)
--- 1771,1777 ----
      t_float **outputs = (t_float **)(&w[3] + x->plugin_ins);
      int i, n, timediff, framediff, instance = 0; 
! /*See comment for dssi_tilde_plug_plugin */
      if(x->dsp){
! 	x->dsp_loop = 1;
  
  	for(i = 0; i < x->plugin_ins; i++)
***************
*** 1766,1770 ****
  	    if(instance > x->n_instances || instance < 0){
  		post(
! 			"%s: discarding spurious MIDI data, for instance %d", 
  			x->descriptor->LADSPA_Plugin->Label, 
  			instance);
--- 1789,1793 ----
  	    if(instance > x->n_instances || instance < 0){
  		post(
! 			"dssi~: %s: discarding spurious MIDI data, for instance %d", 
  			x->descriptor->LADSPA_Plugin->Label, 
  			instance);
***************
*** 1776,1780 ****
  
  	    if (x->instanceEventCounts[instance] == EVENT_BUFSIZE){
! 		post("MIDI overflow on channel %d", instance);
  		continue;
  	    }
--- 1799,1803 ----
  
  	    if (x->instanceEventCounts[instance] == EVENT_BUFSIZE){
! 		post("dssi~: MIDI overflow on channel %d", instance);
  		continue;
  	    }
***************
*** 1842,1847 ****
  	    memcpy(x->outlets[i], (t_outlet *)x->plugin_OutputBuffers[i], N * 
  		    sizeof(LADSPA_Data));*/
! /*	x->dsp_loop = 0;
!     }*/ 
      return w + (x->plugin_ins + x->plugin_outs + 3);
  }
--- 1865,1870 ----
  	    memcpy(x->outlets[i], (t_outlet *)x->plugin_OutputBuffers[i], N * 
  		    sizeof(LADSPA_Data));*/
! 	x->dsp_loop = 0;
!     } 
      return w + (x->plugin_ins + x->plugin_outs + 3);
  }
***************
*** 2090,2094 ****
  	    }
  	    else{
! 		post("Invalid library name; must end in .so");
  		return (void *) x;
  	    }
--- 2113,2117 ----
  	    }
  	    else{
! 		post("dssi~: invalid library name; must end in .so");
  		return (void *) x;
  	    }
***************
*** 2137,2141 ****
  			instantiate(x->descriptor->LADSPA_Plugin, x->sr);
  		    if (!x->instanceHandles[i]){
! 			post("instantiation of instance %d failed", i);
  			stop = 1;
  			break;
--- 2160,2164 ----
  			instantiate(x->descriptor->LADSPA_Plugin, x->sr);
  		    if (!x->instanceHandles[i]){
! 			post("dssi~: instantiation of instance %d failed", i);
  			stop = 1;
  			break;
***************
*** 2149,2153 ****
  		    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);
--- 2172,2176 ----
  		    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);
***************
*** 2158,2169 ****
  			for(i = 0;i < x->n_instances; i++)
  			    dssi_tilde_init_programs(x, i);
  		}
  	    }
  	}
  	else
! 	    post("Error: plugin not loaded");
      }
      else
! 	post("No arguments given, please supply a path");
  
      x->control_outlet =
--- 2181,2193 ----
  			for(i = 0;i < x->n_instances; i++)
  			    dssi_tilde_init_programs(x, i);
+ 		    }
  		}
  	    }
  	}
  	else
! 	    post("dssi~: error: plugin not loaded");
      }
      else
! 	post("dssi~: no arguments given, please supply a path");
  
      x->control_outlet =
***************
*** 2187,2192 ****
  			sizeof(t_float *));
  			*/}
! 
! 		post("dssi~: ready for input");
      }
      return (void *)x;    
--- 2211,2217 ----
  			sizeof(t_float *));
  			*/}
! 		x->dsp = 1;
! 		post("dssi~: %d instances of %s, ready.", x->n_instances, 
! 			x->plugin_label);
      }
      return (void *)x;    
***************
*** 2194,2198 ****
  
  
! /* This method is currently disabled. PD's inlet/outlet handling seems buggy if you try to create ins/outs on the fly. Needs further investigation ...*/
  static void dssi_tilde_plug_plugin(t_dssi_tilde *x, t_symbol *s, int argc, t_atom *argv){
      
--- 2219,2223 ----
  
  
! /* This method is currently buggy. PD's inlet/outlet handling seems buggy if you try to create ins/outs on the fly. Needs further investigation ...*/
  static void dssi_tilde_plug_plugin(t_dssi_tilde *x, t_symbol *s, int argc, t_atom *argv){
      
***************
*** 2207,2211 ****
      dssi_tilde_init_plugin(x);
      dssi_tilde_load_plugin(x, argc, argv);
-     
  }
  
--- 2232,2235 ----
***************
*** 2219,2223 ****
      
      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);
--- 2243,2247 ----
      
      t_dssi_tilde *x = (t_dssi_tilde *)pd_new(dssi_tilde_class);
!     post("\n========================================\ndssi~: DSSI/LADSPA host - version %.2f\n========================================\n", VERSION);
        
      dssi_tilde_init_plugin(x);
***************
*** 2227,2230 ****
--- 2251,2255 ----
      x->time_ref = (t_int)clock_getlogicaltime;
      x->blksize = sys_getblksize();
+     x->dsp = 0;
   
      pthread_mutex_init(&x->midiEventBufferMutex, NULL);
***************
*** 2249,2253 ****
  	    (t_method)dssi_tilde_free, sizeof(t_dssi_tilde), 0, A_GIMME, 0);
      class_addlist(dssi_tilde_class, dssi_tilde_list);
!     class_addbang(dssi_tilde_class, dssi_bang);
      class_addmethod(dssi_tilde_class, 
  	    (t_method)dssi_tilde_dsp, gensym("dsp"), 0);
--- 2274,2278 ----
  	    (t_method)dssi_tilde_free, sizeof(t_dssi_tilde), 0, A_GIMME, 0);
      class_addlist(dssi_tilde_class, dssi_tilde_list);
!     class_addbang(dssi_tilde_class, dssi_tilde_bang);
      class_addmethod(dssi_tilde_class, 
  	    (t_method)dssi_tilde_dsp, gensym("dsp"), 0);
***************
*** 2262,2269 ****
      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_activate_plugin,
! 	    gensym ("active"),A_DEFFLOAT,0);*/
      class_sethelpsymbol(dssi_tilde_class, gensym("help-dssi"));
      CLASS_MAINSIGNALIN(dssi_tilde_class, t_dssi_tilde, f);
--- 2287,2294 ----
      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_activate_plugin,
! 	    gensym ("active"),A_DEFFLOAT,0);
      class_sethelpsymbol(dssi_tilde_class, gensym("help-dssi"));
      CLASS_MAINSIGNALIN(dssi_tilde_class, t_dssi_tilde, f);

Index: dssi~.h
===================================================================
RCS file: /cvsroot/pure-data/externals/postlude/dssi/src/dssi~.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** dssi~.h	17 Mar 2006 17:08:49 -0000	1.6
--- dssi~.h	23 Mar 2006 08:48:06 -0000	1.7
***************
*** 42,46 ****
  
  
! #define VERSION 0.89
  #define EVENT_BUFSIZE 1024
  #define OSC_BASE_MAX 1024
--- 42,46 ----
  
  
! #define VERSION 0.91
  #define EVENT_BUFSIZE 1024
  #define OSC_BASE_MAX 1024
***************
*** 168,171 ****
--- 168,172 ----
  
    t_int dsp; /* boolean dsp setting */
+   t_int dsp_loop;
    
  } t_dssi_tilde;





More information about the Pd-cvs mailing list