mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-02-20 19:02:04 +00:00
New setting: synth.midi-bank-select, defines the MIDI bank select style (GM, GS, XG or MMA. Default=GS). This setting is read only on initialization. The behavior of each option is the following
GM: ignores CC0 and CC32 msgs GS: CC0 becomes the channel bank, CC32 is ignored XG: CC32 becomes the channel bank, CC0 is ignored MMA: bank = CC0*128+CC32
This commit is contained in:
parent
1a6348b2ac
commit
713021b5a3
5 changed files with 85 additions and 7 deletions
|
@ -383,6 +383,34 @@ The following table provides details on all the settings used by the synthesizer
|
|||
more channels which can be mapped to different MIDI sources.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>synth.midi-bank-select</td>
|
||||
<td>Type</td>
|
||||
<td>string</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Default</td>
|
||||
<td>gs</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Options</td>
|
||||
<td>gm, gs, xg, mma</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Description</td>
|
||||
<td>This setting defines how the synthesizer interprets Bank Select messages.
|
||||
<ul>
|
||||
<li>gm: ignores CC0 and CC32 messages.</li>
|
||||
<li>gs: (default) CC0 becomes the bank number, CC32 is ignored.</li>
|
||||
<li>xg: CC32 becomes the bank number, CC0 is ignored.</li>
|
||||
<li>mma: bank is calculated as CC0*128+CC32.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>synth.min-note-length</td>
|
||||
<td>Type</td>
|
||||
|
|
|
@ -179,6 +179,9 @@ LADSPA subsystem enable toggle.
|
|||
.B synth.midi\-channels INT [min=16, max=256, def=16]
|
||||
Total MIDI channel count (must be multiple of 16).
|
||||
.TP
|
||||
.B synth.midi\-bank\-select STR [def='gs' vals:'gm', 'gs', 'xg', 'mma']
|
||||
MIDI Bank Select message style.
|
||||
.TP
|
||||
.B synth.min\-note\-length INT [min=0, max=65535, def=10]
|
||||
Minimum duration for note events (work around for very short percussion notes).
|
||||
.TP
|
||||
|
|
|
@ -274,13 +274,22 @@ fluid_channel_set_sfont_bank_prog(fluid_channel_t* chan, int sfontnum,
|
|||
void
|
||||
fluid_channel_set_bank_lsb(fluid_channel_t* chan, int banklsb)
|
||||
{
|
||||
int oldval, newval;
|
||||
int oldval, newval, style;
|
||||
|
||||
style = fluid_atomic_int_get (&chan->synth->bank_select);
|
||||
if (style == FLUID_BANK_STYLE_GM ||
|
||||
style == FLUID_BANK_STYLE_GS ||
|
||||
chan->channum == 9) //TODO: ask for channel drum mode, instead of number
|
||||
return; /* ignored */
|
||||
|
||||
/* Loop until bank LSB is atomically assigned */
|
||||
do
|
||||
{
|
||||
oldval = fluid_atomic_int_get (&chan->sfont_bank_prog);
|
||||
newval = (oldval & ~BANKLSB_MASKVAL) | (banklsb << BANK_SHIFTVAL);
|
||||
if (style == FLUID_BANK_STYLE_XG)
|
||||
newval = (oldval & ~BANK_MASKVAL) | (banklsb << BANK_SHIFTVAL);
|
||||
else /* style == FLUID_BANK_STYLE_MMA */
|
||||
newval = (oldval & ~BANKLSB_MASKVAL) | (banklsb << BANK_SHIFTVAL);
|
||||
}
|
||||
while (newval != oldval
|
||||
&& !fluid_atomic_int_compare_and_exchange (&chan->sfont_bank_prog,
|
||||
|
@ -291,13 +300,23 @@ fluid_channel_set_bank_lsb(fluid_channel_t* chan, int banklsb)
|
|||
void
|
||||
fluid_channel_set_bank_msb(fluid_channel_t* chan, int bankmsb)
|
||||
{
|
||||
int oldval, newval;
|
||||
int oldval, newval, style;
|
||||
|
||||
style = fluid_atomic_int_get (&chan->synth->bank_select);
|
||||
if (style == FLUID_BANK_STYLE_GM ||
|
||||
style == FLUID_BANK_STYLE_XG ||
|
||||
chan->channum == 9) //TODO: ask for channel drum mode, instead of number
|
||||
return; /* ignored */
|
||||
//TODO: if style == XG and bankmsb == 127, convert the channel to drum mode
|
||||
|
||||
/* Loop until bank MSB is atomically assigned */
|
||||
do
|
||||
{
|
||||
oldval = fluid_atomic_int_get (&chan->sfont_bank_prog);
|
||||
newval = (oldval & ~BANKMSB_MASKVAL) | (bankmsb << (BANK_SHIFTVAL + 7));
|
||||
if (style == FLUID_BANK_STYLE_GS)
|
||||
newval = (oldval & ~BANK_MASKVAL) | (bankmsb << BANK_SHIFTVAL);
|
||||
else /* style == FLUID_BANK_STYLE_MMA */
|
||||
newval = (oldval & ~BANKMSB_MASKVAL) | (bankmsb << (BANK_SHIFTVAL + 7));
|
||||
}
|
||||
while (newval != oldval
|
||||
&& !fluid_atomic_int_compare_and_exchange (&chan->sfont_bank_prog,
|
||||
|
|
|
@ -234,10 +234,15 @@ void fluid_synth_settings(fluid_settings_t* settings)
|
|||
FLUID_HINT_TOGGLED, NULL, NULL);
|
||||
fluid_settings_register_int(settings, "synth.parallel-render", 1, 0, 1,
|
||||
FLUID_HINT_TOGGLED, NULL, NULL);
|
||||
|
||||
|
||||
|
||||
fluid_synth_register_overflow(settings, NULL, NULL);
|
||||
|
||||
|
||||
fluid_settings_register_str(settings, "synth.midi-bank-select", "gs", 0, NULL, NULL);
|
||||
fluid_settings_add_option(settings, "synth.midi-bank-select", "gm");
|
||||
fluid_settings_add_option(settings, "synth.midi-bank-select", "gs");
|
||||
fluid_settings_add_option(settings, "synth.midi-bank-select", "xg");
|
||||
fluid_settings_add_option(settings, "synth.midi-bank-select", "mma");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -875,6 +880,16 @@ new_fluid_synth(fluid_settings_t *settings)
|
|||
#endif
|
||||
}
|
||||
|
||||
synth->bank_select = FLUID_BANK_STYLE_GS;
|
||||
if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "gm") == 1)
|
||||
synth->bank_select = FLUID_BANK_STYLE_GM;
|
||||
else if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "gs") == 1)
|
||||
synth->bank_select = FLUID_BANK_STYLE_GS;
|
||||
else if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "xg") == 1)
|
||||
synth->bank_select = FLUID_BANK_STYLE_XG;
|
||||
else if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "mma") == 1)
|
||||
synth->bank_select = FLUID_BANK_STYLE_MMA;
|
||||
|
||||
/* FIXME */
|
||||
synth->start = fluid_curtime();
|
||||
|
||||
|
|
|
@ -69,6 +69,17 @@
|
|||
FLUID_LOOP_UNTIL_RELEASE = 3
|
||||
};*/
|
||||
|
||||
/**
|
||||
* Bank Select MIDI message styles. Default style is GS.
|
||||
*/
|
||||
enum fluid_midi_bank_select
|
||||
{
|
||||
FLUID_BANK_STYLE_GM, /**< GM style, bank = 0 always (CC0/MSB and CC32/LSB ignored) */
|
||||
FLUID_BANK_STYLE_GS, /**< GS style, bank = CC0/MSB (CC32/LSB ignored) */
|
||||
FLUID_BANK_STYLE_XG, /**< XG style, bank = CC32/LSB (CC0/MSB ignored) */
|
||||
FLUID_BANK_STYLE_MMA /**< MMA style bank = 128*MSB+LSB */
|
||||
};
|
||||
|
||||
enum fluid_synth_status
|
||||
{
|
||||
FLUID_SYNTH_CLEAN,
|
||||
|
@ -116,6 +127,7 @@ typedef struct _fluid_sfont_info_t {
|
|||
* LADSPA_FxUnit (Contents change)
|
||||
* cores
|
||||
* core_threads[]
|
||||
* bank_select (FIXME: pending implementation of SYSEX midi mode changes)
|
||||
*
|
||||
* Single thread use only (modify only prior to synthesis):
|
||||
* loaders<>
|
||||
|
@ -180,6 +192,7 @@ struct _fluid_synth_t
|
|||
int dump; /**< Dump events to stdout to hook up a user interface? */
|
||||
double sample_rate; /**< The sample rate */
|
||||
int midi_channels; /**< the number of MIDI channels (>= 16) */
|
||||
int bank_select; /**< the style of Bank Select MIDI messages */
|
||||
int audio_channels; /**< the number of audio channels (1 channel=left+right) */
|
||||
int audio_groups; /**< the number of (stereo) 'sub'groups from the synth.
|
||||
Typically equal to audio_channels. */
|
||||
|
|
Loading…
Reference in a new issue