1 #ifndef mackie_surface_h
2 #define mackie_surface_h
11 class MackieButtonHandler;
13 class MackieMidiBuilder;
16 This represents an entire control surface, made up of Groups,
17 Strips and Controls. There are several collections for
18 ease of addressing in different ways, but only one collection
19 has definitive ownership.
21 It handles mapping button ids to press_ and release_ calls.
23 There are various emulations of the Mackie around, so specific
24 emulations will inherit from this to change button mapping, or
25 have 7 fader channels instead of 8, or whatever.
27 Currently there are BcfSurface and MackieSurface.
29 TODO maybe make Group inherit from Control, for ease of ownership.
35 A Surface can be made up of multiple units. eg one Mackie MCU plus
36 one or more Mackie MCU extenders.
38 \param max_strips is the number of strips for the entire surface.
39 \param unit_strips is the number of strips per unit.
41 Surface( uint32_t max_strips, uint32_t unit_strips = 8 );
44 /// Calls the virtual initialisation methods. This *must* be called after
45 /// construction, because c++ is too dumb to call virtual methods from
46 /// inside a constructor
49 typedef std::vector<Control*> Controls;
51 /// This collection has ownership of all the controls
55 These are alternative addressing schemes
56 They use maps because the indices aren't always
59 Indexed by raw_id not by id. @see Control for the distinction.
61 std::map<int,Fader*> faders;
62 std::map<int,Pot*> pots;
63 std::map<int,Button*> buttons;
64 std::map<int,Led*> leds;
66 /// no strip controls in here because they usually
67 /// have the same names.
68 std::map<std::string,Control*> controls_by_name;
70 /// The collection of all numbered strips. No master
72 typedef std::vector<Strip*> Strips;
75 /// This collection owns the groups
76 typedef std::map<std::string,Group*> Groups;
79 uint32_t max_strips() const
84 /// map button ids to calls to press_ and release_ in mbh
85 virtual void handle_button( MackieButtonHandler & mbh, ButtonState bs, Button & button ) = 0;
88 /// display an indicator of the first switched-in Route. Do nothing by default.
89 virtual void display_bank_start( SurfacePort &, MackieMidiBuilder &, uint32_t /*current_bank*/ ) {};
91 /// called from MackieControlPRotocol::zero_all to turn things off
92 virtual void zero_all( SurfacePort &, MackieMidiBuilder & ) {};
94 /// turn off leds around the jog wheel. This is for surfaces that use a pot
95 /// pretending to be a jog wheel.
96 virtual void blank_jog_ring( SurfacePort &, MackieMidiBuilder & ) {};
98 virtual bool has_timecode_display() const = 0;
99 virtual void display_timecode( SurfacePort &, MackieMidiBuilder &, const std::string & /*timecode*/, const std::string & /*timecode_last*/) {};
103 This is used to calculate the clicks per second that define
104 a transport speed of 1.0 for the jog wheel. 100.0 is 10 clicks
105 per second, 50.5 is 5 clicks per second.
107 virtual float scrub_scaling_factor() = 0;
110 The scaling factor function for speed increase and decrease. At
111 low transport speeds this should return a small value, for high transport
112 speeds, this should return an exponentially larger value. This provides
113 high definition control at low speeds and quick speed changes to/from
116 virtual float scaled_delta( const ControlState & state, float current_speed ) = 0;
119 virtual void init_controls() = 0;
120 virtual void init_strips( uint32_t max_strips, uint32_t unit_strips );
123 uint32_t _max_strips;
124 uint32_t _unit_strips;