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"
|
|
|
|
|
|
|
|
#include <ardour/route.h>
|
|
|
|
#include <ardour/track.h>
|
|
|
|
#include <ardour/panner.h>
|
|
|
|
|
|
|
|
#include "mackie_control_protocol.h"
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
using namespace Mackie;
|
2008-12-12 17:55:03 -05:00
|
|
|
using namespace std;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
void RouteSignal::connect()
|
|
|
|
{
|
2008-12-12 17:55:03 -05:00
|
|
|
back_insert_iterator<Connections> cins = back_inserter( _connections );
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
if ( _strip.has_solo() )
|
2008-12-12 17:55:03 -05:00
|
|
|
cins = _route.solo_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_solo_changed ), this ) );
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
if ( _strip.has_mute() )
|
2008-12-12 17:55:03 -05:00
|
|
|
cins = _route.mute_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_mute_changed ), this ) );
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
if ( _strip.has_gain() )
|
2008-12-12 17:55:03 -05:00
|
|
|
cins = _route.gain_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_gain_changed ), this, true ) );
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2008-12-12 17:55:03 -05:00
|
|
|
cins = _route.NameChanged.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), this ) );
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2008-12-12 17:55:03 -05:00
|
|
|
cins = _route.panner().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
|
|
|
|
for ( unsigned int i = 0; i < _route.panner().npanners(); ++i )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2008-12-12 17:55:03 -05:00
|
|
|
cins = _route.panner().streampanner (i).Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2008-12-12 17:55:03 -05:00
|
|
|
cins = dynamic_cast<ARDOUR::Track&>( _route )
|
|
|
|
.rec_enable_control()
|
|
|
|
->Changed
|
|
|
|
.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_record_enable_changed ), this ) )
|
2008-06-02 17:41:35 -04:00
|
|
|
;
|
|
|
|
}
|
|
|
|
catch ( std::bad_cast & )
|
|
|
|
{
|
|
|
|
// this should catch the dynamic_cast to Track, if what we're working
|
|
|
|
// with can't be record-enabled
|
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
cins = _route.active_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_active_changed ), this ) );
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
// TODO
|
|
|
|
// SelectedChanged
|
|
|
|
// RemoteControlIDChanged. Better handled at Session level.
|
|
|
|
}
|
|
|
|
|
|
|
|
void RouteSignal::disconnect()
|
|
|
|
{
|
2008-12-12 17:55:03 -05:00
|
|
|
for ( Connections::iterator it = _connections.begin(); it != _connections.end(); ++it )
|
|
|
|
{
|
|
|
|
it->disconnect();
|
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void RouteSignal::notify_all()
|
|
|
|
{
|
2008-12-12 17:55:03 -05:00
|
|
|
#ifdef DEBUG
|
|
|
|
cout << "RouteSignal::notify_all for " << _strip << endl;
|
|
|
|
#endif
|
2008-06-02 17:41:35 -04:00
|
|
|
if ( _strip.has_solo() )
|
|
|
|
_mcp.notify_solo_changed( this );
|
|
|
|
|
|
|
|
if ( _strip.has_mute() )
|
|
|
|
_mcp.notify_mute_changed( this );
|
|
|
|
|
|
|
|
if ( _strip.has_gain() )
|
|
|
|
_mcp.notify_gain_changed( this );
|
|
|
|
|
|
|
|
_mcp.notify_name_changed( this );
|
|
|
|
|
|
|
|
if ( _strip.has_vpot() )
|
|
|
|
_mcp.notify_panner_changed( this );
|
|
|
|
|
|
|
|
if ( _strip.has_recenable() )
|
|
|
|
_mcp.notify_record_enable_changed( this );
|
2008-12-12 17:55:03 -05:00
|
|
|
#ifdef DEBUG
|
|
|
|
cout << "RouteSignal::notify_all finish" << endl;
|
|
|
|
#endif
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|