Generic MIDI: do not send touch events for all mapped controlers

Previously a start-touch was sent for any bound MIDI
Controllable on each incoming MIDI Control event.
This commit is contained in:
Robin Gareus 2024-09-24 16:10:07 +02:00
parent d3f536a7ff
commit 72cac07ae7
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -327,6 +327,10 @@ MIDIControllable::midi_sense_note (Parser &, EventTwoBytes *msg, bool /*is_on*/)
void void
MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg) MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg)
{ {
if (control_additional != msg->controller_number) {
return;
}
if (!_controllable) { if (!_controllable) {
if (lookup_controllable ()) { if (lookup_controllable ()) {
return; return;
@ -337,8 +341,6 @@ MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg)
_surface->maybe_start_touch (_controllable); _surface->maybe_start_touch (_controllable);
if (control_additional == msg->controller_number) {
if (!_controllable->is_toggle()) { if (!_controllable->is_toggle()) {
if (get_encoder() == No_enc) { if (get_encoder() == No_enc) {
float new_value = msg->value; float new_value = msg->value;
@ -443,11 +445,14 @@ MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg)
} }
} }
} }
}
void void
MIDIControllable::midi_sense_program_change (Parser &, MIDI::byte msg) MIDIControllable::midi_sense_program_change (Parser &, MIDI::byte msg)
{ {
if (msg != control_additional) {
return;
}
if (!_controllable) { if (!_controllable) {
if (lookup_controllable ()) { if (lookup_controllable ()) {
return; return;
@ -458,8 +463,6 @@ MIDIControllable::midi_sense_program_change (Parser &, MIDI::byte msg)
_surface->maybe_start_touch (_controllable); _surface->maybe_start_touch (_controllable);
if (msg == control_additional) {
if (!_controllable->is_toggle()) { if (!_controllable->is_toggle()) {
_controllable->set_value (1.0, Controllable::UseGroup); _controllable->set_value (1.0, Controllable::UseGroup);
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value 1.0 %3\n", (int) msg, current_uri() )); DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value 1.0 %3\n", (int) msg, current_uri() ));
@ -468,7 +471,6 @@ MIDIControllable::midi_sense_program_change (Parser &, MIDI::byte msg)
_controllable->set_value (new_value, Controllable::UseGroup); _controllable->set_value (new_value, Controllable::UseGroup);
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value %2 %3\n", (int) msg, (float) new_value, current_uri())); DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("MIDI program %1 value %2 %3\n", (int) msg, (float) new_value, current_uri()));
} }
}
last_value = (MIDI::byte) (_controllable->get_value() * 127.0); // to prevent feedback fights last_value = (MIDI::byte) (_controllable->get_value() * 127.0); // to prevent feedback fights
} }