2 Copyright (C) 2006,2007 John Anderson
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #include "route_signal.h"
20 #include <ardour/route.h>
21 #include <ardour/track.h>
22 #include <ardour/panner.h>
24 #include "mackie_control_protocol.h"
28 using namespace Mackie;
31 void RouteSignal::connect()
33 back_insert_iterator<Connections> cins = back_inserter( _connections );
35 if ( _strip.has_solo() )
36 cins = _route.solo_control().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_solo_changed ), this ) );
38 if ( _strip.has_mute() )
39 cins = _route.mute_control().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_mute_changed ), this ) );
41 if ( _strip.has_gain() )
42 cins = _route.gain_control().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_gain_changed ), this, true ) );
44 cins = _route.name_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), this ) );
46 cins = _route.panner().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
47 for ( unsigned int i = 0; i < _route.panner().size(); ++i )
49 cins = _route.panner()[i]->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
54 cins = dynamic_cast<ARDOUR::Track&>( _route )
57 .connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_record_enable_changed ), this ) )
60 catch ( std::bad_cast & )
62 // this should catch the dynamic_cast to Track, if what we're working
63 // with can't be record-enabled
66 // TODO this works when a currently-banked route is made inactive, but not
67 // when a route is activated which should be currently banked.
68 cins = _route.active_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_active_changed ), this ) );
72 // RemoteControlIDChanged. Better handled at Session level.
75 void RouteSignal::disconnect()
77 for ( Connections::iterator it = _connections.begin(); it != _connections.end(); ++it )
83 void RouteSignal::notify_all()
86 cout << "RouteSignal::notify_all for " << _strip << endl;
88 if ( _strip.has_solo() )
89 _mcp.notify_solo_changed( this );
91 if ( _strip.has_mute() )
92 _mcp.notify_mute_changed( this );
94 if ( _strip.has_gain() )
95 _mcp.notify_gain_changed( this );
97 _mcp.notify_name_changed( &_route, this );
99 if ( _strip.has_vpot() )
100 _mcp.notify_panner_changed( this );
102 if ( _strip.has_recenable() )
103 _mcp.notify_record_enable_changed( this );
105 cout << "RouteSignal::notify_all finish" << endl;