fluid-dev
[Top][All Lists]
Advanced

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

Re: [fluid-dev] Soundfont banks


From: jimmy
Subject: Re: [fluid-dev] Soundfont banks
Date: Tue, 10 Jul 2012 06:52:39 -0700 (PDT)

Note that

   chan->sfont_bank_prog 
   
does have the space for the full 14-bit [MSB, LSB] combination in place.  And 
yes, the FLUID_BANK_STYLE_MMA handles the 14-bit combination of [MSB, LSB] just 
fine in those 2 functions.  You and Pedro simply cripled XG-mode by rejected my 
changes.

---

The patch I submitted, which was not applied:


diff -pur fluidsynth.svnRev405.20110207/src/synth/fluid_chan.c 
fluidsynth.svnRev405.20110207.jnSysex/src/synth/fluid_chan.c
--- fluidsynth.svnRev405.20110207/src/synth/fluid_chan.c        2011-02-07 
20:29:48.000000000 -0500
+++ fluidsynth.svnRev405.20110207.jnSysex/src/synth/fluid_chan.c        
2011-02-09 17:20:05.000000000 -0500
@@ -239,7 +239,7 @@ fluid_channel_set_bank_lsb(fluid_channel
 
   oldval = chan->sfont_bank_prog;
   if (style == FLUID_BANK_STYLE_XG)
-      newval = (oldval & ~BANK_MASKVAL) | (banklsb << BANK_SHIFTVAL);
+      newval = (oldval & ~BANKLSB_MASKVAL) | (banklsb << BANK_SHIFTVAL);
   else /* style == FLUID_BANK_STYLE_MMA */
       newval = (oldval & ~BANKLSB_MASKVAL) | (banklsb << BANK_SHIFTVAL);
   chan->sfont_bank_prog = newval;
@@ -259,6 +259,9 @@ fluid_channel_set_bank_msb(fluid_channel
     /* The number "120" was based on several keyboards having drums at 120 - 
127, 
        reference: 
http://lists.nongnu.org/archive/html/fluid-dev/2011-02/msg00003.html */
     chan->channel_type = (120 <= bankmsb) ? CHANNEL_TYPE_DRUM : 
CHANNEL_TYPE_MELODIC;
+    oldval = chan->sfont_bank_prog;
+    newval = (oldval & ~BANKMSB_MASKVAL) | (bankmsb << (BANK_SHIFTVAL + 7));
+    chan->sfont_bank_prog = newval;
     return;
   }
 

-----

The first part, in handling LSB,


@@ -239,7 +239,7 @@ fluid_channel_set_bank_lsb(fluid_channel
 
   oldval = chan->sfont_bank_prog;
   if (style == FLUID_BANK_STYLE_XG)
-      newval = (oldval & ~BANK_MASKVAL) | (banklsb << BANK_SHIFTVAL);
+      newval = (oldval & ~BANKLSB_MASKVAL) | (banklsb << BANK_SHIFTVAL);


The current code blindly wipe out the full 14-bit mask via [& ~BANK_MASKVAL], 
which means a change to LSB, will set/reset MSB to 0.  Which is completely 
wrong!!!  It should be handled the same way of FLUID_BANK_STYLE_MMA.  For 
recent XG hardware, MIDI messages come in the order of MSB, LSB, progChange.  
If LSB event sets MSB to 0 no matter what, just be cause you don't care for any 
value beyond LSB (max of 128 soundbanks), that's just freaking asinine!!!

No such restriction for FLUID_BANK_STYLE_MMA mode in that same function!!!  
Note that XG use of [MSB, LSB] is no different from FLUID_BANK_STYLE_MMA.

My patch here will just change the LSB as it should be, don't mess with MSB 
here.



The second part, in handling MSB,

@@ -259,6 +259,9 @@ fluid_channel_set_bank_msb(fluid_channel
     /* The number "120" was based on several keyboards having drums at 120 - 
127, 
        reference: 
http://lists.nongnu.org/archive/html/fluid-dev/2011-02/msg00003.html */
     chan->channel_type = (120 <= bankmsb) ? CHANNEL_TYPE_DRUM : 
CHANNEL_TYPE_MELODIC;
+    oldval = chan->sfont_bank_prog;
+    newval = (oldval & ~BANKMSB_MASKVAL) | (bankmsb << (BANK_SHIFTVAL + 7));
+    chan->sfont_bank_prog = newval;


The existing XG code path was a patch from me to allow setting a channel as a 
drum-channel, it returns out of the function without really setting the MSB 
value, which is missing my "rejected patch".  But the code prior to that didn't 
properly handle XG-mode drum channels correctly either, as you could see with:

   if (style == FLUID_BANK_STYLE_GM ||
      chan->channel_type == CHANNEL_TYPE_DRUM)
      return; /* ignored */

My patch would properly set the XG-mode MSB value the way it should be, before 
return from that function.  This should be no different than the way 
FLUID_BANK_STYLE_MMA is handled.  Although, I think current code won't deal 
with FLUID_BANK_STYLE_MMA drum-channel MSB properly, because of the 
if-statement above.  But I'm not concerned with MMA-mode for the time being.

Because you and Pedro don't care or XG-mode use of MSB.  You and Pedro sticking 
it to me, quoting some lame maximum 128 soundbanks limits, and my patch for MSB 
value-change never got applied.  Let me say it again, this XG-mode setting of 
[MSB, LSB] should be no different than the way FLUID_BANK_STYLE_MMA is set, 
which is already in place in these functions.

My other changes that you quoted, was applied for allowing any channel to use 
as Drum-channel.  I had patches for several different things back then, 
including some SysEx patches for XG, some typo in existing code, some 
inconsistent commandline parameter of volume "gain" of 5 maximum in one place 
and 10 in another place....

---

Jimmy







reply via email to

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