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