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;
30 void RouteSignal::connect()
32 if ( _strip.has_solo() )
33 _solo_changed_connection = _route.solo_control().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_solo_changed ), &_route, &_port ) );
35 if ( _strip.has_mute() )
36 _mute_changed_connection = _route.mute_control().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_mute_changed ), &_route, &_port ) );
38 if ( _strip.has_gain() )
39 _gain_changed_connection = _route.gain_control().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_gain_changed ), &_route, &_port ) );
41 _name_changed_connection = _route.name_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), &_route, &_port ) );
43 if ( _route.panner().size() == 1 )
45 _panner_changed_connection = _route.panner()[0]->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), &_route, &_port ) );
50 _record_enable_changed_connection =
51 dynamic_cast<ARDOUR::Track&>( _route ).rec_enable_control().Changed
52 .connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_record_enable_changed ), &_route, &_port ) )
55 catch ( std::bad_cast & )
57 // this should catch the dynamic_cast to Track, if what we're working
58 // with can't be record-enabled
64 // RemoteControlIDChanged
67 void RouteSignal::disconnect()
69 _solo_changed_connection.disconnect();
70 _mute_changed_connection.disconnect();
71 _gain_changed_connection.disconnect();
72 _name_changed_connection.disconnect();
73 _panner_changed_connection.disconnect();
74 _record_enable_changed_connection.disconnect();
77 void RouteSignal::notify_all()
81 if ( _strip.has_solo() )
82 _mcp.notify_solo_changed( &_route, &_port );
84 if ( _strip.has_mute() )
85 _mcp.notify_mute_changed( &_route, &_port );
87 if ( _strip.has_gain() )
88 _mcp.notify_gain_changed( &_route, &_port );
90 _mcp.notify_name_changed( src, &_route, &_port );
92 if ( _strip.has_vpot() )
93 _mcp.notify_panner_changed( &_route, &_port );
95 if ( _strip.has_recenable() )
96 _mcp.notify_record_enable_changed( &_route, &_port );