aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--mephisto.c36
2 files changed, 35 insertions, 3 deletions
diff --git a/VERSION b/VERSION
index a1338f8..ae4f8fa 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.17.9
+0.17.11
diff --git a/mephisto.c b/mephisto.c
index bfb86e7..2e6583b 100644
--- a/mephisto.c
+++ b/mephisto.c
@@ -245,6 +245,7 @@ struct _plughandle_t {
uint16_t data_msb [0x10];
uint16_t pressure [0x10];
uint16_t timbre [0x10];
+ uint8_t mpe_plus_lsb [0x10];
float bend [0x10];
float range [0x10];
bool sustain [0x10];
@@ -1357,11 +1358,26 @@ _voice_off_force(voice_t *voice)
voice->state = VOICE_STATE_INACTIVE;
}
+static inline void
+_mpe_plus_lsb(plughandle_t *handle, uint8_t chn, uint16_t *tar)
+{
+ const uint8_t lsb = handle->mpe_plus_lsb[chn];
+
+ if(lsb)
+ {
+ *tar &= ~0x7f;
+ *tar |= lsb;
+ }
+
+ handle->mpe_plus_lsb[chn] = 0x0; // always clear register after usage
+}
+
static void
-_handle_midi_2(dsp_t *dsp,
+_handle_midi_2(plughandle_t *handle, dsp_t *dsp,
int64_t frames __attribute__((unused)), const uint8_t *msg)
{
const uint8_t cmd = msg[0] & 0xf0;
+ const uint8_t chn = msg[0] & 0x0f;
if(!dsp || !dsp->is_instrument || !dsp->midi_on)
{
@@ -1370,6 +1386,14 @@ _handle_midi_2(dsp_t *dsp,
switch(cmd)
{
+ case LV2_MIDI_MSG_CHANNEL_PRESSURE:
+ {
+ handle->pressure[chn] = msg[1] << 7;
+
+ _mpe_plus_lsb(handle, chn, &handle->pressure[chn]);
+
+ _update_pressure(handle, dsp, chn);
+ } break;
case LV2_MIDI_MSG_CONTROLLER:
{
const uint8_t ctr = msg[1];
@@ -1530,6 +1554,8 @@ _handle_midi_3(plughandle_t *handle, dsp_t *dsp,
handle->pressure[chn] &= ~0x3f80;
handle->pressure[chn] |= val << 7;
+ _mpe_plus_lsb(handle, chn, &handle->pressure[chn]);
+
_update_pressure(handle, dsp, chn);
} break;
case LV2_MIDI_CTL_SC5_BRIGHTNESS | 0x20: // LSB
@@ -1544,8 +1570,14 @@ _handle_midi_3(plughandle_t *handle, dsp_t *dsp,
handle->timbre[chn] &= ~0x3f80;
handle->timbre[chn] |= val << 7;
+ _mpe_plus_lsb(handle, chn, &handle->timbre[chn]);
+
_update_timbre(handle, dsp, chn);
} break;
+ case 0x57: // MPE+ LSB according to Haken Audio
+ {
+ handle->mpe_plus_lsb[chn] = val;
+ } break;
}
} break;
}
@@ -1559,7 +1591,7 @@ _handle_midi(plughandle_t *handle, dsp_t *dsp,
{
case 2:
{
- _handle_midi_2(dsp, frames, msg);
+ _handle_midi_2(handle, dsp, frames, msg);
} break;
case 3:
{