summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-05-11 16:04:09 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-05-11 16:04:09 +0000
commit4d780bdcd0009943ec292dfd2177e60804d91245 (patch)
tree42dd75d632355ee48325fdec04c0744addf48ca6 /libs
parentb544f9c2db8874109010279d43ea774fa8e2748b (diff)
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
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/mackie/device_info.cc15
-rw-r--r--libs/surfaces/mackie/device_info.h2
-rw-r--r--libs/surfaces/mackie/surface.cc37
-rw-r--r--libs/surfaces/mackie/surface.h1
4 files changed, 49 insertions, 6 deletions
diff --git a/libs/surfaces/mackie/device_info.cc b/libs/surfaces/mackie/device_info.cc
index 12a6f90e5e..5646650eeb 100644
--- a/libs/surfaces/mackie/device_info.cc
+++ b/libs/surfaces/mackie/device_info.cc
@@ -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());
@@ -396,6 +405,12 @@ DeviceInfo::has_jog_wheel () const
}
bool
+DeviceInfo::no_handshake () const
+{
+ return _no_handshake;
+}
+
+bool
DeviceInfo::has_touch_sense_faders () const
{
return _has_touch_sense_faders;
diff --git a/libs/surfaces/mackie/device_info.h b/libs/surfaces/mackie/device_info.h
index 4366cd09b1..294bc091ed 100644
--- a/libs/surfaces/mackie/device_info.h
+++ b/libs/surfaces/mackie/device_info.h
@@ -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;
diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc
index 4d9ab3f877..7617156589 100644
--- a/libs/surfaces/mackie/surface.cc
+++ b/libs/surfaces/mackie/surface.cc
@@ -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*)
{
diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h
index f45a61ce6c..2034dd4096 100644
--- a/libs/surfaces/mackie/surface.h
+++ b/libs/surfaces/mackie/surface.h
@@ -174,6 +174,7 @@ public:
void init_strips (uint32_t n);
void setup_master ();
void master_gain_changed ();
+ void turn_it_on ();
};
}