2008-06-02 17:41:35 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2006,2007 John Anderson
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
#include "route_signal.h"
|
|
|
|
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "ardour/route.h"
|
|
|
|
#include "ardour/track.h"
|
2009-12-21 13:23:07 -05:00
|
|
|
#include "ardour/midi_ui.h"
|
2011-02-22 13:44:22 -05:00
|
|
|
#include "ardour/pannable.h"
|
2010-02-19 13:09:08 -05:00
|
|
|
#include "ardour/session_object.h" // for Properties::name
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
#include "mackie_control_protocol.h"
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
2009-04-15 14:04:23 -04:00
|
|
|
using namespace ARDOUR;
|
2008-06-02 17:41:35 -04:00
|
|
|
using namespace Mackie;
|
2008-12-12 17:55:03 -05:00
|
|
|
using namespace std;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-12-21 13:23:07 -05:00
|
|
|
#define midi_ui_context() MidiControlUI::instance() /* a UICallback-derived object that specifies the event loop for signal handling */
|
|
|
|
#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
void RouteSignal::connect()
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_strip.has_solo()) {
|
2010-03-30 11:18:43 -04:00
|
|
|
_route->solo_control()->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_solo_changed, &_mcp, this), midi_ui_context());
|
2009-12-17 13:24:23 -05:00
|
|
|
}
|
2009-04-15 14:04:23 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_strip.has_mute()) {
|
2010-03-30 11:18:43 -04:00
|
|
|
_route->mute_control()->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_mute_changed, &_mcp, this), midi_ui_context());
|
2009-12-17 13:24:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_strip.has_gain()) {
|
2010-03-30 11:18:43 -04:00
|
|
|
_route->gain_control()->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_gain_changed, &_mcp, this, false), midi_ui_context());
|
2009-12-17 13:24:23 -05:00
|
|
|
}
|
|
|
|
|
2010-03-30 11:18:43 -04:00
|
|
|
_route->PropertyChanged.connect (connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_property_changed, &_mcp, _1, this), midi_ui_context());
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2011-02-22 13:44:22 -05:00
|
|
|
if (_route->pannable()) {
|
|
|
|
_route->pannable()->pan_azimuth_control->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false), midi_ui_context());
|
|
|
|
_route->pannable()->pan_width_control->Changed.connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_panner_changed, &_mcp, this, false), midi_ui_context());
|
2009-05-07 14:00:03 -04:00
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-04-15 14:04:23 -04:00
|
|
|
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
|
|
|
|
if (trk) {
|
2010-03-30 11:18:43 -04:00
|
|
|
trk->rec_enable_control()->Changed .connect(connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_record_enable_changed, &_mcp, this), midi_ui_context());
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2009-04-15 14:04:23 -04:00
|
|
|
|
2008-12-12 17:55:03 -05:00
|
|
|
// TODO this works when a currently-banked route is made inactive, but not
|
|
|
|
// when a route is activated which should be currently banked.
|
2010-03-30 11:18:43 -04:00
|
|
|
_route->active_changed.connect (connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_active_changed, &_mcp, this), midi_ui_context());
|
2011-05-23 06:03:14 -04:00
|
|
|
|
|
|
|
_route->DropReferences.connect (connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::refresh_current_bank, &_mcp), midi_ui_context());
|
2009-12-19 15:26:31 -05:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
// TODO
|
|
|
|
// SelectedChanged
|
|
|
|
// RemoteControlIDChanged. Better handled at Session level.
|
|
|
|
}
|
|
|
|
|
2012-04-08 16:34:21 -04:00
|
|
|
void
|
|
|
|
RouteSignal::disconnect()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
connections.drop_connections ();
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2012-04-08 16:34:21 -04:00
|
|
|
void
|
|
|
|
RouteSignal::notify_all()
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2012-04-08 16:34:21 -04:00
|
|
|
if (_strip.has_solo()) {
|
|
|
|
_mcp.notify_solo_changed (this);
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-08 16:34:21 -04:00
|
|
|
if (_strip.has_mute()) {
|
|
|
|
_mcp.notify_mute_changed (this);
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-08 16:34:21 -04:00
|
|
|
if (_strip.has_gain()) {
|
|
|
|
_mcp.notify_gain_changed (this);
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-08 16:34:21 -04:00
|
|
|
_mcp.notify_property_changed (PBD::PropertyChange (ARDOUR::Properties::name), this);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-08 16:34:21 -04:00
|
|
|
if (_strip.has_vpot()) {
|
|
|
|
_mcp.notify_panner_changed (this);
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2012-04-08 16:34:21 -04:00
|
|
|
if (_strip.has_recenable()) {
|
|
|
|
_mcp.notify_record_enable_changed (this);
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|