13
0

properly handle FS pitch-bend - closes #7140

This commit is contained in:
Robin Gareus 2016-11-28 12:53:20 +01:00
parent bf15e93cde
commit 7b687d08a1
2 changed files with 13 additions and 2 deletions

View File

@ -135,7 +135,12 @@ FluidSynth::midi_event (uint8_t const* const data, size_t len)
fluid_midi_event_set_key (_f_midi_event, data[1]);
}
if (len > 2) {
fluid_midi_event_set_value (_f_midi_event, data[2]);
if (0xe0 /*PITCH_BEND*/ == fluid_midi_event_get_type (_f_midi_event)) {
fluid_midi_event_set_value (_f_midi_event, 0);
fluid_midi_event_set_pitch (_f_midi_event, ((data[2] & 0x7f) << 7) | (data[1] & 0x7f));
} else {
fluid_midi_event_set_value (_f_midi_event, data[2]);
}
}
return FLUID_OK == fluid_synth_handle_midi_event (_synth, _f_midi_event);
}

View File

@ -446,8 +446,14 @@ run (LV2_Handle instance, uint32_t n_samples)
fluid_midi_event_set_key (self->fmidi_event, data[1]);
}
if (ev->body.size > 2) {
fluid_midi_event_set_value (self->fmidi_event, data[2]);
if (0xe0 /*PITCH_BEND*/ == fluid_midi_event_get_type (self->fmidi_event)) {
fluid_midi_event_set_value (self->fmidi_event, 0);
fluid_midi_event_set_pitch (self->fmidi_event, ((data[2] & 0x7f) << 7) | (data[1] & 0x7f));
} else {
fluid_midi_event_set_value (self->fmidi_event, data[2]);
}
}
fluid_synth_handle_midi_event (self->synth, self->fmidi_event);
}
}