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.
29 @signal_calls = { 'panner_changed' => 'panner()[0]->Changed' }
31 def connection_call( x )
32 if @signal_calls.include? x
41 void MackieControlProtocol::notify_#{x}( void *, ARDOUR::Route * route )
45 strip_from_route( route ).#{x.gsub( /_changed/, '' )}();
47 catch( exception & e )
49 cout << e.what() << endl;
57 #ifndef route_signal_h
58 #define route_signal_h
60 #include <sigc++/sigc++.h>
62 class MackieControlProtocol;
74 This class is intended to easily create and destroy the set of
75 connections from a route to a control surface strip. Instanting
76 it will connect the signals, and destructing it will disconnect
82 RouteSignal( ARDOUR::Route & route, MackieControlProtocol & mcp, Strip & strip )
83 : _route( route ), _mcp( mcp ), _strip( strip )
94 ARDOUR::Route & _route;
95 MackieControlProtocol & _mcp;
98 <% signals.each do |x| -%>
99 sigc::connection _<%= x %>_connection;
108 erb = ERB.new( class_def, 0, ">-" )
112 #include "route_signal.h"
114 #include <ardour/route.h>
115 #include <ardour/panner.h>
117 #include "mackie_control_protocol.h"
119 using namespace Mackie;
121 void RouteSignal::connect()
123 <% signals.each do |x| -%>
124 _<%=x%>_connection = _route.<%=connection_call(x)%>.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_<%=x%> ), &_route ) );
128 void RouteSignal::disconnect()
130 <% signals.each do |x| -%>
131 _<%= x %>_connection.disconnect();
136 erb = ERB.new( impl_def, 0, ">-" )