@@ 138,6 138,7 @@ struct _plughandle_t {
uint16_t rpn_lsb [0x10];
uint16_t rpn_msb [0x10];
uint16_t data_lsb [0x10];
+ uint16_t data_msb [0x10];
uint16_t gain [0x10];
uint16_t pressure [0x10];
uint16_t timbre [0x10];
@@ 698,6 699,19 @@ _update_frequency(plughandle_t *handle, dsp_t *dsp, uint8_t chn)
}
static inline void
+_update_bend_range(plughandle_t *handle, dsp_t *dsp, uint8_t chn)
+{
+ if( (handle->rpn_msb[chn] == 0x0) && (handle->rpn_lsb[chn] == 0x0) )
+ {
+ const uint8_t semi = handle->data_msb[chn];
+ const uint8_t cent = handle->data_lsb[chn];
+
+ handle->range[chn] = (float)semi + cent*0.01f;
+ _update_frequency(handle, dsp, chn);
+ }
+}
+
+static inline void
_update_gain(plughandle_t *handle, dsp_t *dsp, uint8_t chn)
{
VOICE_FOREACH(dsp, voice)
@@ 969,24 983,22 @@ _handle_midi(plughandle_t *handle, dsp_t *dsp,
case LV2_MIDI_CTL_LSB_DATA_ENTRY:
{
handle->data_lsb[chn] = val;
+
+ _update_bend_range(handle, dsp, chn);
} break;
case LV2_MIDI_CTL_MSB_DATA_ENTRY:
{
- // pitch-bend range
- if( (handle->rpn_msb[chn] == 0x0) && (handle->rpn_lsb[chn] == 0x0) )
- {
- const uint8_t semi = val;
- const uint8_t cent = handle->data_lsb[chn];
+ handle->data_msb[chn] = val;
- handle->range[chn] = (float)semi + cent*0.01f;
- _update_frequency(handle, dsp, chn);
- }
+ _update_bend_range(handle, dsp, chn);
} break;
case LV2_MIDI_CTL_LSB_MAIN_VOLUME:
{
handle->gain[chn] &= 0x7f;
handle->gain[chn] |= val;
+
+ _update_gain(handle, dsp, chn);
} break;
case LV2_MIDI_CTL_MSB_MAIN_VOLUME:
{
@@ 999,6 1011,8 @@ _handle_midi(plughandle_t *handle, dsp_t *dsp,
{
handle->pressure[chn] &= 0x7f;
handle->pressure[chn] |= val;
+
+ _update_pressure(handle, dsp, chn);
} break;
case LV2_MIDI_CTL_SC1_SOUND_VARIATION:
{
@@ 1011,6 1025,8 @@ _handle_midi(plughandle_t *handle, dsp_t *dsp,
{
handle->timbre[chn] &= 0x7f;
handle->timbre[chn] |= val;
+
+ _update_timbre(handle, dsp, chn);
} break;
case LV2_MIDI_CTL_SC5_BRIGHTNESS:
{