13
0

provide some support for mackie devices like Steinberg's CMCs that do not do the normal Mackie spec handshaking

git-svn-id: svn://localhost/ardour2/branches/3.0@12252 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-05-11 16:04:09 +00:00
parent b544f9c2db
commit 4d780bdcd0
4 changed files with 49 additions and 6 deletions

View File

@ -50,6 +50,7 @@ DeviceInfo::DeviceInfo()
, _has_touch_sense_faders (true)
, _uses_logic_control_buttons (false)
, _uses_ipmidi (false)
, _no_handshake (false)
, _name (X_("Mackie Control Universal Pro"))
{
mackie_control_buttons ();
@ -281,6 +282,14 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */)
_uses_ipmidi = false;
}
if ((child = node.child ("NoHandShake")) != 0) {
if ((prop = child->property ("value")) != 0) {
_no_handshake = string_is_affirmative (prop->value());
}
} else {
_no_handshake = false;
}
if ((child = node.child ("LogicControlButtons")) != 0) {
if ((prop = child->property ("value")) != 0) {
_uses_logic_control_buttons = string_is_affirmative (prop->value());
@ -395,6 +404,12 @@ DeviceInfo::has_jog_wheel () const
return _has_jog_wheel;
}
bool
DeviceInfo::no_handshake () const
{
return _no_handshake;
}
bool
DeviceInfo::has_touch_sense_faders () const
{

View File

@ -67,6 +67,7 @@ class DeviceInfo
bool has_jog_wheel () const;
bool has_touch_sense_faders() const;
bool uses_ipmidi() const;
bool no_handshake() const;
const std::string& name() const;
static std::map<std::string,DeviceInfo> device_info;
@ -86,6 +87,7 @@ class DeviceInfo
bool _has_touch_sense_faders;
bool _uses_logic_control_buttons;
bool _uses_ipmidi;
bool _no_handshake;
std::string _name;
std::map<Button::ID,GlobalButtonInfo> _global_buttons;

View File

@ -299,9 +299,14 @@ Surface::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb, uin
* when we connected to the per-channel pitchbend events.
*/
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi pitchbend on port %3, fader = %1 value = %2\n",
fader_id, pb, _number));
if (_mcp.device_info().no_handshake()) {
turn_it_on ();
}
Fader* fader = faders[fader_id];
if (fader) {
@ -324,6 +329,10 @@ Surface::handle_midi_note_on_message (MIDI::Parser &, MIDI::EventTwoBytes* ev)
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("SurfacePort::handle_note_on %1 = %2\n", (int) ev->note_number, (int) ev->velocity));
if (_mcp.device_info().no_handshake()) {
turn_it_on ();
}
Button* button = buttons[ev->note_number];
if (button) {
@ -348,6 +357,10 @@ Surface::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes* ev
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("SurfacePort::handle_midi_controller %1 = %2\n", (int) ev->controller_number, (int) ev->value));
if (_mcp.device_info().no_handshake()) {
turn_it_on ();
}
Pot* pot = pots[ev->controller_number];
// bit 6 gives the sign
@ -387,6 +400,10 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
if (_mcp.device_info().no_handshake()) {
turn_it_on ();
}
/* always save the device type ID so that our outgoing sysex messages
* are correct
*/
@ -406,12 +423,7 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count
write_sysex (host_connection_query (bytes));
} else {
if (!_active) {
_active = true;
zero_controls ();
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
(*s)->notify_all ();
}
update_view_mode_display ();
turn_it_on ();
}
}
break;
@ -493,6 +505,19 @@ Surface::host_connection_confirmation (const MidiByteArray & bytes)
return MidiByteArray (2, 0x13, 0x00);
}
void
Surface::turn_it_on ()
{
if (!_active) {
_active = true;
zero_controls ();
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
(*s)->notify_all ();
}
update_view_mode_display ();
}
}
void
Surface::handle_port_inactive (SurfacePort*)
{

View File

@ -174,6 +174,7 @@ public:
void init_strips (uint32_t n);
void setup_master ();
void master_gain_changed ();
void turn_it_on ();
};
}