OSDN Git Service

Update timidity.cfg.5
authorShoichi Tamuki <tamuki@linet.gr.jp>
Wed, 18 Feb 2004 06:01:10 +0000 (06:01 +0000)
committerShoichi Tamuki <tamuki@linet.gr.jp>
Wed, 18 Feb 2004 06:01:10 +0000 (06:01 +0000)
Add lspatch.pl (list the entire instrument configuration)
Change behavior of "note=" patch option

ChangeLog
doc/C/timidity.cfg.5
doc/ja_JP.ujis/timidity.cfg.5
script/Makefile.am
script/Makefile.in
script/lspatch.pl [new file with mode: 0644]
script/readme.txt
timidity/timidity.c

index 90f6dc3..aff3bdc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,18 @@
+2004-02-18  TAMUKI Shoichi <tamuki@linet.gr.jp>
+
+       * doc/C/timidity.cfg.5, doc/ja_JP.ujis/timidity.cfg.5: Update
+       * script/Makefile.{am.in}, script/lspatch.pl, script/readme.txt:
+         Add lspatch.pl (list the entire instrument configuration)
+       * timidity/timidity.c (set_gus_patchconf_opts):
+         Change behavior of "note=" patch option
+
 2004-02-17  Takashi Iwai <tiwai@suse.de>
 
-       * interface/alsaseq_c.c,gtk_i.c,ncurs_c.c,soundspec.c,tk_c.c,
-         x_wrdwindow.c, libunimod/mloader.c, timidity/aiff_a.c,alsa_a.c,
+       * interface/{alsaseq_c.c,gtk_i.c,ncurs_c.c,soundspec.c,tk_c.c,
+         x_wrdwindow.c}, libunimod/mloader.c, timidity/{aiff_a.c,alsa_a.c,
          common.c,effect.c,freq.c,instrum.c,jack_a.c,mfi.c,mix.c,
          mod2midi.c,oss_a.c,playmidi.c,rcp.c,readmidi.c,resample.c,
-         reverb.c,smplfile.c,tables.c,timidity.c,vorbis_a.c:
+         reverb.c,smplfile.c,tables.c,timidity.c,vorbis_a.c}:
          Fix compile warnings with the recent gcc.
 
 2004-02-17  Kouji 'kekyo' Suzuki <k@kekyo.net>
index e3df6e7..c43d50e 100644 (file)
@@ -1,4 +1,4 @@
-.TH timidity.cfg 5 "February 03 2004" "2.13.0"
+.TH timidity.cfg 5 "February 18 2004" "2.13.0"
 .SH NAME
 timidity.cfg \- configure file of TiMidity++
 .SH DESCRIPTION
@@ -49,18 +49,18 @@ contained in the foo.zip are also installed.
 Reads another configuration file, then continues processing the
 current one.
 .TP
-.BI "bank " "[MapID1] number"
-Selects the tone bank to modify.  Patch mappings that follow will
-affect this tone bank.  You can indicate specific map as a target, by
-specifing any ofthe following to \fIMapID1\fP: \fBgm2\fP, \fBsc55\fP,
-\fBsc88\fP, \fBsc88pro\fP, \fBsc8850\fP, \fBxg\fP and \fBxgsfx64\fP.
-.TP
 .BI "progbase " number
 Sets and displays the tone number from \fInumber\fP to
 \fInumber\fP+128.  If \fBprogbase 1\fP are specified, tone numbers
 that follow are set and displayed as the numbers from \fB1\fP to
 \fB128\fP.
 .TP
+.BI "bank " "[MapID1] number"
+Selects the tone bank to modify.  Patch mappings that follow will
+affect this tone bank.  You can indicate specific map as a target, by
+specifing any ofthe following to \fIMapID1\fP: \fBgm2\fP, \fBsc55\fP,
+\fBsc88\fP, \fBsc88pro\fP, \fBsc8850\fP, \fBxg\fP and \fBxgsfx64\fP.
+.TP
 .BI "drumset " "[MapID2] number"
 Selects the drum set to modify.  Patch mappings that follow will
 affect this drum set.  You can indicate specific map as a target, by
@@ -130,6 +130,22 @@ arguments after the second can specify different value respectively.
 Set the instrument's ADSR offset.  Each value may be an integer
 between \fB0\fP and \fB255\fP.  The format is same as \fBrate=\fP.
 .TP
+.B keep={loop|env}
+By default, percussion instruments have their loop and envelope
+information stripped.  Strangely shaped envelopes are removed
+automatically from melodic instruments as well.  \fBkeep=\fP can be
+used to prevent stripping loop or envelope data.  For example, the
+Short and Long Whistle percussion instruments (General Midi numbers 71
+and 72) need to have `\fBkeep=loop keep=env\fP' specified in the
+configuration file.
+.TP
+.B strip={loop|env|tail}
+Force removal of loop or envelope information from all patches in the
+instrument, or strip the tail, i.e. all data after the loop.  Some
+third\-party instruments have garbage after the loop, as evidenced by
+a clicking noise whenever the instrument is played, so adding the
+\fBstrip=tail\fP option will markedly improve sound quality.
+.TP
 .BI tremolo= sweep_increment:control_ratio:depth[,...]
 Set the instrument's tremolo.  Each value may be an integer
 between \fB0\fP and \fB255\fP.  The format is similar to \fBrate=\fP.
@@ -156,6 +172,9 @@ Set the instrument's scale tuning factor in cents.  For example,
 two or more sample data is contained, the arguments after the second
 can specify different value respectively.
 .TP
+.BI comm= comment
+Specifies the comment \fIcomment\fP.
+.TP
 .BI modrate= attack:decay:sustain:release1:release2:release3[,...]
 .br
 .ns
@@ -208,25 +227,6 @@ characteristic value.
 Set the instrument's resonance velocity follow.  Based on
 \fBvelocity=0\fP, it change resonance according to velocity.  The unit
 is +\-cB.
-.TP
-.B keep={loop|env}
-By default, percussion instruments have their loop and envelope
-information stripped.  Strangely shaped envelopes are removed
-automatically from melodic instruments as well.  \fBkeep=\fP can be
-used to prevent stripping loop or envelope data.  For example, the
-Short and Long Whistle percussion instruments (General Midi numbers 71
-and 72) need to have `\fBkeep=loop keep=env\fP' specified in the
-configuration file.
-.TP
-.B strip={loop|env|tail}
-Force removal of loop or envelope information from all patches in the
-instrument, or strip the tail, i.e. all data after the loop.  Some
-third\-party instruments have garbage after the loop, as evidenced by
-a clicking noise whenever the instrument is played, so adding the
-\fBstrip=tail\fP option will markedly improve sound quality.
-.TP
-.BI comm= comment
-Specifies the comment \fIcomment\fP.
 .RE
 .TP
 .BI "default " file
@@ -432,5 +432,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111\-1307
 USA
 .SH AVAILABILITY
 The latest release is available on the \fBTiMidity++\fP Page,
-.br
+.LP
 URL http://www.timidity.jp/
index e3e7786..4a65e04 100644 (file)
@@ -1,4 +1,4 @@
-.TH timidity.cfg 5 "2004ǯ02·î03Æü" "2.13.0"
+.TH timidity.cfg 5 "2004ǯ02·î18Æü" "2.13.0"
 .SH Ì¾Á°
 timidity.cfg \- TiMidity++ ¤ÎÀßÄê¥Õ¥¡¥¤¥ë
 .SH ÀâÌÀ
@@ -50,6 +50,11 @@ zoo.pat 
 Â¾¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤ò¤½¤Î¾ì½ê¤ËÁÞÆþ¤·¡¤Â³¹Ô¤·¤Þ¤¹¡£\fBsource\fP ¤Î¥Í¥¹¥È¤Ï
 50 ÃʤޤDzÄǽ¤Ç¤¹¡£
 .TP
+.BI "progbase " number
+¤³¤ì°Ê¹ß¡¤¥×¥í¥°¥é¥àÈÖ¹æ¤ò \fInumber\fP ¤«¤é \fInumber\fP+128 ¤ÇÀßÄꡦ
+ɽ¼¨¤·¤Þ¤¹¡£Î㤨¤Ð¡¤\fBprogbase 1\fP ¤È¤·¤¿¾ì¹ç¤Ï¡¤¤½¤ì°Ê¹ß¥×¥í¥°¥é¥àÈÖ
+¹æ¤Ï \fB1\fP ¤«¤é \fB128\fP ¤ÇÀßÄꡦɽ¼¨¤µ¤ì¤Þ¤¹¡£
+.TP
 .BI "bank " "[MapID1] number"
 ¤³¤ì°Ê¹ßÊѹ¹¤¹¤ë¥È¡¼¥ó¥Ð¥ó¥¯¤òÁªÂò¤·¤Þ¤¹¡£¤³¤Îʸ°Ê¸å¤Î patch ¤ÎÂбþÉÕ¤±
 ¤Ï¡¤»ØÄꤵ¤ì¤¿¥È¡¼¥ó¥Ð¥ó¥¯¤ËÂФ·¤Æ¹Ô¤ï¤ì¤Þ¤¹¡£\fIMapID1\fP ¤Ë
@@ -57,11 +62,6 @@ zoo.pat 
 \fBxg\fP¡¤\fBxgsfx64\fP ¤Î¤¤¤º¤ì¤«¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¤ÆÃÄê¤Î¥Þ¥Ã¥×¤òÂоÝ
 ¤Ë¤Ç¤­¤Þ¤¹¡£
 .TP
-.BI "progbase " number
-¤³¤ì°Ê¹ß¡¤¥×¥í¥°¥é¥àÈÖ¹æ¤ò \fInumber\fP ¤«¤é \fInumber\fP+128 ¤ÇÀßÄꡦ
-ɽ¼¨¤·¤Þ¤¹¡£Î㤨¤Ð¡¤\fBprogbase 1\fP ¤È¤·¤¿¾ì¹ç¤Ï¡¤¤½¤ì°Ê¹ß¥×¥í¥°¥é¥àÈÖ
-¹æ¤Ï \fB1\fP ¤«¤é \fB128\fP ¤ÇÀßÄꡦɽ¼¨¤µ¤ì¤Þ¤¹¡£
-.TP
 .BI "drumset " "[MapID2] number"
 Êѹ¹¤¹¤ë¥É¥é¥à¥»¥Ã¥È¤òÁªÂò¤·¤Þ¤¹¡£¤³¤Îʸ°Ê¸å¤Î patch ¤ÎÂбþÉÕ¤±¤Ï¡¤»ØÄê
 ¤µ¤ì¤¿¥É¥é¥à¥»¥Ã¥È¤ËÂФ·¤Æ¹Ô¤ï¤ì¤Þ¤¹¡£\fIMapID2\fP ¤Ë \fBgm2drum\fP¡¤
@@ -132,6 +132,22 @@ WAV 
 ¤é \fB255\fP ¤Þ¤Ç¤ÎÃͤ¬»ØÄê¤Ç¤­¤Þ¤¹¡£ ½ñ¼°¤Ë¤Ä¤¤¤Æ¤Ï¡¤¤Û¤Ü \fBrate=\fP
 ¤ÈƱÍͤǤ¹¡£
 .TP
+.B keep={loop|env}
+¥Ñ¡¼¥«¥Ã¥·¥ç¥ó¥¤¥ó¥¹¥Ä¥ë¥á¥ó¥È¤Ç¤Ï¡¤¥Ç¥Õ¥©¥ë¥È¤Ç¥ë¡¼¥×¾ðÊó¤È¥¨¥ó¥Ù¥í¡¼
+¥×¾ðÊó¤¬ÇË´þ¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¤¥á¥í¥Ç¥£¡¼¥¤¥ó¥¹¥Ä¥ë¥á¥ó¥È¤Ë°Û¾ï¤Ê¥¨¥ó¥Ù¥í
+¡¼¥×¤¬Â¸ºß¤·¤¿¾ì¹ç¤Ë¤â¡¤¥¨¥ó¥Ù¥í¡¼¥×¾ðÊó¤Ï¼«Æ°Åª¤ËÇË´þ¤µ¤ì¤Þ¤¹¡£
+\fBkeep=\fP ¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¤¥ë¡¼¥×¾ðÊó¤ä¥¨¥ó¥Ù¥í¡¼¥×¾ðÊó¤¬ÇË´þ¤µ¤ì¤ë
+¤Î¤òËɤ®¤Þ¤¹¡£Î㤨¤Ð¡¤Short¡¤Long Whistle ¥Ñ¡¼¥«¥Ã¥·¥ç¥ó¥¤¥ó¥¹¥Ä¥ë¥á¥ó
+¥È(General MIDI ¤Î 71¡¤72 ÈÖ)¤ËÂФ·¤Æ¤Ï¡¤ÀßÄê¥Õ¥¡¥¤¥ë¤Ç
+\fBkeep=loop keep=env\fP ¤È¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ê¤Þ¤¹¡£
+.TP
+.B strip={loop|env|tail}
+¥¤¥ó¥¹¥Ä¥ë¥á¥ó¥È¤È¤·¤Æ»ÈÍѤ¹¤ë patch ¤Î¥ë¡¼¥×¾ðÊó¤ä¥¨¥ó¥Ù¥í¡¼¥×¾ðÊó¤ä¥Æ
+¡¼¥ë(¥ë¡¼¥×¤Î¸å¤Ë¤¢¤ë¥Ç¡¼¥¿)¤ò¤¹¤Ù¤Æ¶¯À©Åª¤ËÇË´þ¤·¤Þ¤¹¡£¥µ¡¼¥É¥Ñ¡¼¥Æ¥£
+¡¼¤Î¥¤¥ó¥¹¥Ä¥ë¥á¥ó¥È¤Ë¤Ï¡¤¥ë¡¼¥×¤Î¸å¤Ë¥´¥ß¤¬ÉÕ¤¤¤Æ¤¤¤ë¤â¤Î¤¬¤¢¤ê¡¤¥¤¥ó
+¥¹¥Ä¥ë¥á¥ó¥È¤ò±éÁÕ¤¹¤ëÅ٤˥¯¥ê¥Ã¥­¥ó¥°¥Î¥¤¥º¤¬Æþ¤Ã¤Æ¤·¤Þ¤¦¤³¤È¤¬¤¢¤ê¤Þ
+¤¹¡£¤½¤Î¾ì¹ç¡¤\fBstrip=tail\fP ¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ì¤Ð²»¼Á¤¬²þÁ±¤µ¤ì¤Þ¤¹¡£
+.TP
 .BI tremolo= sweep_increment:control_ratio:depth[,...]
 ¥È¥ì¥â¥í¤òÀßÄꤹ¤ë¥ª¥×¥·¥ç¥ó¤Ç¤¹¡£\fB0\fP ¤«¤é \fB255\fP ¤Þ¤Ç¤ÎÃͤ¬»ØÄê
 ¤Ç¤­¤Þ¤¹¡£\fBrate=\fP Æ±ÍÍ¡¤ÁÀ¤¤·â¤ÁÀßÄê¤äÉÔÍ×Éôʬ¤Î¾Êά¤¬²Äǽ¤Ç¤¹¡£
@@ -158,6 +174,9 @@ WAV 
 ¤¹¡£Æó¤ÄÌܰʹߤΰú¿ô¤Ï¡¤²»°èÊ̤ËÊ£¿ô¤Î¥µ¥ó¥×¥ë¥Ç¡¼¥¿¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç
 ¤Ë¡¤¤½¤ì¤¾¤ìÊ̤ÎÃͤò»ØÄê¤Ç¤­¤Þ¤¹¡£
 .TP
+.BI comm= comment
+\fIcomment\fP ¤¬»ØÄê¤Ç¤­¤Þ¤¹¡£\fB#extension comm\fP ¤ÈƱ¤¸¸ú²Ì¤Ç¤¹¡£
+.TP
 .BI modrate= attack:decay:sustain:release1:release2:release3[,...]
 .br
 .ns
@@ -207,25 +226,6 @@ SoundFont 
 .BI qvelf= num
 ¥ì¥¾¥Ê¥ó¥¹¡¦¥Ù¥í¥·¥Æ¥£¥Õ¥©¥í¡¼¤òÀßÄꤷ¤Þ¤¹¡£\fBvelocity=0\fP ¤ò´ð½à¤È¤·
 ¤Æ¡¤¥Ù¥í¥·¥Æ¥£¤Ë½¾¤¤¥ì¥¾¥Ê¥ó¥¹¤òÊѲ½¤µ¤»¤Þ¤¹¡£Ã±°Ì¤Ï +\-cB ¤Ç¤¹¡£
-.TP
-.B keep={loop|env}
-¥Ñ¡¼¥«¥Ã¥·¥ç¥ó¥¤¥ó¥¹¥Ä¥ë¥á¥ó¥È¤Ç¤Ï¡¤¥Ç¥Õ¥©¥ë¥È¤Ç¥ë¡¼¥×¾ðÊó¤È¥¨¥ó¥Ù¥í¡¼
-¥×¾ðÊó¤¬ÇË´þ¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¤¥á¥í¥Ç¥£¡¼¥¤¥ó¥¹¥Ä¥ë¥á¥ó¥È¤Ë°Û¾ï¤Ê¥¨¥ó¥Ù¥í
-¡¼¥×¤¬Â¸ºß¤·¤¿¾ì¹ç¤Ë¤â¡¤¥¨¥ó¥Ù¥í¡¼¥×¾ðÊó¤Ï¼«Æ°Åª¤ËÇË´þ¤µ¤ì¤Þ¤¹¡£
-\fBkeep=\fP ¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¤¥ë¡¼¥×¾ðÊó¤ä¥¨¥ó¥Ù¥í¡¼¥×¾ðÊó¤¬ÇË´þ¤µ¤ì¤ë
-¤Î¤òËɤ®¤Þ¤¹¡£Î㤨¤Ð¡¤Short¡¤Long Whistle ¥Ñ¡¼¥«¥Ã¥·¥ç¥ó¥¤¥ó¥¹¥Ä¥ë¥á¥ó
-¥È(General MIDI ¤Î 71¡¤72 ÈÖ)¤ËÂФ·¤Æ¤Ï¡¤ÀßÄê¥Õ¥¡¥¤¥ë¤Ç
-\fBkeep=loop keep=env\fP ¤È¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ê¤Þ¤¹¡£
-.TP
-.B strip={loop|env|tail}
-¥¤¥ó¥¹¥Ä¥ë¥á¥ó¥È¤È¤·¤Æ»ÈÍѤ¹¤ë patch ¤Î¥ë¡¼¥×¾ðÊó¤ä¥¨¥ó¥Ù¥í¡¼¥×¾ðÊó¤ä¥Æ
-¡¼¥ë(¥ë¡¼¥×¤Î¸å¤Ë¤¢¤ë¥Ç¡¼¥¿)¤ò¤¹¤Ù¤Æ¶¯À©Åª¤ËÇË´þ¤·¤Þ¤¹¡£¥µ¡¼¥É¥Ñ¡¼¥Æ¥£
-¡¼¤Î¥¤¥ó¥¹¥Ä¥ë¥á¥ó¥È¤Ë¤Ï¡¤¥ë¡¼¥×¤Î¸å¤Ë¥´¥ß¤¬ÉÕ¤¤¤Æ¤¤¤ë¤â¤Î¤¬¤¢¤ê¡¤¥¤¥ó
-¥¹¥Ä¥ë¥á¥ó¥È¤ò±éÁÕ¤¹¤ëÅ٤˥¯¥ê¥Ã¥­¥ó¥°¥Î¥¤¥º¤¬Æþ¤Ã¤Æ¤·¤Þ¤¦¤³¤È¤¬¤¢¤ê¤Þ
-¤¹¡£¤½¤Î¾ì¹ç¡¤\fBstrip=tail\fP ¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ì¤Ð²»¼Á¤¬²þÁ±¤µ¤ì¤Þ¤¹¡£
-.TP
-.BI comm= comment
-\fIcomment\fP ¤¬»ØÄê¤Ç¤­¤Þ¤¹¡£\fB#extension comm\fP ¤ÈƱ¤¸¸ú²Ì¤Ç¤¹¡£
 .RE
 .TP
 .BI "default " file
@@ -433,5 +433,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111\-1307
 USA
 .SH Æþ¼ê¸µ
 The latest release is available on the \fBTiMidity++\fP Page,
-.br
+.LP
 URL http://www.timidity.jp/
index 702b041..ce56774 100644 (file)
@@ -1 +1 @@
-EXTRA_DIST = dllutl.rb readme.txt
+EXTRA_DIST = dllutl.rb lspatch.pl readme.txt
index 53188de..cefd49d 100644 (file)
@@ -224,7 +224,7 @@ target_vendor = @target_vendor@
 tcltk_dep = @tcltk_dep@
 timidity_LDFLAGS = @timidity_LDFLAGS@
 w_so_libs = @w_so_libs@
-EXTRA_DIST = dllutl.rb readme.txt
+EXTRA_DIST = dllutl.rb lspatch.pl readme.txt
 subdir = script
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
diff --git a/script/lspatch.pl b/script/lspatch.pl
new file mode 100644 (file)
index 0000000..b485a29
--- /dev/null
@@ -0,0 +1,290 @@
+#!/usr/bin/perl
+
+#   TiMidity++ -- MIDI to WAVE converter and player
+#   Copyright (C) 1999-2004 Masanao Izumo <iz@onicos.co.jp>
+#   Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+my (@tonebank, @drumset);
+my (@pathlist, @patch_ext_list);
+my $rcf_count;
+my $def_instr_name;
+my ($cfg, $cfgroot);
+my $MAX_AMPLIFICATION;
+
+@pathlist = ( '.' );
+@patch_ext_list = ( '', '.pat', '.shn', '.pat.shn', '.gz', '.pat.gz' );
+$rcf_count = 0;
+$MAX_AMPLIFICATION = 800;
+if (@ARGV != 1) {
+       print STDERR "Usage: $0 cfg-file\n";
+       exit 1;
+}
+$cfgroot = $cfg = $ARGV[0];
+if ($cfgroot =~ s/\/[^\/]+$//) {
+       unshift(@pathlist, $cfgroot);
+}
+! &read_config_file($cfg) or exit 1;
+$rcf_count++;
+&lspatch('bank', @tonebank);
+&lspatch('drumset', @drumset);
+exit 0;
+
+sub read_config_file
+{
+       my ($name) = @_;
+       local *CFG;
+       my ($status, $i, $x, $y, $k);
+       my (@args, $bank, $orig_name, $line, $patch, @options);
+       
+       if ($rcf_count > 50) {
+               print STDERR "Probable source loop in configuration files";
+               return -1;
+       }
+       $orig_name = $name;
+       undef $_;
+       $name = &open_file(*CFG, $name) or return -1;
+       undef $_;
+       $line = 0;
+       while (<CFG>) {
+               $line++;
+               s/^\s+|\r?\n$//;
+               @args = split(/[ \t\r\n\240]+/, $_);
+               next if @args == 0 || $args[0] =~ /^$|^#/;
+               if ($args[0] eq 'dir') {
+                       if (@args < 2) {
+                               print STDERR "$name: line $line: No directory given\n";
+                               return -2;
+                       }
+                       shift @args;
+                       map(s/\/+$//, @args);
+                       unshift(@pathlist, reverse(@args));
+               } elsif ($args[0] eq 'source') {
+                       if (@args < 2) {
+                               print STDERR "$name: line $line: No file name given\n";
+                               return -2;
+                       }
+                       shift @args;
+                       for (@args) {
+                               $rcf_count++;
+                               print "source $_\n";
+                               $status = &read_config_file($_);
+                               $rcf_count--;
+                               return $status if $status;
+                       }
+               } elsif ($args[0] eq 'progbase') {
+                       ;
+               } elsif ($args[0] eq 'bank') {
+                       if (@args < 2) {
+                               print STDERR "$name: line $line: No bank number given\n";
+                               return -2;
+                       }
+                       $i = $args[1];
+                       if ($i < 0 || $i > 127) {
+                               print STDERR "$name: line $line: ";
+                               print STDERR "Tone bank must be between 0 and 127\n";
+                               return -2;
+                       }
+                       $tonebank[$i] = [] if ! defined $tonebank[$i];
+                       $bank = $tonebank[$i];
+               } elsif ($args[0] eq 'drumset') {
+                       if (@args < 2) {
+                               print STDERR "$name: line $line: No drum set number given\n";
+                               return -2;
+                       }
+                       $i = $args[1];
+                       if ($i < 0 || $i > 127) {
+                               print STDERR "$name: line $line: ";
+                               print STDERR "Drum set must be between 0 and 127\n";
+                               return -2;
+                       }
+                       $drumset[$i] = [] if ! defined $drumset[$i];
+                       $bank = $drumset[$i];
+               } elsif ($args[0] eq 'default') {
+                       if (@args < 2) {
+                               print STDERR "$name: line $line: ";
+                               print STDERR "Must specify exactly one patch name\n";
+                               return -2;
+                       }
+                       $def_instr_name = $args[1];
+               } elsif ($args[0] eq 'map') {
+                       ;
+               } elsif ($args[0] eq 'soundfont') {
+                       ;
+               } elsif ($args[0] eq 'font') {
+                       ;
+               } else {
+                       if (@args < 2 || $args[0] !~ /^[0-9]/) {
+                               print STDERR "$name: line $line: syntax error\n";
+                               return -2;
+                       }
+                       $i = shift @args;
+                       $patch = shift @args;
+                       if ($i < 0 || $i > 127) {
+                               printf STDERR "$name: line $line: ";
+                               printf STDERR "Program must be between 0 and 127\n";
+                               return -2;
+                       }
+                       if (! defined $bank) {
+                               print STDERR "$name: line $line: ";
+                               print STDERR "Must specify tone bank or drum set ";
+                               print STDERR "before assignment\n";
+                               return -2;
+                       }
+                       @options = ( );
+                       for (@args) {
+                               last if $_ =~ /^#/;
+                               ($x, $y) = split(/=/, $_, 2);
+                               if ($x eq 'amp') {
+                                       if ($y < 0 || $y > $MAX_AMPLIFICATION || $y !~ /^[0-9]/) {
+                                               print STDERR "$name: line $line: ";
+                                               print STDERR "amplification must be ";
+                                               print STDERR "between 0 and $MAX_AMPLIFICATION\n";
+                                               return -2;
+                                       }
+                               } elsif ($x eq 'note') {
+                                       if ($y < 0 || $y > 127 || $y !~ /^[0-9]/) {
+                                               print STDERR "$name: line $line: ";
+                                               print STDERR "note must be between 0 and 127\n";
+                                               return -2;
+                                       }
+                               } elsif ($x eq 'pan') {
+                                       if ($y eq 'center') {
+                                               $k = 64;
+                                       } elsif ($y eq 'left') {
+                                               $k = 0;
+                                       } elsif ($y eq 'right') {
+                                               $k = 127;
+                                       } else {
+                                               $k = int(($y + 100) * 100 / 157);
+                                       }
+                                       if ($k < 0 || $k > 127 || ($k == 0 && $y !~ /^[0-9\-]/)) {
+                                               print STDERR "$name: line $line: ";
+                                               print STDERR "panning must be left, right, center, ";
+                                               print STDERR "or between -100 and 100\n";
+                                               return -2;
+                                       }
+                               } elsif ($x eq 'tune') {
+                                       ;
+                               } elsif ($x eq 'rate') {
+                                       ;
+                               } elsif ($x eq 'offset') {
+                                       ;
+                               } elsif ($x eq 'keep') {
+                                       if ($y ne 'env' && $y ne 'loop') {
+                                               print STDERR "$name: line $line: ";
+                                               print STDERR "keep must be env or loop\n";
+                                               return -2;
+                                       }
+                               } elsif ($x eq 'strip') {
+                                       if ($y ne 'env' && $y ne 'loop' && $y ne 'tail') {
+                                               print STDERR "$name: line $line: ";
+                                               print STDERR "strip must be env, loop, or tail\n";
+                                               return -2;
+                                       }
+                               } elsif ($x eq 'tremolo') {
+                                       ;
+                               } elsif ($x eq 'vibrato') {
+                                       ;
+                               } elsif ($x eq 'sclnote') {
+                                       ;
+                               } elsif ($x eq 'scltune') {
+                                       ;
+                               } elsif ($x eq 'comm') {
+                                       ;
+                               } elsif ($x eq 'modrate') {
+                                       ;
+                               } elsif ($x eq 'modoffset') {
+                                       ;
+                               } elsif ($x eq 'trempitch') {
+                                       ;
+                               } elsif ($x eq 'tremfc') {
+                                       ;
+                               } elsif ($x eq 'modpitch') {
+                                       ;
+                               } elsif ($x eq 'modfc') {
+                                       ;
+                               } elsif ($x eq 'fc') {
+                                       ;
+                               } elsif ($x eq 'q') {
+                                       ;
+                               } elsif ($x eq 'fckeyf') {
+                                       ;
+                               } elsif ($x eq 'fcvelf') {
+                                       ;
+                               } elsif ($x eq 'qvelf') {
+                                       ;
+                               } else {
+                                       print STDERR "$name: line $line: bad patch option\n";
+                                       return -2;
+                               }
+                               push(@options, $_);
+                       }
+                       $bank->[$i] = ["$name:$line", $patch, @options];
+               }
+       }
+       close CFG;
+       return 0;
+}
+
+sub open_file
+{
+       local (*fiz) = shift;
+       my ($fname) = shift;
+       
+       if ($fname =~ /^\//) {
+               return $fname if open(*fiz, $fname);
+               return 0;
+       }
+       for (@pathlist) {
+               return "$_/$fname" if open(*fiz, "$_/$fname");
+       }
+       print STDERR "$fname: $!\n" if $rcf_count == 0;
+       return 0;
+}
+
+sub lspatch
+{
+       my ($tag, @insts) = @_;
+       my ($i, $j, $bank, $p, @inst, $pos);
+       
+       for ($i = 0; $i < 128; $i++) {
+               next if ! defined $insts[$i];
+               $bank = $insts[$i];
+               for ($j = 0; $j < 128; $j++) {
+                       next if ! defined $bank->[$j];
+                       $p = $bank->[$j];
+                       @inst = @$p;
+                       $pos = shift @inst;
+#                      $p = $bank->[$j]->[1];
+                       print "$tag $i $pos: $j @inst ", &find_patch($inst[0]), "\n";
+               }
+       }
+}
+
+sub find_patch
+{
+       my ($f) = @_;
+       local *FIZ;
+       my $realpath;
+       
+       for (@patch_ext_list) {
+               $realpath = &open_file(*FIZ, "$f$_");
+               return $realpath if $realpath;
+       }
+       return "-";
+}
+
index 2bf3adf..844463d 100644 (file)
@@ -1,2 +1,3 @@
-dllutl.rb: dynamic import source generator for dll (vorbis, gogo).\r
-\r
+dllutl.rb: dynamic import source generator for dll (vorbis, gogo).
+lspatch.pl: List the entire instrument configuration
+
index 0c36375..c2b5a28 100644 (file)
@@ -726,148 +726,85 @@ static Quantity **config_parse_modulation(const char *name, int line, const char
        return mod_list;
 }
 
-static int set_gus_patchconf_opts(char *name, int line, char *opts,
-                                 ToneBankElement *tone)
+static int set_gus_patchconf_opts(char *name,
+               int line, char *opts, ToneBankElement *tone)
 {
-    char *cp;
-    int k;
-
-    if(!(cp = strchr(opts, '=')))
-    {
-       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
-                 "%s: line %d: bad patch option %s",
-                 name, line, opts);
-       return 1;
-    }
-
-    *cp++ = 0;
-    if(!strcmp(opts, "amp"))
-    {
-       k = atoi(cp);
-       if((k < 0 || k > MAX_AMPLIFICATION) ||
-          (*cp < '0' || *cp > '9'))
-       {
-           ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
-                     "%s: line %d: amplification must be between "
-                     "0 and %d", name, line, MAX_AMPLIFICATION);
-           return 1;
-       }
-       tone->amp = k;
-    }
-    else if(!strcmp(opts, "note"))
-    {
-       k = atoi(cp);
-       if((k < 0 || k > 127) || (*cp < '0' || *cp > '9'))
-       {
-           ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
-                     "%s: line %d: note must be between 0 and 127",
-                     name, line);
-           return 1;
-       }
-       tone->note = k;
-    }
-    else if(!strcmp(opts, "pan"))
-    {
-       if(!strcmp(cp, "center"))
-           k = 64;
-       else if(!strcmp(cp, "left"))
-           k = 0;
-       else if(!strcmp(cp, "right"))
-           k = 127;
-       else
-           k = ((atoi(cp) + 100) * 100) / 157;
-       if((k < 0 || k > 127) ||
-          (k == 0 && *cp != '-' && (*cp < '0' || *cp > '9')))
-       {
-           ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
-                     "%s: line %d: panning must be left, right, "
-                     "center, or between -100 and 100",
-                     name, line);
-           return 1;
-       }
-       tone->pan = k;
-    }
-       else if(!strcmp(opts, "fckeyf"))        /* filter key-follow */
-    {
-       tone->key_to_fc = atoi(cp);
-    }
-       else if(!strcmp(opts, "fcvelf"))        /* filter velocity-follow */
-    {
-       tone->vel_to_fc = atoi(cp);
-    }
-       else if(!strcmp(opts, "qvelf")) /* resonance velocity-follow */
-    {
-       tone->vel_to_resonance = atoi(cp);
-    }
-    else if(!strcmp(opts, "keep"))
-    {
-       if(!strcmp(cp, "env"))
-           tone->strip_envelope = 0;
-       else if(!strcmp(cp, "loop"))
-           tone->strip_loop = 0;
-       else
-       {
-           ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
-                     "%s: line %d: keep must be env or loop",
-                     name, line);
-           return 1;
-       }
-    }
-    else if(!strcmp(opts, "strip"))
-    {
-       if(!strcmp(cp, "env"))
-           tone->strip_envelope = 1;
-       else if(!strcmp(cp, "loop"))
-           tone->strip_loop = 1;
-       else if(!strcmp(cp, "tail"))
-           tone->strip_tail = 1;
-       else
-       {
-           ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
-                     "%s: line %d: strip must be "
-                     "env, loop, or tail", name, line);
-           return 1;
-       }
-    }
-    else if(!strcmp(opts, "comm"))
-    {
-       char *p;
-       if(tone->comment)
-           free(tone->comment);
-       p = tone->comment = safe_strdup(cp);
-       while(*p)
-       {
-           if(*p == ',') *p = ' ';
-           p++;
+       char *cp;
+       int k;
+       
+       if (! (cp = strchr(opts, '='))) {
+               ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+                               "%s: line %d: bad patch option %s", name, line, opts);
+               return 1;
        }
-    }
-       else if (! strcmp(opts, "tune"))
+       *cp++ = 0;
+       if (! strcmp(opts, "amp")) {
+               k = atoi(cp);
+               if ((k < 0 || k > MAX_AMPLIFICATION) || (*cp < '0' || *cp > '9')) {
+                       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+                                       "%s: line %d: amplification must be between 0 and %d",
+                                       name, line, MAX_AMPLIFICATION);
+                       return 1;
+               }
+               tone->amp = k;
+       } else if (! strcmp(opts, "note")) {
+               k = atoi(cp);
+               if ((k < 0 || k > 127) || (*cp < '0' || *cp > '9')) {
+                       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+                                       "%s: line %d: note must be between 0 and 127",
+                                       name, line);
+                       return 1;
+               }
+               tone->note = k;
+               tone->scltune = config_parse_int16("100", &tone->scltunenum);
+       } else if (! strcmp(opts, "pan")) {
+               if (! strcmp(cp, "center"))
+                       k = 64;
+               else if (! strcmp(cp, "left"))
+                       k = 0;
+               else if (! strcmp(cp, "right"))
+                       k = 127;
+               else
+                       k = ((atoi(cp) + 100) * 100) / 157;
+               if ((k < 0 || k > 127)
+                               || (k == 0 && *cp != '-' && (*cp < '0' || *cp > '9'))) {
+                       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+                                       "%s: line %d: panning must be left, right, "
+                                       "center, or between -100 and 100",
+                                       name, line);
+                       return 1;
+               }
+               tone->pan = k;
+       } else if (! strcmp(opts, "tune"))
                tone->tune = config_parse_tune(cp, &tone->tunenum);
-       else if (! strcmp(opts, "sclnote"))
-               tone->sclnote = config_parse_int16(cp, &tone->sclnotenum);
-       else if (! strcmp(opts, "scltune"))
-               tone->scltune = config_parse_int16(cp, &tone->scltunenum);
-       else if (! strcmp(opts, "fc"))
-               tone->fc = config_parse_int16(cp, &tone->fcnum);
-       else if (! strcmp(opts, "q"))
-               tone->reso = config_parse_int16(cp, &tone->resonum);
-       else if (! strcmp(opts, "trempitch"))
-               tone->trempitch = config_parse_int16(cp, &tone->trempitchnum);
-       else if (! strcmp(opts, "tremfc"))
-               tone->tremfc = config_parse_int16(cp, &tone->tremfcnum);
-       else if (! strcmp(opts, "modpitch"))
-               tone->modpitch = config_parse_int16(cp, &tone->modpitchnum);
-       else if (! strcmp(opts, "modfc"))
-               tone->modfc = config_parse_int16(cp, &tone->modfcnum);
        else if (! strcmp(opts, "rate"))
                tone->envrate = config_parse_envelope(cp, &tone->envratenum);
        else if (! strcmp(opts, "offset"))
                tone->envofs = config_parse_envelope(cp, &tone->envofsnum);
-       else if (! strcmp(opts, "modrate"))
-               tone->modenvrate = config_parse_envelope(cp, &tone->modenvratenum);
-       else if (! strcmp(opts, "modoffset"))
-               tone->modenvofs = config_parse_envelope(cp, &tone->modenvofsnum);
-       else if (! strcmp(opts, "tremolo")) {
+       else if (! strcmp(opts, "keep")) {
+               if (! strcmp(cp, "env"))
+                       tone->strip_envelope = 0;
+               else if (! strcmp(cp, "loop"))
+                       tone->strip_loop = 0;
+               else {
+                       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+                                       "%s: line %d: keep must be env or loop", name, line);
+                       return 1;
+               }
+       } else if (! strcmp(opts, "strip")) {
+               if (! strcmp(cp, "env"))
+                       tone->strip_envelope = 1;
+               else if (! strcmp(cp, "loop"))
+                       tone->strip_loop = 1;
+               else if (! strcmp(cp, "tail"))
+                       tone->strip_tail = 1;
+               else {
+                       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+                                       "%s: line %d: strip must be env, loop, or tail",
+                                       name, line);
+                       return 1;
+               }
+       } else if (! strcmp(opts, "tremolo")) {
                if ((tone->trem = config_parse_modulation(name,
                                line, cp, &tone->tremnum, 0)) == NULL)
                        return 1;
@@ -875,7 +812,44 @@ static int set_gus_patchconf_opts(char *name, int line, char *opts,
                if ((tone->vib = config_parse_modulation(name,
                                line, cp, &tone->vibnum, 1)) == NULL)
                        return 1;
-       } else {
+       } else if (! strcmp(opts, "sclnote"))
+               tone->sclnote = config_parse_int16(cp, &tone->sclnotenum);
+       else if (! strcmp(opts, "scltune"))
+               tone->scltune = config_parse_int16(cp, &tone->scltunenum);
+       else if (! strcmp(opts, "comm")) {
+               char *p;
+               
+               if (tone->comment)
+                       free(tone->comment);
+               p = tone->comment = safe_strdup(cp);
+               while (*p) {
+                       if (*p == ',')
+                               *p = ' ';
+                       p++;
+               }
+       } else if (! strcmp(opts, "modrate"))
+               tone->modenvrate = config_parse_envelope(cp, &tone->modenvratenum);
+       else if (! strcmp(opts, "modoffset"))
+               tone->modenvofs = config_parse_envelope(cp, &tone->modenvofsnum);
+       else if (! strcmp(opts, "trempitch"))
+               tone->trempitch = config_parse_int16(cp, &tone->trempitchnum);
+       else if (! strcmp(opts, "tremfc"))
+               tone->tremfc = config_parse_int16(cp, &tone->tremfcnum);
+       else if (! strcmp(opts, "modpitch"))
+               tone->modpitch = config_parse_int16(cp, &tone->modpitchnum);
+       else if (! strcmp(opts, "modfc"))
+               tone->modfc = config_parse_int16(cp, &tone->modfcnum);
+       else if (! strcmp(opts, "fc"))
+               tone->fc = config_parse_int16(cp, &tone->fcnum);
+       else if (! strcmp(opts, "q"))
+               tone->reso = config_parse_int16(cp, &tone->resonum);
+       else if (! strcmp(opts, "fckeyf"))              /* filter key-follow */
+               tone->key_to_fc = atoi(cp);
+       else if (! strcmp(opts, "fcvelf"))              /* filter velocity-follow */
+               tone->vel_to_fc = atoi(cp);
+       else if (! strcmp(opts, "qvelf"))               /* resonance velocity-follow */
+               tone->vel_to_resonance = atoi(cp);
+       else {
                ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
                                "%s: line %d: bad patch option %s",
                                name, line, opts);