From 8f9b89588a7778087d338872d41d94cbe92bd9a5 Mon Sep 17 00:00:00 2001 From: Marcus Weseloh Date: Wed, 3 Jan 2018 16:49:43 +0100 Subject: [PATCH 1/5] Add support for channel balance control (CC 8) --- include/fluidsynth/gen.h | 1 + src/synth/fluid_chan.c | 8 +++++++- src/synth/fluid_gen.c | 3 ++- src/synth/fluid_mod.c | 1 + src/synth/fluid_synth.c | 15 ++++++++++++++- src/synth/fluid_voice.c | 25 +++++++++++++++++-------- src/synth/fluid_voice.h | 3 +++ src/utils/fluid_conv.c | 35 +++++++++++++++++++++++++++++++++++ src/utils/fluid_conv.h | 1 + 9 files changed, 81 insertions(+), 11 deletions(-) diff --git a/include/fluidsynth/gen.h b/include/fluidsynth/gen.h index d4700073..056b67a8 100644 --- a/include/fluidsynth/gen.h +++ b/include/fluidsynth/gen.h @@ -99,6 +99,7 @@ enum fluid_gen_type { * is used, however, as the destination for the default pitch wheel * modulator. */ GEN_PITCH, /**< Pitch @note Not a real SoundFont generator */ + GEN_BALANCE, /**< Balance @note Not a real SoundFont generator */ #ifndef __DOXYGEN__ GEN_LAST /**< @internal Value defines the count of generators (#fluid_gen_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ #endif diff --git a/src/synth/fluid_chan.c b/src/synth/fluid_chan.c index a615393e..c307a87d 100644 --- a/src/synth/fluid_chan.c +++ b/src/synth/fluid_chan.c @@ -118,7 +118,9 @@ fluid_channel_init_ctrl(fluid_channel_t* chan, int is_all_ctrl_off) continue; } if (i == BANK_SELECT_MSB || i == BANK_SELECT_LSB || i == VOLUME_MSB || - i == VOLUME_LSB || i == PAN_MSB || i == PAN_LSB) { + i == VOLUME_LSB || i == PAN_MSB || i == PAN_LSB || + i == BALANCE_MSB || i == BALANCE_LSB + ) { continue; } @@ -165,6 +167,10 @@ fluid_channel_init_ctrl(fluid_channel_t* chan, int is_all_ctrl_off) fluid_channel_set_cc (chan, PAN_MSB, 64); fluid_channel_set_cc (chan, PAN_LSB, 0); + /* Balance (MSB & LSB) */ + fluid_channel_set_cc (chan, BALANCE_MSB, 64); + fluid_channel_set_cc (chan, BALANCE_LSB, 0); + /* Reverb */ /* fluid_channel_set_cc (chan, EFFECTS_DEPTH1, 40); */ /* Note: although XG standard specifies the default amount of reverb to diff --git a/src/synth/fluid_gen.c b/src/synth/fluid_gen.c index a3efcb2a..a89127b7 100644 --- a/src/synth/fluid_gen.c +++ b/src/synth/fluid_gen.c @@ -85,7 +85,8 @@ static const fluid_gen_info_t fluid_gen_info[] = { { GEN_SCALETUNE, 0, 1, 0.0f, 1200.0f, 100.0f }, { GEN_EXCLUSIVECLASS, 0, 0, 0.0f, 0.0f, 0.0f }, { GEN_OVERRIDEROOTKEY, 1, 0, 0.0f, 127.0f, -1.0f }, - { GEN_PITCH, 1, 0, 0.0f, 127.0f, 0.0f } + { GEN_PITCH, 1, 0, 0.0f, 127.0f, 0.0f }, + { GEN_BALANCE, 1, 0, -1000.0f, 1000.0f, 0.0f } }; diff --git a/src/synth/fluid_mod.c b/src/synth/fluid_mod.c index cb276c97..6b310202 100644 --- a/src/synth/fluid_mod.c +++ b/src/synth/fluid_mod.c @@ -497,6 +497,7 @@ void fluid_dump_modulator(fluid_mod_t * mod){ case GEN_CHORUSSEND: printf("Chorus send"); break; case GEN_REVERBSEND: printf("Reverb send"); break; case GEN_PAN: printf("pan"); break; + case GEN_BALANCE: printf("balance"); break; case GEN_ATTENUATION: printf("att"); break; default: printf("dest %i",dest); }; /* switch dest */ diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index 3088dccb..c62210d8 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -138,6 +138,7 @@ static fluid_mod_t default_expr_mod; /* SF2.01 section 8.4.7 */ static fluid_mod_t default_reverb_mod; /* SF2.01 section 8.4.8 */ static fluid_mod_t default_chorus_mod; /* SF2.01 section 8.4.9 */ static fluid_mod_t default_pitch_bend_mod; /* SF2.01 section 8.4.10 */ +static fluid_mod_t default_balance_mod; /* Non-standard modulator */ /* reverb presets */ static const fluid_revmodel_presets_t revmodel_preset[] = { @@ -408,6 +409,18 @@ fluid_synth_init(void) ); fluid_mod_set_dest(&default_pitch_bend_mod, GEN_PITCH); /* Destination: Initial pitch */ fluid_mod_set_amount(&default_pitch_bend_mod, 12700.0); /* Amount: 12700 cents */ + + + /* Non-standard MIDI continuous controller 8 to channel stereo balance */ + fluid_mod_set_source1(&default_balance_mod, BALANCE_MSB, /* Index=8 */ + FLUID_MOD_CC /* CC=1 */ + | FLUID_MOD_LINEAR /* type=0 */ + | FLUID_MOD_BIPOLAR /* P=1 */ + | FLUID_MOD_POSITIVE /* D=0 */ + ); + fluid_mod_set_source2(&default_balance_mod, 0, 0); + fluid_mod_set_dest(&default_balance_mod, GEN_BALANCE); /* Destination: stereo balance */ + fluid_mod_set_amount(&default_balance_mod, 1000.0); /* Amount: 1000 tens of a percent */ } static FLUID_INLINE unsigned int fluid_synth_get_ticks(fluid_synth_t* synth) @@ -694,7 +707,7 @@ new_fluid_synth(fluid_settings_t *settings) fluid_synth_add_default_mod(synth, &default_reverb_mod, FLUID_SYNTH_ADD); fluid_synth_add_default_mod(synth, &default_chorus_mod, FLUID_SYNTH_ADD); fluid_synth_add_default_mod(synth, &default_pitch_bend_mod, FLUID_SYNTH_ADD); - + fluid_synth_add_default_mod(synth, &default_balance_mod, FLUID_SYNTH_ADD); /* Create and initialize the Fx unit.*/ fluid_settings_getint(settings, "synth.ladspa.active", &with_ladspa); diff --git a/src/synth/fluid_voice.c b/src/synth/fluid_voice.c index 6f4c4f38..07c60728 100644 --- a/src/synth/fluid_voice.c +++ b/src/synth/fluid_voice.c @@ -537,7 +537,8 @@ fluid_voice_calculate_runtime_synthesis_parameters(fluid_voice_t* voice) /* GEN_COARSETUNE [1] #51 */ /* GEN_FINETUNE [1] #52 */ GEN_OVERRIDEROOTKEY, /* #58 */ - GEN_PITCH /* --- */ + GEN_PITCH, /* --- */ + GEN_BALANCE /* --- */ }; /* When the voice is made ready for the synthesis process, a lot of @@ -691,14 +692,20 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen) switch (gen) { case GEN_PAN: - /* range checking is done in the fluid_pan function */ - voice->pan = x; - + case GEN_BALANCE: + /* range checking is done in the fluid_pan and fluid_balance functions */ + voice->pan = fluid_voice_gen_value(voice, GEN_PAN); + voice->balance = fluid_voice_gen_value(voice, GEN_BALANCE); + /* left amp */ - UPDATE_RVOICE_BUFFERS2(fluid_rvoice_buffers_set_amp, 0, fluid_voice_calculate_gain_amplitude(voice, fluid_pan(x, 1))); + UPDATE_RVOICE_BUFFERS2(fluid_rvoice_buffers_set_amp, 0, + fluid_voice_calculate_gain_amplitude(voice, + fluid_pan(voice->pan, 1) * fluid_balance(voice->balance, 1))); /* right amp */ - UPDATE_RVOICE_BUFFERS2(fluid_rvoice_buffers_set_amp, 1, fluid_voice_calculate_gain_amplitude(voice, fluid_pan(x, 0))); + UPDATE_RVOICE_BUFFERS2(fluid_rvoice_buffers_set_amp, 1, + fluid_voice_calculate_gain_amplitude(voice, + fluid_pan(voice->pan, 0) * fluid_balance(voice->balance, 0))); break; case GEN_ATTENUATION: @@ -1605,8 +1612,10 @@ int fluid_voice_set_gain(fluid_voice_t* voice, fluid_real_t gain) } voice->synth_gain = gain; - left = fluid_voice_calculate_gain_amplitude(voice, fluid_pan(voice->pan, 1)); - right = fluid_voice_calculate_gain_amplitude(voice, fluid_pan(voice->pan, 0)); + left = fluid_voice_calculate_gain_amplitude(voice, + fluid_pan(voice->pan, 1) * fluid_balance(voice->balance, 1)); + right = fluid_voice_calculate_gain_amplitude(voice, + fluid_pan(voice->pan, 0) * fluid_balance(voice->balance, 0)); reverb = fluid_voice_calculate_gain_amplitude(voice, voice->reverb_send); chorus = fluid_voice_calculate_gain_amplitude(voice, voice->chorus_send); diff --git a/src/synth/fluid_voice.h b/src/synth/fluid_voice.h index e42a8f59..3dcb9ecb 100644 --- a/src/synth/fluid_voice.h +++ b/src/synth/fluid_voice.h @@ -92,6 +92,9 @@ struct _fluid_voice_t /* pan */ fluid_real_t pan; + /* balance */ + fluid_real_t balance; + /* reverb */ fluid_real_t reverb_send; diff --git a/src/utils/fluid_conv.c b/src/utils/fluid_conv.c index ea69f101..76e41964 100644 --- a/src/utils/fluid_conv.c +++ b/src/utils/fluid_conv.c @@ -301,6 +301,41 @@ fluid_pan(fluid_real_t c, int left) } } +/* + * Return the amount of attenuation based on the balance for the specified + * channel. If balance is negative (turned toward left channel, only the right + * channel is attenuated. If balance is positive, only the left channel is + * attenuated. + * + * @params balance left/right balance, range [-1000;1000] in tens of percent + * @return amount of attenuation [0.0;1.0] + */ +fluid_real_t fluid_balance(fluid_real_t balance, int left) +{ + /* This is the most common case */ + if (balance == 0) + { + return 1.0f; + } + + if ((left && balance < 0) || (!left && balance > 0)) + { + return 1.0f; + } + + if (balance < 0) + { + balance = -balance; + } + + if (balance >= 1000) + { + return 0.0f; + } + + return 1.0f - balance * 0.001f; +} + /* * fluid_concave */ diff --git a/src/utils/fluid_conv.h b/src/utils/fluid_conv.h index 838b1496..1035039b 100644 --- a/src/utils/fluid_conv.h +++ b/src/utils/fluid_conv.h @@ -46,6 +46,7 @@ fluid_real_t fluid_tc2sec_release(fluid_real_t tc); fluid_real_t fluid_act2hz(fluid_real_t c); fluid_real_t fluid_hz2ct(fluid_real_t c); fluid_real_t fluid_pan(fluid_real_t c, int left); +fluid_real_t fluid_balance(fluid_real_t balance, int left); fluid_real_t fluid_concave(fluid_real_t val); fluid_real_t fluid_convex(fluid_real_t val); From ff3e918d47f34ede47604f5b1534a2c5530fd6c7 Mon Sep 17 00:00:00 2001 From: Marcus Weseloh Date: Wed, 3 Jan 2018 18:12:47 +0100 Subject: [PATCH 2/5] Use range with true center point for pan and balance As specified in MIDI Recommended Practice (RP-036) --- src/synth/fluid_mod.c | 21 ++++++++++++++++++++- src/utils/fluid_conv.c | 4 ++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/synth/fluid_mod.c b/src/synth/fluid_mod.c index 6b310202..41399380 100644 --- a/src/synth/fluid_mod.c +++ b/src/synth/fluid_mod.c @@ -172,7 +172,26 @@ fluid_mod_get_source_value(const unsigned char mod_src, if (mod_flags & FLUID_MOD_CC) { - val = fluid_channel_get_cc(chan, mod_src); + /* From MIDI Recommended Practice (RP-036) Default Pan Formula: + * "Since MIDI controller values range from 0 to 127, the exact center + * of the range, 63.5, cannot be represented. Therefore, the effective + * range for CC#10 is modified to be 1 to 127, and values 0 and 1 both + * pan hard left. The recommended method is to subtract 1 from the + * value of CC#10, and saturate the result to be non-negative." + * + * We treat the balance control in exactly the same way, as the same + * problem applies here as well. + */ + if (mod_src == PAN_MSB || mod_src == BALANCE_MSB) { + *range = 126; + val = fluid_channel_get_cc(chan, mod_src) - 1; + if (val < 0) { + val = 0; + } + } + else { + val = fluid_channel_get_cc(chan, mod_src); + } } else { diff --git a/src/utils/fluid_conv.c b/src/utils/fluid_conv.c index 76e41964..a5e8fbdb 100644 --- a/src/utils/fluid_conv.c +++ b/src/utils/fluid_conv.c @@ -292,9 +292,9 @@ fluid_pan(fluid_real_t c, int left) if (left) { c = -c; } - if (c < -500) { + if (c <= -500) { return (fluid_real_t) 0.0; - } else if (c > 500) { + } else if (c >= 500) { return (fluid_real_t) 1.0; } else { return fluid_pan_tab[(int) (c + 500)]; From 52cc645e7e10bc27f6618cba60ca0ff4181321f1 Mon Sep 17 00:00:00 2001 From: Marcus Weseloh Date: Thu, 4 Jan 2018 12:31:22 +0100 Subject: [PATCH 3/5] Rename default_balance_mod to custom_balance_mod --- src/synth/fluid_synth.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index c62210d8..eea6a4e2 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -138,7 +138,7 @@ static fluid_mod_t default_expr_mod; /* SF2.01 section 8.4.7 */ static fluid_mod_t default_reverb_mod; /* SF2.01 section 8.4.8 */ static fluid_mod_t default_chorus_mod; /* SF2.01 section 8.4.9 */ static fluid_mod_t default_pitch_bend_mod; /* SF2.01 section 8.4.10 */ -static fluid_mod_t default_balance_mod; /* Non-standard modulator */ +static fluid_mod_t custom_balance_mod; /* Non-standard modulator */ /* reverb presets */ static const fluid_revmodel_presets_t revmodel_preset[] = { @@ -412,15 +412,15 @@ fluid_synth_init(void) /* Non-standard MIDI continuous controller 8 to channel stereo balance */ - fluid_mod_set_source1(&default_balance_mod, BALANCE_MSB, /* Index=8 */ + fluid_mod_set_source1(&custom_balance_mod, BALANCE_MSB, /* Index=8 */ FLUID_MOD_CC /* CC=1 */ | FLUID_MOD_LINEAR /* type=0 */ | FLUID_MOD_BIPOLAR /* P=1 */ | FLUID_MOD_POSITIVE /* D=0 */ ); - fluid_mod_set_source2(&default_balance_mod, 0, 0); - fluid_mod_set_dest(&default_balance_mod, GEN_BALANCE); /* Destination: stereo balance */ - fluid_mod_set_amount(&default_balance_mod, 1000.0); /* Amount: 1000 tens of a percent */ + fluid_mod_set_source2(&custom_balance_mod, 0, 0); + fluid_mod_set_dest(&custom_balance_mod, GEN_BALANCE); /* Destination: stereo balance */ + fluid_mod_set_amount(&custom_balance_mod, 1000.0); /* Amount: 1000 tens of a percent */ } static FLUID_INLINE unsigned int fluid_synth_get_ticks(fluid_synth_t* synth) @@ -707,7 +707,7 @@ new_fluid_synth(fluid_settings_t *settings) fluid_synth_add_default_mod(synth, &default_reverb_mod, FLUID_SYNTH_ADD); fluid_synth_add_default_mod(synth, &default_chorus_mod, FLUID_SYNTH_ADD); fluid_synth_add_default_mod(synth, &default_pitch_bend_mod, FLUID_SYNTH_ADD); - fluid_synth_add_default_mod(synth, &default_balance_mod, FLUID_SYNTH_ADD); + fluid_synth_add_default_mod(synth, &custom_balance_mod, FLUID_SYNTH_ADD); /* Create and initialize the Fx unit.*/ fluid_settings_getint(settings, "synth.ladspa.active", &with_ladspa); From 2e4a517a3f1251b328f173d1ffa195f5a5ae3a72 Mon Sep 17 00:00:00 2001 From: Marcus Weseloh Date: Thu, 4 Jan 2018 15:27:57 +0100 Subject: [PATCH 4/5] Use absolute centibels for range of balance generator --- src/synth/fluid_gen.c | 2 +- src/synth/fluid_synth.c | 5 +++-- src/utils/fluid_conv.c | 9 ++------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/synth/fluid_gen.c b/src/synth/fluid_gen.c index a89127b7..d345c80a 100644 --- a/src/synth/fluid_gen.c +++ b/src/synth/fluid_gen.c @@ -86,7 +86,7 @@ static const fluid_gen_info_t fluid_gen_info[] = { { GEN_EXCLUSIVECLASS, 0, 0, 0.0f, 0.0f, 0.0f }, { GEN_OVERRIDEROOTKEY, 1, 0, 0.0f, 127.0f, -1.0f }, { GEN_PITCH, 1, 0, 0.0f, 127.0f, 0.0f }, - { GEN_BALANCE, 1, 0, -1000.0f, 1000.0f, 0.0f } + { GEN_BALANCE, 1, 0, -960.0f, 960.0f, 0.0f } }; diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index eea6a4e2..56ba3eef 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -414,13 +414,14 @@ fluid_synth_init(void) /* Non-standard MIDI continuous controller 8 to channel stereo balance */ fluid_mod_set_source1(&custom_balance_mod, BALANCE_MSB, /* Index=8 */ FLUID_MOD_CC /* CC=1 */ - | FLUID_MOD_LINEAR /* type=0 */ + | FLUID_MOD_CONCAVE /* type=1 */ | FLUID_MOD_BIPOLAR /* P=1 */ | FLUID_MOD_POSITIVE /* D=0 */ ); fluid_mod_set_source2(&custom_balance_mod, 0, 0); fluid_mod_set_dest(&custom_balance_mod, GEN_BALANCE); /* Destination: stereo balance */ - fluid_mod_set_amount(&custom_balance_mod, 1000.0); /* Amount: 1000 tens of a percent */ + /* Amount: 96 dB of attenuation (on the opposite channel) */ + fluid_mod_set_amount(&custom_balance_mod, 960.0); } static FLUID_INLINE unsigned int fluid_synth_get_ticks(fluid_synth_t* synth) diff --git a/src/utils/fluid_conv.c b/src/utils/fluid_conv.c index a5e8fbdb..ab8ad614 100644 --- a/src/utils/fluid_conv.c +++ b/src/utils/fluid_conv.c @@ -307,7 +307,7 @@ fluid_pan(fluid_real_t c, int left) * channel is attenuated. If balance is positive, only the left channel is * attenuated. * - * @params balance left/right balance, range [-1000;1000] in tens of percent + * @params balance left/right balance, range [-960;960] in absolute centibels * @return amount of attenuation [0.0;1.0] */ fluid_real_t fluid_balance(fluid_real_t balance, int left) @@ -328,12 +328,7 @@ fluid_real_t fluid_balance(fluid_real_t balance, int left) balance = -balance; } - if (balance >= 1000) - { - return 0.0f; - } - - return 1.0f - balance * 0.001f; + return fluid_cb2amp(balance); } /* From 297372d6d9116adb7659ea5e723aed7e44c7aa4a Mon Sep 17 00:00:00 2001 From: derselbst Date: Thu, 25 Jan 2018 20:39:11 +0100 Subject: [PATCH 5/5] rename GEN_BALANCE to GEN_CUSTOM_BALANCE --- include/fluidsynth/gen.h | 2 +- src/synth/fluid_gen.c | 2 +- src/synth/fluid_mod.c | 2 +- src/synth/fluid_synth.c | 2 +- src/synth/fluid_voice.c | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/fluidsynth/gen.h b/include/fluidsynth/gen.h index 056b67a8..1db86d26 100644 --- a/include/fluidsynth/gen.h +++ b/include/fluidsynth/gen.h @@ -99,7 +99,7 @@ enum fluid_gen_type { * is used, however, as the destination for the default pitch wheel * modulator. */ GEN_PITCH, /**< Pitch @note Not a real SoundFont generator */ - GEN_BALANCE, /**< Balance @note Not a real SoundFont generator */ + GEN_CUSTOM_BALANCE, /**< Balance @note Not a real SoundFont generator */ #ifndef __DOXYGEN__ GEN_LAST /**< @internal Value defines the count of generators (#fluid_gen_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ #endif diff --git a/src/synth/fluid_gen.c b/src/synth/fluid_gen.c index d345c80a..203e0f59 100644 --- a/src/synth/fluid_gen.c +++ b/src/synth/fluid_gen.c @@ -86,7 +86,7 @@ static const fluid_gen_info_t fluid_gen_info[] = { { GEN_EXCLUSIVECLASS, 0, 0, 0.0f, 0.0f, 0.0f }, { GEN_OVERRIDEROOTKEY, 1, 0, 0.0f, 127.0f, -1.0f }, { GEN_PITCH, 1, 0, 0.0f, 127.0f, 0.0f }, - { GEN_BALANCE, 1, 0, -960.0f, 960.0f, 0.0f } + { GEN_CUSTOM_BALANCE, 1, 0, -960.0f, 960.0f, 0.0f } }; diff --git a/src/synth/fluid_mod.c b/src/synth/fluid_mod.c index 41399380..99148708 100644 --- a/src/synth/fluid_mod.c +++ b/src/synth/fluid_mod.c @@ -516,7 +516,7 @@ void fluid_dump_modulator(fluid_mod_t * mod){ case GEN_CHORUSSEND: printf("Chorus send"); break; case GEN_REVERBSEND: printf("Reverb send"); break; case GEN_PAN: printf("pan"); break; - case GEN_BALANCE: printf("balance"); break; + case GEN_CUSTOM_BALANCE: printf("balance"); break; case GEN_ATTENUATION: printf("att"); break; default: printf("dest %i",dest); }; /* switch dest */ diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index 56ba3eef..b271a0c0 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -419,7 +419,7 @@ fluid_synth_init(void) | FLUID_MOD_POSITIVE /* D=0 */ ); fluid_mod_set_source2(&custom_balance_mod, 0, 0); - fluid_mod_set_dest(&custom_balance_mod, GEN_BALANCE); /* Destination: stereo balance */ + fluid_mod_set_dest(&custom_balance_mod, GEN_CUSTOM_BALANCE); /* Destination: stereo balance */ /* Amount: 96 dB of attenuation (on the opposite channel) */ fluid_mod_set_amount(&custom_balance_mod, 960.0); } diff --git a/src/synth/fluid_voice.c b/src/synth/fluid_voice.c index 07c60728..108e89e7 100644 --- a/src/synth/fluid_voice.c +++ b/src/synth/fluid_voice.c @@ -538,7 +538,7 @@ fluid_voice_calculate_runtime_synthesis_parameters(fluid_voice_t* voice) /* GEN_FINETUNE [1] #52 */ GEN_OVERRIDEROOTKEY, /* #58 */ GEN_PITCH, /* --- */ - GEN_BALANCE /* --- */ + GEN_CUSTOM_BALANCE /* --- */ }; /* When the voice is made ready for the synthesis process, a lot of @@ -692,10 +692,10 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen) switch (gen) { case GEN_PAN: - case GEN_BALANCE: + case GEN_CUSTOM_BALANCE: /* range checking is done in the fluid_pan and fluid_balance functions */ voice->pan = fluid_voice_gen_value(voice, GEN_PAN); - voice->balance = fluid_voice_gen_value(voice, GEN_BALANCE); + voice->balance = fluid_voice_gen_value(voice, GEN_CUSTOM_BALANCE); /* left amp */ UPDATE_RVOICE_BUFFERS2(fluid_rvoice_buffers_set_amp, 0,