6 #include "ardour/debug.h"
8 #include "control_group.h"
9 #include "surface_port.h"
24 using namespace Mackie;
26 Surface::Surface (uint32_t max_strips, uint32_t unit_strips)
27 : _max_strips (max_strips)
28 , _unit_strips( unit_strips )
34 DEBUG_TRACE (DEBUG::MackieControl, "Surface::init\n");
36 strips.resize (_max_strips);
40 DEBUG_TRACE (DEBUG::MackieControl, "Surface::init finish\n");
46 for (Groups::iterator it = groups.begin(); it != groups.end(); ++it) {
51 for (Controls::iterator it = controls.begin(); it != controls.end(); ++it) {
56 static GlobalControlDefinition mackie_global_controls[] = {
57 { "jog", 0x3c, Jog::factory, "none" },
58 { "external", 0x2e, Pot::factory, "none" },
59 { "io", 0x28, Button::factory, "assignment" },
60 { "sends", 0x29, Button::factory, "assignment" },
61 { "pan", 0x2a, Button::factory, "assignment" },
62 { "plugin", 0x2b, Button::factory, "assignment" },
63 { "eq", 0x2c, Button::factory, "assignment" },
64 { "dyn", 0x2d, Button::factory, "assignment" },
65 { "left", 0x2e, Button::factory, "bank" },
66 { "right", 0x2f, Button::factory, "bank" },
67 { "channel_left", 0x30, Button::factory, "bank" },
68 { "channel_right", 0x31, Button::factory, "bank" },
69 { "flip", 0x32, Button::factory, "none" },
70 { "edit", 0x33, Button::factory, "none" },
71 { "name_value", 0x34, Button::factory, "display" },
72 { "timecode_beats", 0x35, Button::factory, "display" },
73 { "F1", 0x36, Button::factory, "none" },
74 { "F2", 0x37, Button::factory, "none" },
75 { "F3", 0x38, Button::factory, "none" },
76 { "F4", 0x39, Button::factory, "none" },
77 { "F5", 0x3a, Button::factory, "none" },
78 { "F6", 0x3b, Button::factory, "none" },
79 { "F7", 0x3c, Button::factory, "none" },
80 { "F8", 0x3d, Button::factory, "none" },
81 { "F9", 0x3e, Button::factory, "none" },
82 { "F10", 0x3f, Button::factory, "none" },
83 { "F11", 0x40, Button::factory, "none" },
84 { "F12", 0x41, Button::factory, "none" },
85 { "F13", 0x42, Button::factory, "none" },
86 { "F14", 0x43, Button::factory, "none" },
87 { "F15", 0x44, Button::factory, "none" },
88 { "F16", 0x45, Button::factory, "none" },
89 { "shift", 0x46, Button::factory, "modifiers" },
90 { "option", 0x47, Button::factory, "modifiers" },
91 { "control", 0x48, Button::factory, "modifiers" },
92 { "cmd_alt", 0x49, Button::factory, "modifiers" },
93 { "on", 0x4a, Button::factory, "automation" },
94 { "rec_ready", 0x4b, Button::factory, "automation" },
95 { "undo", 0x4c, Button::factory, "functions" },
96 { "snapshot", 0x4d, Button::factory, "automation" },
97 { "touch", 0x4e, Button::factory, "automation" },
98 { "redo", 0x4f, Button::factory, "functions" },
99 { "marker", 0x50, Button::factory, "functions" },
100 { "enter", 0x51, Button::factory, "functions" },
101 { "cancel", 0x52, Button::factory, "functions" },
102 { "mixer", 0x53, Button::factory, "functions" },
103 { "frm_left", 0x54, Button::factory, "transport" },
104 { "frm_right", 0x55, Button::factory, "transport" },
105 { "loop", 0x56, Button::factory, "transport" },
106 { "punch_in", 0x57, Button::factory, "transport" },
107 { "punch_out", 0x58, Button::factory, "transport" },
108 { "home", 0x59, Button::factory, "transport" },
109 { "end", 0x5a, Button::factory, "transport" },
110 { "rewind", 0x5b, Button::factory, "transport" },
111 { "ffwd", 0x5c, Button::factory, "transport" },
112 { "stop", 0x5d, Button::factory, "transport" },
113 { "play", 0x5e, Button::factory, "transport" },
114 { "record", 0x5f, Button::factory, "transport" },
115 { "cursor_up", 0x60, Button::factory, "cursor" },
116 { "cursor_down", 0x61, Button::factory, "cursor" },
117 { "cursor_left", 0x62, Button::factory, "cursor" },
118 { "cursor_right", 0x63, Button::factory, "cursor" },
119 { "zoom", 0x64, Button::factory, "none" },
120 { "scrub", 0x65, Button::factory, "none" },
121 { "user_a", 0x66, Button::factory, "user" },
122 { "user_b", 0x67, Button::factory, "user" },
123 { "fader_touch", 0x70, Led::factory, "master" },
124 { "timecode", 0x71, Led::factory, "none" },
125 { "beats", 0x72, Led::factory, "none" },
126 { "solo", 0x73, Led::factory, "none" },
127 { "relay_click", 0x73, Led::factory, "none" },
128 { "", 0, Button::factory, "" }
132 Surface::init_controls()
136 groups["assignment"] = new Group ("assignment");
137 groups["automation"] = new Group ("automation");
138 groups["bank"] = new Group ("bank");
139 groups["cursor"] = new Group ("cursor");
140 groups["display"] = new Group ("display");
141 groups["functions"] = new Group ("functions");
142 groups["modifiers"] = new Group ("modifiers");
143 groups["none"] = new Group ("none");
144 groups["transport"] = new Group ("transport");
145 groups["user"] = new Group ("user");
147 group = new MasterStrip ("master", 0);
148 groups["master"] = group;
149 strips[0] = dynamic_cast<Strip*> (group);
151 for (uint32_t n = 0; mackie_global_controls[n].name[0]; ++n) {
152 group = groups[mackie_global_controls[n].group_name];
153 Control* control = mackie_global_controls[n].factory (*this, mackie_global_controls[n].id, 1, mackie_global_controls[n].name, *group);
154 controls_by_name[mackie_global_controls[n].name] = control;
155 group->add (*control);
159 static StripControlDefinition mackie_strip_controls[] = {
160 { "gain", Control::fader_base_id, Fader::factory, },
161 { "vpot", Control::pot_base_id, Pot::factory, },
162 { "recenable", Control::recenable_button_base_id, Button::factory, },
163 { "solo", Control::solo_button_base_id, Button::factory, },
164 { "mute", Control::mute_button_base_id, Button::factory, },
165 { "select", Control::select_button_base_id, Button::factory, },
166 { "vselect", Control::vselect_button_base_id, Button::factory, },
167 { "fader_touch", Control::fader_touch_button_base_id, Button::factory, },
168 { "meter", 0, Meter::factory, },
169 { "", 0, Button::factory, }
173 Surface::init_strips ()
175 for (uint32_t i = 0; i < _max_strips; ++i) {
179 uint32_t unit_index = i % _unit_strips;
181 snprintf (name, sizeof (name), "strip_%d", unit_index+1);
183 cerr << "Register strip " << i << " unit index " << unit_index << endl;
185 Strip* strip = new Strip (*this, name, i/8, i, unit_index, mackie_strip_controls);
187 groups[name] = strip;