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>
23 #include <ardour/types.h>
25 #include "mackie_control_protocol.h"
29 using namespace Mackie;
31 void RouteSignal::connect()
33 if ( _strip.has_solo() )
34 _solo_changed_connection = _route.solo_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_solo_changed ), this ) );
36 if ( _strip.has_mute() )
37 _mute_changed_connection = _route.mute_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_mute_changed ), this ) );
39 if ( _strip.has_gain() )
40 _gain_changed_connection = _route.gain_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_gain_changed ), this ) );
42 _name_changed_connection = _route.NameChanged.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), this ) );
44 if ( _route.panner().npanners() == 1 )
46 _panner_changed_connection = _route.panner().pan_control(0)->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this ) );
51 _record_enable_changed_connection =
52 dynamic_cast<ARDOUR::Track&>( _route ).rec_enable_control()->Changed
53 .connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_record_enable_changed ), this ) )
56 catch ( std::bad_cast & )
58 // this should catch the dynamic_cast to Track, if what we're working
59 // with can't be record-enabled
65 // RemoteControlIDChanged. Better handled at Session level.
68 void RouteSignal::disconnect()
70 _solo_changed_connection.disconnect();
71 _mute_changed_connection.disconnect();
72 _gain_changed_connection.disconnect();
73 _name_changed_connection.disconnect();
74 _panner_changed_connection.disconnect();
75 _record_enable_changed_connection.disconnect();
78 void RouteSignal::notify_all()
80 if ( _strip.has_solo() )
81 _mcp.notify_solo_changed( this );
83 if ( _strip.has_mute() )
84 _mcp.notify_mute_changed( this );
86 if ( _strip.has_gain() )
87 _mcp.notify_gain_changed( this );
89 _mcp.notify_name_changed( this );
91 if ( _strip.has_vpot() )
92 _mcp.notify_panner_changed( this );
94 if ( _strip.has_recenable() )
95 _mcp.notify_record_enable_changed( this );