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.
42 Surface (uint32_t max_strips, uint32_t unit_strips);
45 /// Calls the virtual initialisation methods. This *must* be called after
46 /// construction, because c++ is too dumb to call virtual methods from
47 /// inside a constructor
50 typedef std::vector<Control*> Controls;
52 /// This collection has ownership of all the controls
56 These are alternative addressing schemes
57 They use maps because the indices aren't always
60 Indexed by raw_id not by id. @see Control for the distinction.
62 std::map<int,Fader*> faders;
63 std::map<int,Pot*> pots;
64 std::map<int,Button*> buttons;
65 std::map<int,Led*> leds;
67 /// no strip controls in here because they usually
68 /// have the same names.
69 std::map<std::string,Control*> controls_by_name;
71 /// The collection of all numbered strips. No master
73 typedef std::vector<Strip*> Strips;
76 /// This collection owns the groups
77 typedef std::map<std::string,Group*> Groups;
80 uint32_t max_strips() const { return _max_strips; }
82 /// map button ids to calls to press_ and release_ in mbh
83 virtual void handle_button( MackieButtonHandler & mbh, ButtonState bs, Button & button ) = 0;
86 /// display an indicator of the first switched-in Route. Do nothing by default.
87 virtual void display_bank_start( SurfacePort &, MackieMidiBuilder &, uint32_t /*current_bank*/ ) {};
89 /// called from MackieControlPRotocol::zero_all to turn things off
90 virtual void zero_all( SurfacePort &, MackieMidiBuilder & ) {};
92 /// turn off leds around the jog wheel. This is for surfaces that use a pot
93 /// pretending to be a jog wheel.
94 virtual void blank_jog_ring( SurfacePort &, MackieMidiBuilder & ) {};
96 virtual bool has_timecode_display() const = 0;
97 virtual void display_timecode( SurfacePort &, MackieMidiBuilder &, const std::string & /*timecode*/, const std::string & /*timecode_last*/) {};
101 This is used to calculate the clicks per second that define
102 a transport speed of 1.0 for the jog wheel. 100.0 is 10 clicks
103 per second, 50.5 is 5 clicks per second.
105 virtual float scrub_scaling_factor() = 0;
108 The scaling factor function for speed increase and decrease. At
109 low transport speeds this should return a small value, for high transport
110 speeds, this should return an exponentially larger value. This provides
111 high definition control at low speeds and quick speed changes to/from
114 virtual float scaled_delta( const ControlState & state, float current_speed ) = 0;
117 virtual void init_controls() = 0;
118 virtual void init_strips () {}
120 const uint32_t _max_strips;
121 const uint32_t _unit_strips;