[PD-cvs] externals/postlude/dssi/src dssi~.c, 1.5, 1.6 dssi~.h, 1.3, 1.4

Jamie Bullock postlude at users.sourceforge.net
Wed Feb 22 13:34:14 CET 2006


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

Modified Files:
	dssi~.c dssi~.h 
Log Message:
Added fluidsynth-dssi fix and patch loading without GUI


Index: dssi~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/postlude/dssi/src/dssi~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** dssi~.c	16 Feb 2006 11:22:12 -0000	1.5
--- dssi~.c	22 Feb 2006 12:34:12 -0000	1.6
***************
*** 150,154 ****
   * encode a block of 7-bit data, in base64-ish style
   */
! char *
  encode_7in6(uint8_t *data, int length)
  {
--- 150,154 ----
   * encode a block of 7-bit data, in base64-ish style
   */
! static char *
  encode_7in6(uint8_t *data, int length)
  {
***************
*** 196,200 ****
  ** Taken from dx7_voice_data.c by Sean Bolton **
   */
! int
  dx7_bulk_dump_checksum(uint8_t *data, int length)
  {
--- 196,200 ----
  ** Taken from dx7_voice_data.c by Sean Bolton **
   */
! static int
  dx7_bulk_dump_checksum(uint8_t *data, int length)
  {
***************
*** 209,213 ****
  static void dssi_load(char *dll_path, void **dll_handle){
  	
! 	*dll_handle = dlopen(dll_path, RTLD_NOW);
  	if (*dll_handle){
  		post("%s loaded successfully", dll_path);
--- 209,213 ----
  static void dssi_load(char *dll_path, void **dll_handle){
  	
! 	*dll_handle = dlopen(dll_path, RTLD_NOW | RTLD_LOCAL);
  	if (*dll_handle){
  		post("%s loaded successfully", dll_path);
***************
*** 215,219 ****
  	else
  		post("Failed: %s", dlerror());
! 	
  }
  	
--- 215,220 ----
  	else
  		post("Failed: %s", dlerror());
! 
!         
  }
  	
***************
*** 311,314 ****
--- 312,316 ----
  	x->instances[instance].uiNeedsProgramUpdate = 0;
  	x->instances[instance].pendingProgramChange = -1;
+ 	x->instances[instance].plugin_ProgramCount = 0;
  	x->instances[instance].pendingBankMSB = -1;
  	x->instances[instance].pendingBankLSB = -1;
***************
*** 417,421 ****
  	    /*FIX ?? */
  		for (i = 0; x->descriptor->
! 					   get_program(x->instanceHandles[instance], i); ++i);
  
  		if (i > 0) {
--- 419,423 ----
  	    /*FIX ?? */
  		for (i = 0; x->descriptor->
! 			get_program(x->instanceHandles[instance], i); ++i);
  
  		if (i > 0) {
***************
*** 442,446 ****
  			}
  		}
! 	}
  }
  
--- 444,451 ----
  			}
  		}
! 		/* No - it should be 0 anyway - dssi_init */
! 	/*	else
! 			x->instances[instance].plugin_ProgramCount = 0;
! */	}
  }
  
***************
*** 1241,1292 ****
  	if(!strcmp(msg_type, "load") && x->descriptor->configure){
  		filename = argv[1].a_w.w_symbol->s_name;
- 		key = malloc(10 * sizeof(char)); /* holds "patchesN" */
- 		strcpy(key, "patches0");
  		post("loading patch: %s for instance %d", filename, instance);
- 		fp = fopen(filename, "rb");
  		
! 	/*From dx7_voice_data by Sean Bolton */
! 		if(fp == NULL){
! 			post("Unable to open patch file: %s", filename);
! 			return 0;
! 		}
! 		if (fseek(fp, 0, SEEK_END) || 
! 			(filelength = ftell(fp)) == -1 ||
! 			fseek(fp, 0, SEEK_SET)) {
! 				post("couldn't get length of patch file: %s", 
! 					filename);
! 			fclose(fp);
! 			return 0;
!     		}
! 		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;
! 		}
! 		if (!(raw_patch_data = (unsigned char *)malloc(filelength))) 		     {
! 			post("couldn't allocate memory for raw patch file");
! 			fclose(fp);
! 			return 0;
! 		}
! 		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);
- 			return 0;
- 	    	}
- 		fclose(fp);
  #if DEBUG
! 		post("Patch file length is %ul", filelength);
  #endif
- 	/* At the moment we only support Hexter patches */
- 		if(strcmp(x->descriptor->LADSPA_Plugin->Label, "hexter") && 
- 				strcmp(x->descriptor->LADSPA_Plugin->Label, "hexter6"))
- 			post("Sorry dssi~ only supports	dx7 patches at the moment.");
- 		else{
  		 /* figure out what kind of file it is */
  		    filename_length = strlen(filename);
--- 1246,1299 ----
  	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") || 
! 			!strcmp(x->descriptor->LADSPA_Plugin->Label, "hexter6")){
! 			
! 			key = malloc(10 * sizeof(char)); /* holds "patchesN" */
! 			strcpy(key, "patches0");
! 
! 			fp = fopen(filename, "rb");
! 			
! 		/*From dx7_voice_data by Sean Bolton */
! 			if(fp == NULL){
! 				post("Unable to open patch file: %s", filename);
! 				return 0;
! 			}
! 			if (fseek(fp, 0, SEEK_END) || 
! 				(filelength = ftell(fp)) == -1 ||
! 				fseek(fp, 0, SEEK_SET)) {
! 				   post("couldn't get length of patch file: %s", 
! 						filename);
! 				fclose(fp);
! 				return 0;
! 			}
! 			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;
! 			}
! 			if (!(raw_patch_data = (unsigned char *)
! 						malloc(filelength))) 		     			 {
! 				post(
! 				  "couldn't allocate memory for raw patch file");
! 				fclose(fp);
! 				return 0;
! 			}
! 			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);
! 				return 0;
! 			}
  			fclose(fp);
  #if DEBUG
! 			post("Patch file length is %ul", filelength);
  #endif
  		 /* figure out what kind of file it is */
  		    filename_length = strlen(filename);
***************
*** 1356,1361 ****
  /*		    return count;*/
  		    
! 		if(count == 32)
!  		    value = encode_7in6((uint8_t *)&patchbuf[0].data[0], 
  					count * DX7_VOICE_SIZE_PACKED);
  	/*	    post("value = %s", value);	*/
--- 1363,1368 ----
  /*		    return count;*/
  		    
! 		   if(count == 32)
!  		       value = encode_7in6((uint8_t *)&patchbuf[0].data[0], 
  					count * DX7_VOICE_SIZE_PACKED);
  	/*	    post("value = %s", value);	*/
***************
*** 1366,1370 ****
  				
  	     }
!         }	
  	/*FIX: tidy up */
  	if(!strcmp(msg_type, "dir") && x->descriptor->configure){
--- 1373,1389 ----
  				
  	     }
! 	     else if(!strcmp(x->descriptor->LADSPA_Plugin->Label, 
! 				     "FluidSynth-DSSI")){
! 		     key = malloc(6 * sizeof(char));
! 		     strcpy(key, "load");
! 		     value = filename;
! 	     }
! 	     else{
! 		     post("Sorry, %s patches are not supported", 
! 				     x->descriptor->LADSPA_Plugin->Label);
! 	     }
! 		
!         }
! 	
  	/*FIX: tidy up */
  	if(!strcmp(msg_type, "dir") && x->descriptor->configure){
***************
*** 1611,1615 ****
  static void *dssi_tilde_new(t_symbol *s, t_int argc, t_atom *argv){
  
! 	int i, stop = 0;
  	t_dssi_tilde *x = (t_dssi_tilde *)pd_new(dssi_tilde_class);
  	post("dssi~ %.2f\n a DSSI host for Pure Data\n by Jamie Bullock\nIncluding Code from jack-dssi-host\n by Chris Cannam, Steve Harris and Sean Bolton", VERSION);
--- 1630,1637 ----
  static void *dssi_tilde_new(t_symbol *s, t_int argc, t_atom *argv){
  
! 	int i,
! 	    stop;
! 
! 	stop = 0;
  	t_dssi_tilde *x = (t_dssi_tilde *)pd_new(dssi_tilde_class);
  	post("dssi~ %.2f\n a DSSI host for Pure Data\n by Jamie Bullock\nIncluding Code from jack-dssi-host\n by Chris Cannam, Steve Harris and Sean Bolton", VERSION);
***************
*** 1705,1708 ****
--- 1727,1731 ----
  
  	t_int i;
+ /*	char *dlinfo;*/
  	
  #if DEBUG
***************
*** 1743,1746 ****
--- 1766,1774 ----
  
  		  while(instance--){
+ 	/*		dlclose(x->dll_handle);
+ #if DEBUG
+ 	dlinfo = dlerror();
+ 	post("When attempting to close the dll handle, we get: %s", dlinfo);
+ #endif*/
  			if(x->instances[instance].gui_pid){
  #if DEBUG

Index: dssi~.h
===================================================================
RCS file: /cvsroot/pure-data/externals/postlude/dssi/src/dssi~.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** dssi~.h	16 Feb 2006 10:21:39 -0000	1.3
--- dssi~.h	22 Feb 2006 12:34:12 -0000	1.4
***************
*** 42,46 ****
  
  
! #define VERSION 0.82
  #define EVENT_BUFSIZE 1024
  #define OSC_BASE_MAX 1024
--- 42,46 ----
  
  
! #define VERSION 0.83
  #define EVENT_BUFSIZE 1024
  #define OSC_BASE_MAX 1024





More information about the Pd-cvs mailing list