Fix Portamento FromKey issue

This commit is contained in:
derselbst 2022-02-25 18:26:43 +01:00
parent ea9758a2ed
commit 62ed1c813d
2 changed files with 11 additions and 4 deletions

View file

@ -162,9 +162,10 @@ fluid_channel_init_ctrl(fluid_channel_t *chan, int is_all_ctrl_off)
fluid_channel_set_cc(chan, i, 0);
}
fluid_channel_clear_portamento(chan); /* Clear PTC receive */
chan->previous_cc_breath = 0;/* Reset previous breath */
}
/* Unconditionally clear PTC receive (issue #1050) */
fluid_channel_clear_portamento(chan);
/* Reset polyphonic key pressure on all voices */
for(i = 0; i < 128; i++)

View file

@ -184,6 +184,8 @@ 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
@ -197,16 +199,20 @@ fluid_mod_get_source_value(const unsigned char mod_src,
if(mod_src == PAN_MSB || mod_src == BALANCE_MSB)
{
*range = 126;
val = fluid_channel_get_cc(chan, mod_src) - 1;
val -= 1;
if(val < 0)
{
val = 0;
}
}
else
else if(mod_src == PORTAMENTO_CTRL)
{
val = fluid_channel_get_cc(chan, mod_src);
// an invalid portamento fromkey should be treated as 0 when it's actually used for moulating
if(!fluid_channel_is_valid_note(val))
{
val = 0;
}
}
}
else