, _master_fader (0)
, _last_master_gain_written (-0.0f)
, connection_state (0)
+ , input_source (0)
{
DEBUG_TRACE (DEBUG::MackieControl, "Surface::Surface init\n");
DEBUG_TRACE (DEBUG::MackieControl, "init_strips done\n");
}
- /*
- */
+ if (!_mcp.device_info().uses_ipmidi()) {
+ ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&Surface::connection_handler, this, _1, _2, _3, _4, _5), &_mcp);
+ } else {
+ /* ipMIDI port already exists, we can just assume that we're
+ * connected.
+ *
+ * If the user still hasn't connected the ipMIDI surface and/or
+ * turned it on, then they have to press "Discover Mackie
+ * Devices" in the GUI at the right time.
+ */
- ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&Surface::connection_handler, this, _1, _2, _3, _4, _5), &_mcp);
+ connection_state |= (InputConnected|OutputConnected);
+ connected ();
+ }
connect_to_signals ();
delete *it;
}
+ port_connection.disconnect ();
+
+ if (input_source) {
+ g_source_destroy (input_source);
+ input_source = 0;
+ }
+
delete _jog_wheel;
delete _port;
void
Surface::connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn)
{
+ if (!_port) {
+ return;
+ }
+
string ni = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (_port->input_name());
string no = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (_port->output_name());