From af5a5a3d9d04c2c1f4c6ac8def183623b71ba106 Mon Sep 17 00:00:00 2001 From: Hanspeter Portner Date: Tue, 10 Aug 2021 22:47:28 +0200 Subject: [PATCH] dsp: properly parse 14bit data entry. --- VERSION | 2 +- pianoteq_utils_demo_unmute.c | 36 ++++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/VERSION b/VERSION index 962d1c1..ef2f8c8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.81 +0.1.87 diff --git a/pianoteq_utils_demo_unmute.c b/pianoteq_utils_demo_unmute.c index b10f56d..d1be037 100644 --- a/pianoteq_utils_demo_unmute.c +++ b/pianoteq_utils_demo_unmute.c @@ -285,6 +285,25 @@ connect_port(LV2_Handle instance, uint32_t port, void *data) } } +static void +_update_bend_range(plughandle_t *handle, int64_t frames) +{ + if(handle->rpn == 0x0) // set bend range + { + const uint32_t semi = handle->data >> 7; + const uint32_t cent = handle->data & 0x7f; + + handle->state.bend_range = semi * 100 + cent; + + const LV2_URID bend_range_urid = props_map(&handle->props, + PIANOTEQ_UTILS__bendRange); + props_set(&handle->props, &handle->notify.forge, frames, + bend_range_urid, &handle->notify.ref); + + _bender(handle, frames); + } +} + static inline int _handle_midi(plughandle_t *handle, int64_t frames, const uint8_t *msg) { @@ -354,26 +373,15 @@ _handle_midi(plughandle_t *handle, int64_t frames, const uint8_t *msg) { handle->data &= ~0x7f; handle->data |= val; + + _update_bend_range(handle, frames); } break; case LV2_MIDI_CTL_MSB_DATA_ENTRY: { handle->data &= ~0x3f80; handle->data |= val << 7; - if(handle->rpn == 0x0) // set bend range - { - const uint32_t semi = handle->data >> 7; - const uint32_t cent = handle->data & 0x7f; - - handle->state.bend_range = semi * 100 + cent; - - const LV2_URID bend_range_urid = props_map(&handle->props, - PIANOTEQ_UTILS__bendRange); - props_set(&handle->props, &handle->notify.forge, frames, - bend_range_urid, &handle->notify.ref); - - _bender(handle, frames); - } + _update_bend_range(handle, frames); } break; case LV2_MIDI_CTL_SUSTAIN: { -- 2.38.5