Re: Zynaddsubfx bank management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I wrote a patch that lets you load a bank explicitly from a directory
on the command line (such as: zynaddsubfx -B /path/to/my/bank).

The patch is for the latest version of zynaddsubfx (2.2.1) which can
be obtained here:
http://sourceforge.net/project/showfiles.php?group_id=62934&package_id=59720&release_id=323680

See the attachment for the patch. :)

Ah, I almost forgot: In order to see the instruments loaded from the
bank you must click on a widget in the bank window to force it to
refresh.

Cheers,
 -Lou


On 11/29/07, Folderol <folderol@xxxxxxxxx> wrote:
> On Thu, 29 Nov 2007 11:13:56 +0100
> Ismael Valladolid Torres <ivalladt@xxxxxxx> wrote:
>
> > I don't know how to switch to a personal bank
> > directory. File->Settings->Bank root dirs->Make default is not working
> > here. Is the only way to work with my own banks to make...
> >
> > /usr/share/zynaddsubfx/banks
> >
> > Writable by the user running zynaddsubfx?
> >
> > Any ideas welcome.
> >
> > Cordially, Ismael
>
> Sounds like a permissions issue to me.
>
> Where have you put your user banks?
>
> Mine is at{yourhome}/Music/Zyn/ and I have no problems
>
> Check the file {yourhome}.zynaddsubfxXML.cfg
>
> Has it been corrupted? Have you accidentally made it non-writable.
>
> --
> Will J Godfrey
> http://www.musically.me.uk
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
> http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
>
diff -Naur ZynAddSubFX-2.2.1/src/main.C ZynAddSubFX-2.2.1-bankpatch/src/main.C
--- ZynAddSubFX-2.2.1/src/main.C	2005-04-27 20:15:28.000000000 -0400
+++ ZynAddSubFX-2.2.1-bankpatch/src/main.C	2007-11-29 22:51:55.000000000 -0500
@@ -369,6 +369,7 @@
     struct option opts[]={
 	{"load",2,NULL,'l'},
 	{"load-instrument",2,NULL,'L'},
+	{"load-bank",2,NULL,'B'},
 	{"sample-rate",2,NULL,'r'},
 	{"buffer-size",2,NULL,'b'},
 	{"oscil-size",2,NULL,'o'},
@@ -386,13 +387,14 @@
     
     char loadfile[1001];ZERO(loadfile,1001);
     char loadinstrument[1001];ZERO(loadinstrument,1001);
+    char loadbank[1001];ZERO(loadbank,1001);
     
     while (1){
 #ifdef OS_LINUX
-	opt=getopt_long(argc,argv,"l:L:r:b:o:hSDUAY",opts,&option_index);
+	opt=getopt_long(argc,argv,"l:L:B:r:b:o:hSDUAY",opts,&option_index);
 	char *optarguments=optarg;
 #else
-	opt=getopt(argc,argv,"l:L:r:b:o:hSDUAY",&option_index);
+	opt=getopt(argc,argv,"l:L:B:r:b:o:hSDUAY",&option_index);
 	char *optarguments=&winoptarguments[0];
 #endif 
 
@@ -428,6 +430,11 @@
 		        snprintf(loadinstrument,1000,"%s",optarguments);
 		     };
 		     break;
+	    case 'B':tmp=0;
+	             if (optarguments!=NULL) {
+		        snprintf(loadbank,1000,"%s",optarguments);
+		     };
+		     break;
 	    case 'r':tmp=0;
 	             if (optarguments!=NULL) tmp=atoi(optarguments);
 		     if (tmp>=4000) {
@@ -468,6 +475,7 @@
 	fprintf(stderr,"%s","  -h , --help \t\t\t\t display command-line help and exit\n");
 	fprintf(stderr,"%s","  -l file, --load=FILE\t\t\t loads a .xmz file\n");
 	fprintf(stderr,"%s","  -L file, --load-instrument=FILE\t\t loads a .xiz file\n");
+	fprintf(stderr,"%s","  -B directory, --load-bank=DIR\t\t loads a bank from a directory\n");
 	fprintf(stderr,"%s","  -r SR, --sample-rate=SR\t\t set the sample rate SR\n");
 	fprintf(stderr,"%s","  -b BS, --buffer-size=SR\t\t set the buffer size (granularity)\n");
 	fprintf(stderr,"%s","  -o OS, --oscil-size=OS\t\t set the ADsynth oscil. size\n");
@@ -517,8 +525,20 @@
 	    printf("Instrument file loaded.\n");
 	};
     };
+ 
+    if (strlen(loadbank)>1){
+        int tmp=master->bank.loadbank(loadbank);
+	if (tmp<0) {
+	    fprintf(stderr,"ERROR:Could not load bank directory  %s .\n",loadbank);
+	    exit(1);
+	} else {
+#ifndef DISABLE_GUI
+	    if (noui==0) ui->refresh_master_ui();
+#endif
+	    printf("Bank directory loaded.\n");
+	};
+    };
     
-
 #if !(defined(NONEMIDIIN)||defined(WINMIDIIN)||defined(VSTMIDIIN))
     pthread_create(&thr1,NULL,thread1,NULL);
 #endif
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux