13
0

Prevents a master fader being created without a control at Surface::setup_master_fader;

Several DEBUG_TRACE changes to help identify race conditions;

git-svn-id: svn://localhost/ardour2/branches/3.0@12693 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Rodrigo Severo 2012-06-13 03:07:50 +00:00
parent 5573b6a049
commit 335bf3d21e
2 changed files with 25 additions and 11 deletions

View File

@ -124,18 +124,22 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
MackieControlProtocol::~MackieControlProtocol()
{
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::~MackieControlProtocol\n");
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::~MackieControlProtocol init\n");
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::~MackieControlProtocol drop_connections ()\n");
drop_connections ();
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::~MackieControlProtocol tear_down_gui ()\n");
tear_down_gui ();
_active = false;
/* stop event loop */
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::~MackieControlProtocol BaseUI::quit ()\n");
BaseUI::quit ();
try {
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::~MackieControlProtocol close()\n");
close();
}
catch (exception & e) {
@ -145,9 +149,9 @@ MackieControlProtocol::~MackieControlProtocol()
cout << "~MackieControlProtocol caught unknown" << endl;
}
DEBUG_TRACE (DEBUG::MackieControl, "finished ~MackieControlProtocol::MackieControlProtocol\n");
_instance = 0;
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::~MackieControlProtocol done\n");
}
void
@ -371,6 +375,8 @@ MackieControlProtocol::switch_banks (uint32_t initial, bool force)
int
MackieControlProtocol::set_active (bool yn)
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose("MackieControlProtocol::set_active init with yn: '%1'\n", yn));
if (yn == _active) {
return 0;
}
@ -401,6 +407,8 @@ MackieControlProtocol::set_active (bool yn)
}
DEBUG_TRACE (DEBUG::MackieControl, string_compose("MackieControlProtocol::set_active done with yn: '%1'\n", yn));
return 0;
}
@ -679,7 +687,7 @@ MackieControlProtocol::close()
XMLNode&
MackieControlProtocol::get_state()
{
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::get_state\n");
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::get_state init\n");
char buf[16];
// add name of protocol
@ -697,6 +705,8 @@ MackieControlProtocol::get_state()
node->add_property (X_("device-profile"), _device_profile.name());
node->add_property (X_("device-name"), _device_info.name());
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::get_state done\n");
return *node;
}
@ -737,6 +747,8 @@ MackieControlProtocol::set_state (const XMLNode & node, int /*version*/)
switch_banks (bank, true);
}
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::set_state done\n");
return retval;
}

View File

@ -65,7 +65,7 @@ Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, ui
, _jog_wheel (0)
, _last_master_gain_written (-0.0f)
{
DEBUG_TRACE (DEBUG::MackieControl, "Surface::init\n");
DEBUG_TRACE (DEBUG::MackieControl, "Surface::Surface init\n");
_port = new SurfacePort (*this);
@ -93,12 +93,12 @@ Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, ui
connect_to_signals ();
DEBUG_TRACE (DEBUG::MackieControl, "Surface::init finish\n");
DEBUG_TRACE (DEBUG::MackieControl, "Surface::Surface done\n");
}
Surface::~Surface ()
{
DEBUG_TRACE (DEBUG::MackieControl, "Surface: destructor\n");
DEBUG_TRACE (DEBUG::MackieControl, "Surface::~Surface init\n");
zero_all ();
@ -114,6 +114,8 @@ Surface::~Surface ()
delete _jog_wheel;
delete _port;
DEBUG_TRACE (DEBUG::MackieControl, "Surface::~Surface done\n");
}
const MidiByteArray&
@ -200,8 +202,6 @@ Surface::init_strips (uint32_t n)
void
Surface::setup_master ()
{
_master_fader = dynamic_cast<Fader*> (Fader::factory (*this, _mcp.device_info().strip_cnt(), "master", *groups["master"]));
boost::shared_ptr<Route> m;
if ((m = _mcp.get_session().monitor_out()) == 0) {
@ -212,6 +212,8 @@ Surface::setup_master ()
return;
}
_master_fader = dynamic_cast<Fader*> (Fader::factory (*this, _mcp.device_info().strip_cnt(), "master", *groups["master"]));
_master_fader->set_control (m->gain_control());
m->gain_control()->Changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&Surface::master_gain_changed, this), ui_context());
@ -626,7 +628,7 @@ Surface::zero_all ()
show_two_char_display (string (2, '0'), string (2, ' '));
}
if (_mcp.device_info().has_master_fader ()) {
if (_mcp.device_info().has_master_fader () && _master_fader) {
_port->write (_master_fader->zero ());
}