mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 20:56:28 +01:00
generic MIDI: put controllables into touch mode (if appropriate) when data is received
This commit is contained in:
parent
93192705bd
commit
93f837b43e
4 changed files with 23 additions and 5 deletions
|
|
@ -1258,3 +1258,15 @@ GenericMidiControlProtocol::input_port() const
|
||||||
{
|
{
|
||||||
return _input_port;
|
return _input_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GenericMidiControlProtocol::maybe_start_touch (Controllable* controllable)
|
||||||
|
{
|
||||||
|
AutomationControl *actl = dynamic_cast<AutomationControl*> (controllable);
|
||||||
|
if (actl) {
|
||||||
|
if (actl->automation_state() == Touch && !actl->touching()) {
|
||||||
|
actl->start_touch (session->audible_frame ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
|
||||||
|
|
||||||
boost::shared_ptr<PBD::Controllable> lookup_controllable (const ARDOUR::ControllableDescriptor&) const;
|
boost::shared_ptr<PBD::Controllable> lookup_controllable (const ARDOUR::ControllableDescriptor&) const;
|
||||||
|
|
||||||
|
void maybe_start_touch (PBD::Controllable*);
|
||||||
|
|
||||||
XMLNode& get_state ();
|
XMLNode& get_state ();
|
||||||
int set_state (const XMLNode&, int version);
|
int set_state (const XMLNode&, int version);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,6 +280,8 @@ MIDIControllable::midi_sense_note (Parser &, EventTwoBytes *msg, bool /*is_on*/)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_surface->maybe_start_touch (controllable);
|
||||||
|
|
||||||
if (!controllable->is_toggle()) {
|
if (!controllable->is_toggle()) {
|
||||||
if (control_additional == msg->note_number) {
|
if (control_additional == msg->note_number) {
|
||||||
controllable->set_value (midi_to_control (msg->velocity), Controllable::NoGroup);
|
controllable->set_value (midi_to_control (msg->velocity), Controllable::NoGroup);
|
||||||
|
|
@ -307,9 +309,7 @@ MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg)
|
||||||
|
|
||||||
assert (controllable);
|
assert (controllable);
|
||||||
|
|
||||||
if (controllable->touching()) {
|
_surface->maybe_start_touch (controllable);
|
||||||
return; // to prevent feedback fights when e.g. dragging a UI slider
|
|
||||||
}
|
|
||||||
|
|
||||||
if (control_additional == msg->controller_number) {
|
if (control_additional == msg->controller_number) {
|
||||||
|
|
||||||
|
|
@ -411,6 +411,9 @@ MIDIControllable::midi_sense_program_change (Parser &, MIDI::byte msg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_surface->maybe_start_touch (controllable);
|
||||||
|
|
||||||
if (msg == control_additional) {
|
if (msg == control_additional) {
|
||||||
|
|
||||||
if (!controllable->is_toggle()) {
|
if (!controllable->is_toggle()) {
|
||||||
|
|
@ -435,6 +438,8 @@ MIDIControllable::midi_sense_pitchbend (Parser &, pitchbend_t pb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_surface->maybe_start_touch (controllable);
|
||||||
|
|
||||||
if (!controllable->is_toggle()) {
|
if (!controllable->is_toggle()) {
|
||||||
controllable->set_value (midi_to_control (pb), Controllable::NoGroup);
|
controllable->set_value (midi_to_control (pb), Controllable::NoGroup);
|
||||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI pitchbend %1 value %2 %3\n", (int) control_channel, (float) midi_to_control (pb), current_uri() ));
|
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI pitchbend %1 value %2 %3\n", (int) control_channel, (float) midi_to_control (pb), current_uri() ));
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ class MIDIControllable : public PBD::Stateful
|
||||||
std::string _what;
|
std::string _what;
|
||||||
bool _bank_relative;
|
bool _bank_relative;
|
||||||
|
|
||||||
void drop_controllable (PBD::Controllable*);
|
void drop_controllable (PBD::Controllable*);
|
||||||
|
|
||||||
void midi_receiver (MIDI::Parser &p, MIDI::byte *, size_t);
|
void midi_receiver (MIDI::Parser &p, MIDI::byte *, size_t);
|
||||||
void midi_sense_note (MIDI::Parser &, MIDI::EventTwoBytes *, bool is_on);
|
void midi_sense_note (MIDI::Parser &, MIDI::EventTwoBytes *, bool is_on);
|
||||||
|
|
@ -152,7 +152,6 @@ class MIDIControllable : public PBD::Stateful
|
||||||
void rpn_value_change (MIDI::Parser&, uint16_t nrpn, float val);
|
void rpn_value_change (MIDI::Parser&, uint16_t nrpn, float val);
|
||||||
void rpn_change (MIDI::Parser&, uint16_t nrpn, int direction);
|
void rpn_change (MIDI::Parser&, uint16_t nrpn, int direction);
|
||||||
void nrpn_change (MIDI::Parser&, uint16_t nrpn, int direction);
|
void nrpn_change (MIDI::Parser&, uint16_t nrpn, int direction);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __gm_midicontrollable_h__
|
#endif // __gm_midicontrollable_h__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue