iiwusynth-devel
[Top][All Lists]
Advanced

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

[iiwusynth-devel] One more patch


From: Markus Nentwig
Subject: [iiwusynth-devel] One more patch
Date: Mon, 25 Mar 2002 23:58:11 +0100

Hello,

I implemented the 'reverb send' controller and set the Pitch bend
default position to neutral.
The patch follows, this time obtained with diff -ru.

Regards

Markus 

diff -ru iiwusynth_orig/iiwusynth/ChangeLog
iiwusynth_work/iiwusynth/ChangeLog
--- iiwusynth_orig/iiwusynth/ChangeLog  Tue Mar 12 12:27:18 2002
+++ iiwusynth_work/iiwusynth/ChangeLog  Tue Mar 26 00:08:08 2002
@@ -1,3 +1,9 @@
+2002-03-25  Markus Nentwig <address@hidden>
+       * fixed command line options 'gain', 'reverb' (didn't take parameter)
+       * Implemented Midi controller 91 (Reverb send)
+       * Channel default for pitch bend is now 'neutral' position.
+       * Changed 'rev_setbypass' command to 'rev_defeat'
+
 2002-03-12  Peter Hanappe  <address@hidden>
 
        * src/iiwusynth.h: the preset iteration in a soundfont now takes a
diff -ru iiwusynth_orig/iiwusynth/src/iiwu_chan.c
iiwusynth_work/iiwusynth/src/iiwu_chan.c
--- iiwusynth_orig/iiwusynth/src/iiwu_chan.c    Wed Feb 20 14:42:22 2002
+++ iiwusynth_work/iiwusynth/src/iiwu_chan.c    Mon Mar 25 23:42:42 2002
@@ -53,11 +53,12 @@
 
   chan->key_pressure = 0;
   chan->channel_pressure = 0;
-  chan->pitch_bend = 0;
+  chan->pitch_bend = 0x2000; /* <MN> Range is 0x4000 (iiwu_mod.c).
Pitch bend wheel starts in centered position. </MN> */
   chan->pitch_wheel_sensitivity = 2; /* two semi-tones */
 
   SETCC(chan, 7, 127);  /* channel volume / initial attenuation */
-  SETCC(chan, 10, 64);  /* pan controller */  
+  SETCC(chan, 10, 64);  /* pan controller */
+  SETCC(chan, 91, 0);   /* Reverb send default is 0 (SF2.01 specs page
48) */
 
   chan->bank_msb = 0;
 
diff -ru iiwusynth_orig/iiwusynth/src/iiwu_cmd.c
iiwusynth_work/iiwusynth/src/iiwu_cmd.c
--- iiwusynth_orig/iiwusynth/src/iiwu_cmd.c     Tue Mar 12 12:27:18 2002
+++ iiwusynth_work/iiwusynth/src/iiwu_cmd.c     Tue Mar 26 00:05:55 2002
@@ -49,19 +49,19 @@
   { "channels", iiwu_handle_channels, "channels                print
out preset of all channels" },
   { "mstat", iiwu_handle_mstat,       "mstat                   print
out the status of the MIDI driver" },
   { "rev_preset", iiwu_handle_reverbpreset,
-                                      "rev_preset num          Load
preset num into the reverb unit" },
+                                      "rev_preset value        Load
preset value (0..4) into the reverb unit" },
   { "rev_setroomsize", iiwu_handle_reverbsetroomsize,
-                                      "rev_setroomsize num     change
reverb room size" },
+                                      "rev_setroomsize value   change
reverb room size (0..100)" },
   { "rev_setdamp", iiwu_handle_reverbsetdamp,
-                                      "rev_setdamp num         change
reverb damping" },
+                                      "rev_setdamp value       change
reverb damping (0..1)" },
   { "rev_setwidth", iiwu_handle_reverbsetwidth,
-                                      "rev_setwidth num        change
reverb width" },
+                                      "rev_setwidth value      change
reverb width (0..100)" },
   { "rev_setwet", iiwu_handle_reverbsetwet,
-                                      "rev_setwet num          change
reverb wet level" },
+                                      "rev_setwet value        change
reverb wet level (0..30)" },
   { "rev_setdry", iiwu_handle_reverbsetdry,
-                                      "rev_setdry num          change
reverb dry level" },
-  { "rev_setbypass", iiwu_handle_reverbsetbypass,
-                                      "rev_setbypass num       num=1:
disable reverb unit entirely" },
+                                      "rev_setdry value        change
reverb dry level (0..30)" },
+  { "rev_defeat", iiwu_handle_reverbdefeat,
+                                      "rev_defeat value        disable
reverb unit entirely (0,1)" },
   { "gain", iiwu_handle_gain,         "gain value              set the
master gain (0 < gain < 1)" },
   { NULL, NULL, NULL }
 };
@@ -526,25 +526,25 @@
 }
 
 /* Purpose:
- * Response to 'rev_setbypass' command.
+ * Response to 'rev_defeat' command.
  * Change the IIWU_REVERB flag in the synth */
 int
-iiwu_handle_reverbsetbypass(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len)
+iiwu_handle_reverbdefeat(iiwu_synth_t* synth, int ac, char** av, char*
reply, int len)
 {
-  int bypass_on;
+  int defeat;
   if (ac < 1) {
-    snprintf(reply, len, "rev_setbypass: too few arguments.");
+    snprintf(reply, len, "rev_defeat: too few arguments.");
     return -1;
   }
-  bypass_on = atoi(av[0]);
+  defeat = atoi(av[0]);
 
-  if ((bypass_on != 1) && (bypass_on != 0)){
-    snprintf(reply, len, "rev_setbypass: Needs '0' or '1'.");
+  if ((defeat != 1) && (defeat != 0)){
+    snprintf(reply, len, "rev_defeat: Needs '0' or '1'.");
     return -1;
   };
 
   /* Bypass switch on =Synth doesn't use reverb. */
-  if (bypass_on){
+  if (defeat){
     synth->settings.flags &= (!IIWU_REVERB); /* Clear the bit */
   } else {
     synth->settings.flags |= IIWU_REVERB;    /* Set the bit */
diff -ru iiwusynth_orig/iiwusynth/src/iiwu_cmd.h
iiwusynth_work/iiwusynth/src/iiwu_cmd.h
--- iiwusynth_orig/iiwusynth/src/iiwu_cmd.h     Tue Mar 12 12:27:18 2002
+++ iiwusynth_work/iiwusynth/src/iiwu_cmd.h     Mon Mar 25 23:49:32 2002
@@ -65,7 +65,7 @@
 int iiwu_handle_reverbsetwidth(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
 int iiwu_handle_reverbsetwet(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
 int iiwu_handle_reverbsetdry(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
-int iiwu_handle_reverbsetbypass(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
+int iiwu_handle_reverbdefeat(iiwu_synth_t* synth, int ac, char** av,
char* reply, int len);
 int iiwu_handle_gain(iiwu_synth_t* synth, int ac, char** av, char*
reply, int len);
 
 /** the command structures */
diff -ru iiwusynth_orig/iiwusynth/src/iiwu_synth.c
iiwusynth_work/iiwusynth/src/iiwu_synth.c
--- iiwusynth_orig/iiwusynth/src/iiwu_synth.c   Tue Mar 12 12:27:18 2002
+++ iiwusynth_work/iiwusynth/src/iiwu_synth.c   Mon Mar 25 23:04:18 2002
@@ -43,6 +43,7 @@
 
 /* default modulators */
 iiwu_mod_t default_pan_mod;
+iiwu_mod_t default_reverb_mod;
 iiwu_mod_t default_att_mod;
 iiwu_mod_t default_pitch_bend_mod;
 
@@ -170,6 +171,13 @@
   iiwu_mod_set_dest(&default_pan_mod, GEN_PAN);
   iiwu_mod_set_amount(&default_pan_mod, 1000.0);
 
+  /* reverb send */
+  iiwu_mod_set_source1(&default_reverb_mod, 91, 
+                      IIWU_MOD_CC | IIWU_MOD_LINEAR | IIWU_MOD_UNIPOLAR |
IIWU_MOD_POSITIVE);
+  iiwu_mod_set_source2(&default_reverb_mod, 0, 0);
+  iiwu_mod_set_dest(&default_reverb_mod, GEN_REVERBSEND);
+  iiwu_mod_set_amount(&default_reverb_mod, 1000.0);
+
   /* initial attenuation */
   iiwu_mod_set_source1(&default_att_mod, 7, 
                       IIWU_MOD_CC | IIWU_MOD_CONCAVE | IIWU_MOD_UNIPOLAR |
IIWU_MOD_NEGATIVE);
@@ -1051,6 +1059,7 @@
   
   /* add the default modulators to the synthesis process. */
   iiwu_voice_add_mod(voice, &default_pan_mod);
+  iiwu_voice_add_mod(voice, &default_reverb_mod);
   iiwu_voice_add_mod(voice, &default_att_mod);
   iiwu_voice_add_mod(voice, &default_pitch_bend_mod);
   
diff -ru iiwusynth_orig/iiwusynth/src/iiwu_voice.c
iiwusynth_work/iiwusynth/src/iiwu_voice.c
--- iiwusynth_orig/iiwusynth/src/iiwu_voice.c   Tue Mar 12 12:27:18 2002
+++ iiwusynth_work/iiwusynth/src/iiwu_voice.c   Mon Mar 25 23:44:24 2002
@@ -159,7 +159,7 @@
   voice->pan = 0;
 
   /* reverb */
-  voice->reverb_send = 0.1;
+  voice->reverb_send = 0.;
 
   /* chorus */
   voice->chorus_send = 0;
@@ -444,8 +444,10 @@
 
 
   /*************** reverb send ******************/
-
-  reverb_send = voice->reverb_send;
+  /* <MN>: SF2.01 Specs page 41: "A value of 100 % (in 0.01 % units) 
*/
+  /* indicates the note is sent at full level." The factor of 1/1000
should be reasonable. </MN> */
+  reverb_send = voice->reverb_send*0.001;
 
   /*********************** run the dsp chain ************************/
   /* the dsp chain might have to run for several chunks, depending on
@@ -720,12 +722,14 @@
     }
   }
   
-  /* pan */
+  /* pan (Midi Ctrl. 10) */
   iiwu_voice_modulate(voice, 1, 10);
+  /* reverb (Midi Ctrl. 91) */
+  iiwu_voice_modulate(voice, 1, 91);
 /*    voice->pan = voice->gen[GEN_PAN].val; */
 
   /* reverb */
-  voice->reverb_send = voice->gen[GEN_REVERBSEND].val / 1000.0f;
+// <MN>  voice->reverb_send = voice->gen[GEN_REVERBSEND].val / 1000.0f;
</MN>
 
   /* chorus */
   voice->chorus_send = voice->gen[GEN_CHORUSSEND].val / 1000.0f;
@@ -775,6 +779,10 @@
 
   case GEN_PAN:
     voice->pan = _GEN(voice, GEN_PAN);
+    break;
+
+  case GEN_REVERBSEND:
+    voice->reverb_send = _GEN(voice, GEN_REVERBSEND);
     break;
 
   case GEN_ATTENUATION:
diff -ru iiwusynth_orig/iiwusynth/src/iiwusynth.c
iiwusynth_work/iiwusynth/src/iiwusynth.c
--- iiwusynth_orig/iiwusynth/src/iiwusynth.c    Tue Mar 12 12:27:18 2002
+++ iiwusynth_work/iiwusynth/src/iiwusynth.c    Mon Mar 25 22:35:43 2002
@@ -105,8 +105,8 @@
       {"audio-bufsize", 1, 0, 'z'},
       {"audio-bufcount", 1, 0, 'c'},
       {"verbose", 0, 0, 'V'},
-      {"reverb", 0, 0, 'R'},
-      {"gain", 0, 0, 'g'},
+      {"reverb", 1, 0, 'R'},
+      {"gain", 1, 0, 'g'},
       {"help", 0, 0, 'h'},
       {0, 0, 0, 0}
     };



reply via email to

[Prev in Thread] Current Thread [Next in Thread]