13
0

Fix loading, recording & saving MIDI with PolyKeyPressure events.

GUI still does not handle this (neither automation lane, nor List Editor),
but the file loads, plays and exports correctly.
This commit is contained in:
Robin Gareus 2016-11-27 17:25:42 +01:00
parent 9bf4f339b9
commit 2f30d763ed
2 changed files with 16 additions and 2 deletions

View File

@ -115,7 +115,7 @@ EventTypeMap::interpolation_of(const Evoral::Parameter& param)
break;
case MidiPgmChangeAutomation: return Evoral::ControlList::Discrete; break;
case MidiChannelPressureAutomation: return Evoral::ControlList::Linear; break;
case MidiNotePressureAutomation: return Evoral::ControlList::Linear; break;
case MidiNotePressureAutomation: return Evoral::ControlList::Linear; break;
case MidiPitchBenderAutomation: return Evoral::ControlList::Linear; break;
default: assert(false);
}
@ -258,7 +258,7 @@ EventTypeMap::to_symbol(const Evoral::Parameter& param) const
return string_compose("midi-pitch-bender-%1", int(param.channel()));
} else if (t == MidiChannelPressureAutomation) {
return string_compose("midi-channel-pressure-%1", int(param.channel()));
} else if (t == MidiChannelPressureAutomation) {
} else if (t == MidiNotePressureAutomation) {
return string_compose("midi-note-pressure-%1-%2", int(param.channel()), param.id());
} else {
PBD::warning << "Uninitialized Parameter symbol() called." << endmsg;

View File

@ -337,6 +337,7 @@ Sequence<Time>::const_iterator::operator++()
|| ev.is_pgm_change()
|| ev.is_pitch_bender()
|| ev.is_channel_pressure()
|| ev.is_poly_pressure()
|| ev.is_sysex()) ) {
cerr << "WARNING: Unknown event (type " << _type << "): " << hex
<< int(ev.buffer()[0]) << int(ev.buffer()[1]) << int(ev.buffer()[2]) << endl;
@ -573,6 +574,19 @@ Sequence<Time>::control_to_midi_event(
ev->buffer()[2] = (uint16_t(iter.y) >> 7) & 0x7F; // MSB
break;
case MIDI_CMD_NOTE_PRESSURE:
assert(iter.list.get());
assert(iter.list->parameter().channel() < 16);
assert(iter.list->parameter().id() <= INT8_MAX);
assert(iter.y <= INT8_MAX);
ev->set_time(Time(iter.x));
ev->realloc(3);
ev->buffer()[0] = MIDI_CMD_NOTE_PRESSURE + iter.list->parameter().channel();
ev->buffer()[1] = (uint8_t)iter.list->parameter().id();
ev->buffer()[2] = (uint8_t)iter.y;
break;
case MIDI_CMD_CHANNEL_PRESSURE:
assert(iter.list.get());
assert(iter.list->parameter().channel() < 16);