add new sigc++2 directory
[ardour.git] / libs / surfaces / mackie / controls.cc
1 /*
2         Copyright (C) 2006,2007 John Anderson
3
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.
8
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.
13
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.
17 */
18 #include "controls.h"
19 #include "types.h"
20 #include "mackie_midi_builder.h"
21
22 #include <iostream>
23 #include <iomanip>
24 #include <sstream>
25
26 using namespace Mackie;
27 using namespace std;
28
29 void Group::add( Control & control )
30 {
31         _controls.push_back( &control );
32 }
33
34 Strip::Strip( const std::string & name, int index )
35         : Group( name )
36         , _solo( 0 )
37         , _recenable( 0 )
38         , _mute( 0 )
39         , _select( 0 )
40         , _vselect( 0 )
41         , _fader_touch( 0 )
42         , _vpot( 0 )
43         , _gain( 0 )
44         , _index( index )
45 {
46 }
47
48 /**
49  generated with
50
51 controls[1].each do |x|
52   puts <<EOF
53 #{x.class.name} & Strip::#{x.name}()
54 {
55         if ( _#{x.name} == 0 )
56                 throw MackieControlException( "#{x.name} is null" );
57         return *_#{x.name};
58 }
59 EOF
60 end
61 */
62 Fader & Strip::gain()
63 {
64         if ( _gain == 0 )
65                 throw MackieControlException( "gain is null" );
66         return *_gain;
67 }
68 Pot & Strip::vpot()
69 {
70         if ( _vpot == 0 )
71                 throw MackieControlException( "vpot is null" );
72         return *_vpot;
73 }
74 Button & Strip::recenable()
75 {
76         if ( _recenable == 0 )
77                 throw MackieControlException( "recenable is null" );
78         return *_recenable;
79 }
80 Button & Strip::solo()
81 {
82         if ( _solo == 0 )
83                 throw MackieControlException( "solo is null" );
84         return *_solo;
85 }
86 Button & Strip::mute()
87 {
88         if ( _mute == 0 )
89                 throw MackieControlException( "mute is null" );
90         return *_mute;
91 }
92 Button & Strip::select()
93 {
94         if ( _select == 0 )
95                 throw MackieControlException( "select is null" );
96         return *_select;
97 }
98 Button & Strip::vselect()
99 {
100         if ( _vselect == 0 )
101                 throw MackieControlException( "vselect is null" );
102         return *_vselect;
103 }
104 Button & Strip::fader_touch()
105 {
106         if ( _fader_touch == 0 )
107                 throw MackieControlException( "fader_touch is null" );
108         return *_fader_touch;
109 }