13
0

MCP: connect to correct signal for buttons; more code tidy; extra debugging if we can't find a control

git-svn-id: svn://localhost/ardour2/branches/3.0@11836 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-04-08 20:52:45 +00:00
parent 6315a979a1
commit 696f3bdda5
2 changed files with 22 additions and 16 deletions

View File

@ -275,7 +275,7 @@ void MackiePort::connect_to_signals ()
/* V-Pot messages are Controller */ /* V-Pot messages are Controller */
p->controller.connect_same_thread (*this, boost::bind (&MackiePort::handle_midi_controller_message, this, _1, _2)); p->controller.connect_same_thread (*this, boost::bind (&MackiePort::handle_midi_controller_message, this, _1, _2));
/* Button messages are NoteOn */ /* Button messages are NoteOn */
p->controller.connect_same_thread (*this, boost::bind (&MackiePort::handle_midi_note_on_message, this, _1, _2)); p->note_on.connect_same_thread (*this, boost::bind (&MackiePort::handle_midi_note_on_message, this, _1, _2));
/* Fader messages are Pitchbend */ /* Fader messages are Pitchbend */
p->channel_pitchbend[0].connect_same_thread (*this, boost::bind (&MackiePort::handle_midi_pitchbend_message, this, _1, _2, 0U)); p->channel_pitchbend[0].connect_same_thread (*this, boost::bind (&MackiePort::handle_midi_pitchbend_message, this, _1, _2, 0U));
p->channel_pitchbend[1].connect_same_thread (*this, boost::bind (&MackiePort::handle_midi_pitchbend_message, this, _1, _2, 1U)); p->channel_pitchbend[1].connect_same_thread (*this, boost::bind (&MackiePort::handle_midi_pitchbend_message, this, _1, _2, 1U));
@ -340,6 +340,8 @@ MackiePort::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb,
if (control) { if (control) {
float midi_pos = pb >> 4; // only the top 10 bytes are used float midi_pos = pb >> 4; // only the top 10 bytes are used
_mcp.handle_control_event (*this, *control, midi_pos / 1023.0); _mcp.handle_control_event (*this, *control, midi_pos / 1023.0);
} else {
DEBUG_TRACE (DEBUG::MackieControl, "fader not found\n");
} }
} }
@ -354,6 +356,8 @@ MackiePort::handle_midi_note_on_message (MIDI::Parser &, MIDI::EventTwoBytes* ev
ControlState control_state (ev->velocity == 0x7f ? press : release); ControlState control_state (ev->velocity == 0x7f ? press : release);
control->set_in_use (control_state.button_state == press); control->set_in_use (control_state.button_state == press);
control_event (*this, *control, control_state); control_event (*this, *control, control_state);
} else {
DEBUG_TRACE (DEBUG::MackieControl, "button not found\n");
} }
} }
@ -387,6 +391,8 @@ MackiePort::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes*
_mcp.add_in_use_timeout (*this, *control, control); _mcp.add_in_use_timeout (*this, *control, control);
control_event (*this, *control, state); control_event (*this, *control, state);
} else {
DEBUG_TRACE (DEBUG::MackieControl, "pot not found\n");
} }
} }

View File

@ -1,19 +1,19 @@
/* /*
Copyright (C) 1998, 1999, 2000, 2007 John Anderson Copyright (C) 1998, 1999, 2000, 2007 John Anderson
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU Library General Public License You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef timer_h #ifndef timer_h