8 using namespace Mackie;
10 Surface::Surface( uint32_t max_strips, uint32_t unit_strips )
11 : _max_strips( max_strips ), _unit_strips( unit_strips )
18 init_strips( _max_strips, _unit_strips );
24 for( Groups::iterator it = groups.begin(); it != groups.end(); ++it )
30 for( Controls::iterator it = controls.begin(); it != controls.end(); ++it )
36 // Mackie-specific, because of multiple devices on separate ports
37 // add the strips from 9..max_strips
38 // unit_strips is the number of strips for additional units.
39 void Surface::init_strips( uint32_t max_strips, uint32_t unit_strips )
41 if ( strips.size() < max_strips )
43 strips.resize( max_strips );
44 for ( uint32_t i = strips.size(); i < max_strips; ++i )
46 // because I can't find itoa
48 os << "strip_" << i + 1;
49 string name = os.str();
51 // shallow copy existing strip
52 // which works because the controls
53 // have the same ids across units
54 Strip * strip = new Strip( *strips[i % unit_strips] );
56 // update the relevant values
60 // add to data structures
68 TODO could optimise this to use enum, but it's only
69 called during the protocol class instantiation.
76 controls = sf.groups.find{|x| x[0] =~ /strip/}.each{|x| puts x[1]}
77 controls[1].each {|x| puts "\telse if ( control.name() == \"#{x.name}\" )\n\t{\n\t\t_#{x.name} = reinterpret_cast<#{x.class.name}*>(&control);\n\t}\n"}
79 void Strip::add( Control & control )
81 Group::add( control );
82 if ( control.name() == "gain" )
84 _gain = reinterpret_cast<Fader*>(&control);
86 else if ( control.name() == "vpot" )
88 _vpot = reinterpret_cast<Pot*>(&control);
90 else if ( control.name() == "recenable" )
92 _recenable = reinterpret_cast<Button*>(&control);
94 else if ( control.name() == "solo" )
96 _solo = reinterpret_cast<Button*>(&control);
98 else if ( control.name() == "mute" )
100 _mute = reinterpret_cast<Button*>(&control);
102 else if ( control.name() == "select" )
104 _select = reinterpret_cast<Button*>(&control);
106 else if ( control.name() == "vselect" )
108 _vselect = reinterpret_cast<Button*>(&control);
110 else if ( control.name() == "fader_touch" )
112 _fader_touch = reinterpret_cast<Button*>(&control);
114 else if ( control.type() == Control::type_led || control.type() == Control::type_led_ring )
117 cout << "Strip::add not adding " << control << endl;
122 os << "Strip::add: unknown control type " << control;
123 throw MackieControlException( os.str() );