13
0

MIDI polyphonic pressure, part 2

This commit is contained in:
Paul Davis 2016-08-18 12:35:15 -04:00
parent d6691a80e9
commit 26f1578568
7 changed files with 26 additions and 0 deletions

View File

@ -36,6 +36,7 @@ parameter_midi_type(AutomationType type)
case MidiCCAutomation: return MIDI_CMD_CONTROL; break;
case MidiPgmChangeAutomation: return MIDI_CMD_PGM_CHANGE; break;
case MidiChannelPressureAutomation: return MIDI_CMD_CHANNEL_PRESSURE; break;
case MidiNotePressureAutomation: return MIDI_CMD_NOTE_PRESSURE; break;
case MidiPitchBenderAutomation: return MIDI_CMD_BENDER; break;
case MidiSystemExclusiveAutomation: return MIDI_CMD_COMMON_SYSEX; break;
default: return 0;
@ -49,6 +50,7 @@ midi_parameter_type(uint8_t status)
case MIDI_CMD_CONTROL: return MidiCCAutomation; break;
case MIDI_CMD_PGM_CHANGE: return MidiPgmChangeAutomation; break;
case MIDI_CMD_CHANNEL_PRESSURE: return MidiChannelPressureAutomation; break;
case MIDI_CMD_NOTE_PRESSURE: return MidiNotePressureAutomation; break;
case MIDI_CMD_BENDER: return MidiPitchBenderAutomation; break;
case MIDI_CMD_COMMON_SYSEX: return MidiSystemExclusiveAutomation; break;
default: return NullAutomation;
@ -66,6 +68,8 @@ midi_parameter(const uint8_t* buf, const uint32_t len)
return Evoral::Parameter(MidiPgmChangeAutomation, channel);
case MidiChannelPressureAutomation:
return Evoral::Parameter(MidiChannelPressureAutomation, channel);
case MidiNotePressureAutomation:
return Evoral::Parameter(MidiChannelPressureAutomation, channel);
case MidiPitchBenderAutomation:
return Evoral::Parameter(MidiPitchBenderAutomation, channel);
case MidiSystemExclusiveAutomation:

View File

@ -146,6 +146,7 @@ namespace ARDOUR {
MidiPgmChangeAutomation,
MidiPitchBenderAutomation,
MidiChannelPressureAutomation,
MidiNotePressureAutomation,
MidiSystemExclusiveAutomation,
FadeInAutomation,
FadeOutAutomation,

View File

@ -186,6 +186,8 @@ Automatable::describe_parameter (Evoral::Parameter param)
return string_compose("Bender [%1]", int(param.channel()) + 1);
} else if (param.type() == MidiChannelPressureAutomation) {
return string_compose("Pressure [%1]", int(param.channel()) + 1);
} else if (param.type() == MidiNotePressureAutomation) {
return string_compose("PolyPressure [%1]", int(param.channel()) + 1);
#ifdef LV2_SUPPORT
} else if (param.type() == PluginPropertyAutomation) {
return string_compose("Property %1", URIMap::instance().id_to_uri(param.id()));

View File

@ -157,6 +157,7 @@ setup_enum_writer ()
REGISTER_ENUM (MidiPgmChangeAutomation);
REGISTER_ENUM (MidiPitchBenderAutomation);
REGISTER_ENUM (MidiChannelPressureAutomation);
REGISTER_ENUM (MidiNotePressureAutomation);
REGISTER_ENUM (MidiSystemExclusiveAutomation);
REGISTER_ENUM (FadeInAutomation);
REGISTER_ENUM (FadeOutAutomation);

View File

@ -115,6 +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 MidiPitchBenderAutomation: return Evoral::ControlList::Linear; break;
default: assert(false);
}
@ -192,6 +193,13 @@ EventTypeMap::from_symbol(const string& str) const
assert(channel < 16);
p_id = 0;
p_channel = channel;
} else if (str.length() > 19 && str.substr(0, 19) == "midi-note-pressure-") {
p_type = MidiNotePressureAutomation;
uint32_t channel = 0;
sscanf(str.c_str(), "midi-note-pressure-%d-%d", &channel, &p_id);
assert(channel < 16);
assert(p_id < 127);
p_channel = channel;
} else {
PBD::warning << "Unknown Parameter '" << str << "'" << endmsg;
}
@ -250,6 +258,8 @@ 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) {
return string_compose("midi-note-pressure-%1-%2", int(param.channel()), param.id());
} else {
PBD::warning << "Uninitialized Parameter symbol() called." << endmsg;
return "";

View File

@ -701,6 +701,7 @@ MidiTrack::set_parameter_automation_state (Evoral::Parameter param, AutoState st
case MidiPgmChangeAutomation:
case MidiPitchBenderAutomation:
case MidiChannelPressureAutomation:
case MidiNotePressureAutomation:
case MidiSystemExclusiveAutomation:
/* The track control for MIDI parameters is for immediate events to act
as a control surface, write/touch for them is not currently
@ -757,6 +758,12 @@ MidiTrack::MidiControl::actually_set_value (double val, PBD::Controllable::Group
ev[1] = int(val);
break;
case MidiNotePressureAutomation:
ev[0] += MIDI_CMD_NOTE_PRESSURE;
ev[1] = parameter.id();
ev[2] = int(val);
break;
case MidiPitchBenderAutomation:
ev[0] += MIDI_CMD_BENDER;
ev[1] = 0x7F & int(val);

View File

@ -96,6 +96,7 @@ ParameterDescriptor::ParameterDescriptor(const Evoral::Parameter& parameter)
case MidiCCAutomation:
case MidiPgmChangeAutomation:
case MidiChannelPressureAutomation:
case MidiNotePressureAutomation:
lower = 0.0;
normal = 0.0;
upper = 127.0;