summaryrefslogtreecommitdiff
path: root/libs/surfaces/mackie/surface_port.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-10-11 11:58:00 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-10-11 12:01:27 -0400
commitf8875df18fba0604ba54b51c7cc8d9ae87c55ce6 (patch)
treed76cdfec8f307a49cb24e624c23b830b0d7925c4 /libs/surfaces/mackie/surface_port.cc
parent6faec91dd97d2b56552e4a3e99f36dca3388b70b (diff)
Several changes to Mackie support. Breaks existing Mackie state on disk but not
in any way that causes problems, just loss of pre-existing connectivity. 1. retain state of current device (and serialize to disk) when switching devices, and restore that state when switching back to it. 2. fix port and surfacenaming. 3. fix bundle assembly so that all ports (for multi-surface combos) work. 4. rationalize master position numbering 5. add small sleep before starting device handshake after reconnection. This is ugly but seems to be necessary, unfortunately.
Diffstat (limited to 'libs/surfaces/mackie/surface_port.cc')
-rw-r--r--libs/surfaces/mackie/surface_port.cc51
1 files changed, 35 insertions, 16 deletions
diff --git a/libs/surfaces/mackie/surface_port.cc b/libs/surfaces/mackie/surface_port.cc
index 50bb206cdf..6f243a5444 100644
--- a/libs/surfaces/mackie/surface_port.cc
+++ b/libs/surfaces/mackie/surface_port.cc
@@ -58,8 +58,24 @@ SurfacePort::SurfacePort (Surface& s)
} else {
- _async_in = AudioEngine::instance()->register_input_port (DataType::MIDI, string_compose (_("%1 in"), _surface->name()), true);
- _async_out = AudioEngine::instance()->register_output_port (DataType::MIDI, string_compose (_("%1 out"), _surface->name()), true);
+ string in_name;
+ string out_name;
+
+ if (_surface->mcp().device_info().extenders() > 0) {
+ if (_surface->number() + 1 == _surface->mcp().device_info().master_position()) {
+ in_name = X_("mackie control in");
+ out_name = X_("mackie control out");
+ } else {
+ in_name = string_compose (X_("mackie control in ext %1"), _surface->number());
+ out_name = string_compose (X_("mackie control out ext %1"), _surface->number());
+ }
+ } else {
+ in_name = X_("mackie control in");
+ out_name = X_("mackie control out");
+ }
+
+ _async_in = AudioEngine::instance()->register_input_port (DataType::MIDI, in_name, true);
+ _async_out = AudioEngine::instance()->register_output_port (DataType::MIDI, out_name, true);
if (_async_in == 0 || _async_out == 0) {
throw failed_constructor();
@@ -121,29 +137,33 @@ SurfacePort::set_state (const XMLNode& node, int version)
if (dynamic_cast<MIDI::IPMIDIPort*>(_input_port)) {
return 0;
}
- // the rest should not be run if the device-name changes outside of a session load.
- if ( _surface->mcp().session_load()) {
- XMLNode* child;
+ XMLNode* child;
- if ((child = node.child (X_("Input"))) != 0) {
- XMLNode* portnode = child->child (Port::state_node_name.c_str());
- if (portnode) {
- _async_in->set_state (*portnode, version);
- }
+ if ((child = node.child (X_("Input"))) != 0) {
+ XMLNode* portnode = child->child (Port::state_node_name.c_str());
+ if (portnode) {
+ _async_in->set_state (*portnode, version);
}
+ }
- if ((child = node.child (X_("Output"))) != 0) {
- XMLNode* portnode = child->child (Port::state_node_name.c_str());
- if (portnode) {
- _async_out->set_state (*portnode, version);
- }
+ if ((child = node.child (X_("Output"))) != 0) {
+ XMLNode* portnode = child->child (Port::state_node_name.c_str());
+ if (portnode) {
+ _async_out->set_state (*portnode, version);
}
}
return 0;
}
+void
+SurfacePort::reconnect ()
+{
+ _async_out->reconnect ();
+ _async_in->reconnect ();
+}
+
std::string
SurfacePort::input_name () const
{
@@ -211,4 +231,3 @@ Mackie::operator << (ostream & os, const SurfacePort & port)
os << " }";
return os;
}
-