diff options
author | John Anderson <ardour@semiosix.com> | 2007-07-19 22:07:10 +0000 |
---|---|---|
committer | John Anderson <ardour@semiosix.com> | 2007-07-19 22:07:10 +0000 |
commit | 4c12c98e338dd88e7b05b7e47133f91c3e3bbc06 (patch) | |
tree | b4c58bcba79696bcaf453cff5441d6caff417f85 | |
parent | 47add43cd028855cda2292bef9dcde607f948490 (diff) |
Jog Wheel Fun:
- When ffwd/rew is pressed, wheel controls speed
- Zoom button allows jog wheel to zoom
- Scrub button cycles jog from scrub to shuttle to whatever it was before
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2155 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/surfaces/mackie/SConscript | 1 | ||||
-rw-r--r-- | libs/surfaces/mackie/TODO | 1 | ||||
-rw-r--r-- | libs/surfaces/mackie/bcf_surface.cc | 1191 | ||||
-rw-r--r-- | libs/surfaces/mackie/controls.h | 4 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 82 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.h | 20 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol_poll.cc | 5 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_jog_wheel.cc | 218 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_jog_wheel.h | 102 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_port.cc | 4 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_surface.cc | 1233 | ||||
-rw-r--r-- | libs/surfaces/mackie/scripts/bcf-controls.csv | 8 | ||||
-rwxr-xr-x | libs/surfaces/mackie/scripts/host.rb | 2 | ||||
-rw-r--r-- | libs/surfaces/mackie/scripts/surface-cc-template.erb | 15 | ||||
-rw-r--r-- | libs/surfaces/mackie/surface.h | 8 | ||||
-rw-r--r-- | libs/surfaces/mackie/surface_port.cc | 8 | ||||
-rw-r--r-- | libs/surfaces/mackie/timer.h | 2 | ||||
-rw-r--r-- | libs/surfaces/mackie/types.cc | 28 | ||||
-rw-r--r-- | libs/surfaces/mackie/types.h | 17 |
19 files changed, 1687 insertions, 1262 deletions
diff --git a/libs/surfaces/mackie/SConscript b/libs/surfaces/mackie/SConscript index 7bd1357cb3..86c060c8e3 100644 --- a/libs/surfaces/mackie/SConscript +++ b/libs/surfaces/mackie/SConscript @@ -35,6 +35,7 @@ surface.cc mackie_control_protocol.cc bcf_surface.cc mackie_surface.cc +mackie_jog_wheel.cc """) mackie.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE") diff --git a/libs/surfaces/mackie/TODO b/libs/surfaces/mackie/TODO index 02728cd70e..e351f903ea 100644 --- a/libs/surfaces/mackie/TODO +++ b/libs/surfaces/mackie/TODO @@ -1,3 +1,4 @@ +* update manual with jog wheel states * alsa/sequencer ports unstable * crash when mmc port set to mcu * remappable buttons diff --git a/libs/surfaces/mackie/bcf_surface.cc b/libs/surfaces/mackie/bcf_surface.cc index e9d6595261..0740c8293c 100644 --- a/libs/surfaces/mackie/bcf_surface.cc +++ b/libs/surfaces/mackie/bcf_surface.cc @@ -81,844 +81,847 @@ void Mackie::BcfSurface::init_controls() // initialise controls - Control * control = 0; + Fader * fader = 0; + Pot * pot = 0; + Button * button = 0; + Led * led = 0; group = groups["strip_1"]; - control = new Fader ( 0, 1, "gain", *group ); - faders[0x00] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 0, 1, "gain", *group ); + faders[0x00] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_2"]; - control = new Fader ( 1, 2, "gain", *group ); - faders[0x01] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 1, 2, "gain", *group ); + faders[0x01] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_3"]; - control = new Fader ( 2, 3, "gain", *group ); - faders[0x02] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 2, 3, "gain", *group ); + faders[0x02] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_4"]; - control = new Fader ( 3, 4, "gain", *group ); - faders[0x03] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 3, 4, "gain", *group ); + faders[0x03] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_5"]; - control = new Fader ( 4, 5, "gain", *group ); - faders[0x04] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 4, 5, "gain", *group ); + faders[0x04] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_6"]; - control = new Fader ( 5, 6, "gain", *group ); - faders[0x05] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 5, 6, "gain", *group ); + faders[0x05] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_7"]; - control = new Fader ( 6, 7, "gain", *group ); - faders[0x06] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 6, 7, "gain", *group ); + faders[0x06] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["master"]; - control = new Fader ( 7, 1, "gain", *group ); - faders[0x07] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 7, 1, "gain", *group ); + faders[0x07] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_1"]; - control = new Pot ( 16, 1, "vpot", *group ); - pots[0x10] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 16, 1, "vpot", *group ); + pots[0x10] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_2"]; - control = new Pot ( 17, 2, "vpot", *group ); - pots[0x11] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 17, 2, "vpot", *group ); + pots[0x11] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_3"]; - control = new Pot ( 18, 3, "vpot", *group ); - pots[0x12] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 18, 3, "vpot", *group ); + pots[0x12] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_4"]; - control = new Pot ( 19, 4, "vpot", *group ); - pots[0x13] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 19, 4, "vpot", *group ); + pots[0x13] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_5"]; - control = new Pot ( 20, 5, "vpot", *group ); - pots[0x14] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 20, 5, "vpot", *group ); + pots[0x14] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_6"]; - control = new Pot ( 21, 6, "vpot", *group ); - pots[0x15] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 21, 6, "vpot", *group ); + pots[0x15] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_7"]; - control = new Pot ( 22, 7, "vpot", *group ); - pots[0x16] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 22, 7, "vpot", *group ); + pots[0x16] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["none"]; - control = new Pot ( 23, 1, "jog", *group ); - pots[0x17] = control; - controls.push_back( control ); - controls_by_name["jog"] = control; - group->add( *control ); + pot = new Pot ( 23, 1, "jog", *group ); + pots[0x17] = pot; + controls.push_back( pot ); + controls_by_name["jog"] = pot; + group->add( *pot ); group = groups["none"]; - control = new Pot ( 46, 1, "external", *group ); - pots[0x2e] = control; - controls.push_back( control ); - controls_by_name["external"] = control; - group->add( *control ); + pot = new Pot ( 46, 1, "external", *group ); + pots[0x2e] = pot; + controls.push_back( pot ); + controls_by_name["external"] = pot; + group->add( *pot ); group = groups["strip_1"]; - control = new Button ( 24, 1, "recenable", *group ); - buttons[0x18] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 24, 1, "recenable", *group ); + buttons[0x18] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 25, 2, "recenable", *group ); - buttons[0x19] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 25, 2, "recenable", *group ); + buttons[0x19] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 26, 3, "recenable", *group ); - buttons[0x1a] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 26, 3, "recenable", *group ); + buttons[0x1a] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 27, 4, "recenable", *group ); - buttons[0x1b] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 27, 4, "recenable", *group ); + buttons[0x1b] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 28, 5, "recenable", *group ); - buttons[0x1c] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 28, 5, "recenable", *group ); + buttons[0x1c] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 29, 6, "recenable", *group ); - buttons[0x1d] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 29, 6, "recenable", *group ); + buttons[0x1d] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 30, 7, "recenable", *group ); - buttons[0x1e] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 30, 7, "recenable", *group ); + buttons[0x1e] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 32, 1, "solo", *group ); - buttons[0x20] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 32, 1, "solo", *group ); + buttons[0x20] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 33, 2, "solo", *group ); - buttons[0x21] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 33, 2, "solo", *group ); + buttons[0x21] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 34, 3, "solo", *group ); - buttons[0x22] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 34, 3, "solo", *group ); + buttons[0x22] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 35, 4, "solo", *group ); - buttons[0x23] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 35, 4, "solo", *group ); + buttons[0x23] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 36, 5, "solo", *group ); - buttons[0x24] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 36, 5, "solo", *group ); + buttons[0x24] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 37, 6, "solo", *group ); - buttons[0x25] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 37, 6, "solo", *group ); + buttons[0x25] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 38, 7, "solo", *group ); - buttons[0x26] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 38, 7, "solo", *group ); + buttons[0x26] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 16, 1, "mute", *group ); - buttons[0x10] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 16, 1, "mute", *group ); + buttons[0x10] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 17, 2, "mute", *group ); - buttons[0x11] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 17, 2, "mute", *group ); + buttons[0x11] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 18, 3, "mute", *group ); - buttons[0x12] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 18, 3, "mute", *group ); + buttons[0x12] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 19, 4, "mute", *group ); - buttons[0x13] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 19, 4, "mute", *group ); + buttons[0x13] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 20, 5, "mute", *group ); - buttons[0x14] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 20, 5, "mute", *group ); + buttons[0x14] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 21, 6, "mute", *group ); - buttons[0x15] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 21, 6, "mute", *group ); + buttons[0x15] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 22, 7, "mute", *group ); - buttons[0x16] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 22, 7, "mute", *group ); + buttons[0x16] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 0, 1, "select", *group ); - buttons[0x00] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 0, 1, "select", *group ); + buttons[0x00] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 1, 2, "select", *group ); - buttons[0x01] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 1, 2, "select", *group ); + buttons[0x01] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 2, 3, "select", *group ); - buttons[0x02] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 2, 3, "select", *group ); + buttons[0x02] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 3, 4, "select", *group ); - buttons[0x03] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 3, 4, "select", *group ); + buttons[0x03] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 4, 5, "select", *group ); - buttons[0x04] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 4, 5, "select", *group ); + buttons[0x04] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 5, 6, "select", *group ); - buttons[0x05] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 5, 6, "select", *group ); + buttons[0x05] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 6, 7, "select", *group ); - buttons[0x06] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 6, 7, "select", *group ); + buttons[0x06] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 8, 1, "vselect", *group ); - buttons[0x08] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 8, 1, "vselect", *group ); + buttons[0x08] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 9, 2, "vselect", *group ); - buttons[0x09] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 9, 2, "vselect", *group ); + buttons[0x09] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 10, 3, "vselect", *group ); - buttons[0x0a] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 10, 3, "vselect", *group ); + buttons[0x0a] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 11, 4, "vselect", *group ); - buttons[0x0b] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 11, 4, "vselect", *group ); + buttons[0x0b] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 12, 5, "vselect", *group ); - buttons[0x0c] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 12, 5, "vselect", *group ); + buttons[0x0c] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 13, 6, "vselect", *group ); - buttons[0x0d] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 13, 6, "vselect", *group ); + buttons[0x0d] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 14, 7, "vselect", *group ); - buttons[0x0e] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 14, 7, "vselect", *group ); + buttons[0x0e] = button; + controls.push_back( button ); + group->add( *button ); group = groups["assignment"]; - control = new Button ( 40, 1, "io", *group ); - buttons[0x28] = control; - controls.push_back( control ); - controls_by_name["io"] = control; - group->add( *control ); + button = new Button ( 40, 1, "io", *group ); + buttons[0x28] = button; + controls.push_back( button ); + controls_by_name["io"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 90, 1, "sends", *group ); - buttons[0x5a] = control; - controls.push_back( control ); - controls_by_name["sends"] = control; - group->add( *control ); + button = new Button ( 90, 1, "sends", *group ); + buttons[0x5a] = button; + controls.push_back( button ); + controls_by_name["sends"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 89, 1, "pan", *group ); - buttons[0x59] = control; - controls.push_back( control ); - controls_by_name["pan"] = control; - group->add( *control ); + button = new Button ( 89, 1, "pan", *group ); + buttons[0x59] = button; + controls.push_back( button ); + controls_by_name["pan"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 87, 1, "plugin", *group ); - buttons[0x57] = control; - controls.push_back( control ); - controls_by_name["plugin"] = control; - group->add( *control ); + button = new Button ( 87, 1, "plugin", *group ); + buttons[0x57] = button; + controls.push_back( button ); + controls_by_name["plugin"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 88, 1, "eq", *group ); - buttons[0x58] = control; - controls.push_back( control ); - controls_by_name["eq"] = control; - group->add( *control ); + button = new Button ( 88, 1, "eq", *group ); + buttons[0x58] = button; + controls.push_back( button ); + controls_by_name["eq"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 45, 1, "dyn", *group ); - buttons[0x2d] = control; - controls.push_back( control ); - controls_by_name["dyn"] = control; - group->add( *control ); + button = new Button ( 45, 1, "zoom", *group ); + buttons[0x2d] = button; + controls.push_back( button ); + controls_by_name["zoom"] = button; + group->add( *button ); group = groups["bank"]; - control = new Button ( 46, 1, "left", *group ); - buttons[0x2e] = control; - controls.push_back( control ); - controls_by_name["left"] = control; - group->add( *control ); + button = new Button ( 46, 1, "left", *group ); + buttons[0x2e] = button; + controls.push_back( button ); + controls_by_name["left"] = button; + group->add( *button ); group = groups["bank"]; - control = new Button ( 47, 1, "right", *group ); - buttons[0x2f] = control; - controls.push_back( control ); - controls_by_name["right"] = control; - group->add( *control ); + button = new Button ( 47, 1, "right", *group ); + buttons[0x2f] = button; + controls.push_back( button ); + controls_by_name["right"] = button; + group->add( *button ); group = groups["bank"]; - control = new Button ( 48, 1, "channel_left", *group ); - buttons[0x30] = control; - controls.push_back( control ); - controls_by_name["channel_left"] = control; - group->add( *control ); + button = new Button ( 48, 1, "channel_left", *group ); + buttons[0x30] = button; + controls.push_back( button ); + controls_by_name["channel_left"] = button; + group->add( *button ); group = groups["bank"]; - control = new Button ( 49, 1, "channel_right", *group ); - buttons[0x31] = control; - controls.push_back( control ); - controls_by_name["channel_right"] = control; - group->add( *control ); + button = new Button ( 49, 1, "channel_right", *group ); + buttons[0x31] = button; + controls.push_back( button ); + controls_by_name["channel_right"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 50, 1, "flip", *group ); - buttons[0x32] = control; - controls.push_back( control ); - controls_by_name["flip"] = control; - group->add( *control ); + button = new Button ( 50, 1, "scrub", *group ); + buttons[0x32] = button; + controls.push_back( button ); + controls_by_name["scrub"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 86, 1, "edit", *group ); - buttons[0x56] = control; - controls.push_back( control ); - controls_by_name["edit"] = control; - group->add( *control ); + button = new Button ( 86, 1, "edit", *group ); + buttons[0x56] = button; + controls.push_back( button ); + controls_by_name["edit"] = button; + group->add( *button ); group = groups["display"]; - control = new Button ( 52, 1, "name_value", *group ); - buttons[0x34] = control; - controls.push_back( control ); - controls_by_name["name_value"] = control; - group->add( *control ); + button = new Button ( 52, 1, "name_value", *group ); + buttons[0x34] = button; + controls.push_back( button ); + controls_by_name["name_value"] = button; + group->add( *button ); group = groups["display"]; - control = new Button ( 53, 1, "smpte_beats", *group ); - buttons[0x35] = control; - controls.push_back( control ); - controls_by_name["smpte_beats"] = control; - group->add( *control ); + button = new Button ( 53, 1, "smpte_beats", *group ); + buttons[0x35] = button; + controls.push_back( button ); + controls_by_name["smpte_beats"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 54, 1, "F1", *group ); - buttons[0x36] = control; - controls.push_back( control ); - controls_by_name["F1"] = control; - group->add( *control ); + button = new Button ( 54, 1, "F1", *group ); + buttons[0x36] = button; + controls.push_back( button ); + controls_by_name["F1"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 55, 1, "F2", *group ); - buttons[0x37] = control; - controls.push_back( control ); - controls_by_name["F2"] = control; - group->add( *control ); + button = new Button ( 55, 1, "F2", *group ); + buttons[0x37] = button; + controls.push_back( button ); + controls_by_name["F2"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 56, 1, "F3", *group ); - buttons[0x38] = control; - controls.push_back( control ); - controls_by_name["F3"] = control; - group->add( *control ); + button = new Button ( 56, 1, "F3", *group ); + buttons[0x38] = button; + controls.push_back( button ); + controls_by_name["F3"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 57, 1, "F4", *group ); - buttons[0x39] = control; - controls.push_back( control ); - controls_by_name["F4"] = control; - group->add( *control ); + button = new Button ( 57, 1, "F4", *group ); + buttons[0x39] = button; + controls.push_back( button ); + controls_by_name["F4"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 58, 1, "F5", *group ); - buttons[0x3a] = control; - controls.push_back( control ); - controls_by_name["F5"] = control; - group->add( *control ); + button = new Button ( 58, 1, "F5", *group ); + buttons[0x3a] = button; + controls.push_back( button ); + controls_by_name["F5"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 59, 1, "F6", *group ); - buttons[0x3b] = control; - controls.push_back( control ); - controls_by_name["F6"] = control; - group->add( *control ); + button = new Button ( 59, 1, "F6", *group ); + buttons[0x3b] = button; + controls.push_back( button ); + controls_by_name["F6"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 60, 1, "F7", *group ); - buttons[0x3c] = control; - controls.push_back( control ); - controls_by_name["F7"] = control; - group->add( *control ); + button = new Button ( 60, 1, "F7", *group ); + buttons[0x3c] = button; + controls.push_back( button ); + controls_by_name["F7"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 61, 1, "F8", *group ); - buttons[0x3d] = control; - controls.push_back( control ); - controls_by_name["F8"] = control; - group->add( *control ); + button = new Button ( 61, 1, "F8", *group ); + buttons[0x3d] = button; + controls.push_back( button ); + controls_by_name["F8"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 62, 1, "F9", *group ); - buttons[0x3e] = control; - controls.push_back( control ); - controls_by_name["F9"] = control; - group->add( *control ); + button = new Button ( 62, 1, "F9", *group ); + buttons[0x3e] = button; + controls.push_back( button ); + controls_by_name["F9"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 63, 1, "F10", *group ); - buttons[0x3f] = control; - controls.push_back( control ); - controls_by_name["F10"] = control; - group->add( *control ); + button = new Button ( 63, 1, "F10", *group ); + buttons[0x3f] = button; + controls.push_back( button ); + controls_by_name["F10"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 64, 1, "F11", *group ); - buttons[0x40] = control; - controls.push_back( control ); - controls_by_name["F11"] = control; - group->add( *control ); + button = new Button ( 64, 1, "F11", *group ); + buttons[0x40] = button; + controls.push_back( button ); + controls_by_name["F11"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 65, 1, "F12", *group ); - buttons[0x41] = control; - controls.push_back( control ); - controls_by_name["F12"] = control; - group->add( *control ); + button = new Button ( 65, 1, "F12", *group ); + buttons[0x41] = button; + controls.push_back( button ); + controls_by_name["F12"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 66, 1, "F13", *group ); - buttons[0x42] = control; - controls.push_back( control ); - controls_by_name["F13"] = control; - group->add( *control ); + button = new Button ( 66, 1, "F13", *group ); + buttons[0x42] = button; + controls.push_back( button ); + controls_by_name["F13"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 67, 1, "F14", *group ); - buttons[0x43] = control; - controls.push_back( control ); - controls_by_name["F14"] = control; - group->add( *control ); + button = new Button ( 67, 1, "F14", *group ); + buttons[0x43] = button; + controls.push_back( button ); + controls_by_name["F14"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 68, 1, "F15", *group ); - buttons[0x44] = control; - controls.push_back( control ); - controls_by_name["F15"] = control; - group->add( *control ); + button = new Button ( 68, 1, "F15", *group ); + buttons[0x44] = button; + controls.push_back( button ); + controls_by_name["F15"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 69, 1, "F16", *group ); - buttons[0x45] = control; - controls.push_back( control ); - controls_by_name["F16"] = control; - group->add( *control ); + button = new Button ( 69, 1, "F16", *group ); + buttons[0x45] = button; + controls.push_back( button ); + controls_by_name["F16"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 39, 1, "global_solo", *group ); - buttons[0x27] = control; - controls.push_back( control ); - controls_by_name["global_solo"] = control; - group->add( *control ); + button = new Button ( 39, 1, "global_solo", *group ); + buttons[0x27] = button; + controls.push_back( button ); + controls_by_name["global_solo"] = button; + group->add( *button ); group = groups["modifiers"]; - control = new Button ( 80, 1, "option", *group ); - buttons[0x50] = control; - controls.push_back( control ); - controls_by_name["option"] = control; - group->add( *control ); + button = new Button ( 80, 1, "option", *group ); + buttons[0x50] = button; + controls.push_back( button ); + controls_by_name["option"] = button; + group->add( *button ); group = groups["modifiers"]; - control = new Button ( 73, 1, "cmd_alt", *group ); - buttons[0x49] = control; - controls.push_back( control ); - controls_by_name["cmd_alt"] = control; - group->add( *control ); + button = new Button ( 73, 1, "cmd_alt", *group ); + buttons[0x49] = button; + controls.push_back( button ); + controls_by_name["cmd_alt"] = button; + group->add( *button ); group = groups["automation"]; - control = new Button ( 74, 1, "on", *group ); - buttons[0x4a] = control; - controls.push_back( control ); - controls_by_name["on"] = control; - group->add( *control ); + button = new Button ( 74, 1, "on", *group ); + buttons[0x4a] = button; + controls.push_back( button ); + controls_by_name["on"] = button; + group->add( *button ); group = groups["automation"]; - control = new Button ( 75, 1, "rec_ready", *group ); - buttons[0x4b] = control; - controls.push_back( control ); - controls_by_name["rec_ready"] = control; - group->add( *control ); + button = new Button ( 75, 1, "rec_ready", *group ); + buttons[0x4b] = button; + controls.push_back( button ); + controls_by_name["rec_ready"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 76, 1, "undo", *group ); - buttons[0x4c] = control; - controls.push_back( control ); - controls_by_name["undo"] = control; - group->add( *control ); + button = new Button ( 76, 1, "undo", *group ); + buttons[0x4c] = button; + controls.push_back( button ); + controls_by_name["undo"] = button; + group->add( *button ); group = groups["automation"]; - control = new Button ( 77, 1, "snapshot", *group ); - buttons[0x4d] = control; - controls.push_back( control ); - controls_by_name["snapshot"] = control; - group->add( *control ); + button = new Button ( 77, 1, "snapshot", *group ); + buttons[0x4d] = button; + controls.push_back( button ); + controls_by_name["snapshot"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 79, 1, "redo", *group ); - buttons[0x4f] = control; - controls.push_back( control ); - controls_by_name["redo"] = control; - group->add( *control ); + button = new Button ( 79, 1, "redo", *group ); + buttons[0x4f] = button; + controls.push_back( button ); + controls_by_name["redo"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 71, 1, "marker", *group ); - buttons[0x47] = control; - controls.push_back( control ); - controls_by_name["marker"] = control; - group->add( *control ); + button = new Button ( 71, 1, "marker", *group ); + buttons[0x47] = button; + controls.push_back( button ); + controls_by_name["marker"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 81, 1, "enter", *group ); - buttons[0x51] = control; - controls.push_back( control ); - controls_by_name["enter"] = control; - group->add( *control ); + button = new Button ( 81, 1, "enter", *group ); + buttons[0x51] = button; + controls.push_back( button ); + controls_by_name["enter"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 82, 1, "cancel", *group ); - buttons[0x52] = control; - controls.push_back( control ); - controls_by_name["cancel"] = control; - group->add( *control ); + button = new Button ( 82, 1, "cancel", *group ); + buttons[0x52] = button; + controls.push_back( button ); + controls_by_name["cancel"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 83, 1, "mixer", *group ); - buttons[0x53] = control; - controls.push_back( control ); - controls_by_name["mixer"] = control; - group->add( *control ); + button = new Button ( 83, 1, "mixer", *group ); + buttons[0x53] = button; + controls.push_back( button ); + controls_by_name["mixer"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 91, 1, "frm_left", *group ); - buttons[0x5b] = control; - controls.push_back( control ); - controls_by_name["frm_left"] = control; - group->add( *control ); + button = new Button ( 91, 1, "frm_left", *group ); + buttons[0x5b] = button; + controls.push_back( button ); + controls_by_name["frm_left"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 92, 1, "frm_right", *group ); - buttons[0x5c] = control; - controls.push_back( control ); - controls_by_name["frm_right"] = control; - group->add( *control ); + button = new Button ( 92, 1, "frm_right", *group ); + buttons[0x5c] = button; + controls.push_back( button ); + controls_by_name["frm_right"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 70, 1, "loop", *group ); - buttons[0x46] = control; - controls.push_back( control ); - controls_by_name["loop"] = control; - group->add( *control ); + button = new Button ( 70, 1, "loop", *group ); + buttons[0x46] = button; + controls.push_back( button ); + controls_by_name["loop"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 72, 1, "punch_in", *group ); - buttons[0x48] = control; - controls.push_back( control ); - controls_by_name["punch_in"] = control; - group->add( *control ); + button = new Button ( 72, 1, "punch_in", *group ); + buttons[0x48] = button; + controls.push_back( button ); + controls_by_name["punch_in"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 78, 1, "punch_out", *group ); - buttons[0x4e] = control; - controls.push_back( control ); - controls_by_name["punch_out"] = control; - group->add( *control ); + button = new Button ( 78, 1, "punch_out", *group ); + buttons[0x4e] = button; + controls.push_back( button ); + controls_by_name["punch_out"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 42, 1, "home", *group ); - buttons[0x2a] = control; - controls.push_back( control ); - controls_by_name["home"] = control; - group->add( *control ); + button = new Button ( 42, 1, "home", *group ); + buttons[0x2a] = button; + controls.push_back( button ); + controls_by_name["home"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 41, 1, "end", *group ); - buttons[0x29] = control; - controls.push_back( control ); - controls_by_name["end"] = control; - group->add( *control ); + button = new Button ( 41, 1, "end", *group ); + buttons[0x29] = button; + controls.push_back( button ); + controls_by_name["end"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 44, 1, "rewind", *group ); - buttons[0x2c] = control; - controls.push_back( control ); - controls_by_name["rewind"] = control; - group->add( *control ); + button = new Button ( 44, 1, "rewind", *group ); + buttons[0x2c] = button; + controls.push_back( button ); + controls_by_name["rewind"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 43, 1, "ffwd", *group ); - buttons[0x2b] = control; - controls.push_back( control ); - controls_by_name["ffwd"] = control; - group->add( *control ); + button = new Button ( 43, 1, "ffwd", *group ); + buttons[0x2b] = button; + controls.push_back( button ); + controls_by_name["ffwd"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 93, 1, "stop", *group ); - buttons[0x5d] = control; - controls.push_back( control ); - controls_by_name["stop"] = control; - group->add( *control ); + button = new Button ( 93, 1, "stop", *group ); + buttons[0x5d] = button; + controls.push_back( button ); + controls_by_name["stop"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 94, 1, "play", *group ); - buttons[0x5e] = control; - controls.push_back( control ); - controls_by_name["play"] = control; - group->add( *control ); + button = new Button ( 94, 1, "play", *group ); + buttons[0x5e] = button; + controls.push_back( button ); + controls_by_name["play"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 31, 1, "record", *group ); - buttons[0x1f] = control; - controls.push_back( control ); - controls_by_name["record"] = control; - group->add( *control ); + button = new Button ( 31, 1, "record", *group ); + buttons[0x1f] = button; + controls.push_back( button ); + controls_by_name["record"] = button; + group->add( *button ); group = groups["cursor"]; - control = new Button ( 96, 1, "cursor_up", *group ); - buttons[0x60] = control; - controls.push_back( control ); - controls_by_name["cursor_up"] = control; - group->add( *control ); + button = new Button ( 96, 1, "cursor_up", *group ); + buttons[0x60] = button; + controls.push_back( button ); + controls_by_name["cursor_up"] = button; + group->add( *button ); group = groups["cursor"]; - control = new Button ( 97, 1, "cursor_down", *group ); - buttons[0x61] = control; - controls.push_back( control ); - controls_by_name["cursor_down"] = control; - group->add( *control ); + button = new Button ( 97, 1, "cursor_down", *group ); + buttons[0x61] = button; + controls.push_back( button ); + controls_by_name["cursor_down"] = button; + group->add( *button ); group = groups["cursor"]; - control = new Button ( 98, 1, "cursor_left", *group ); - buttons[0x62] = control; - controls.push_back( control ); - controls_by_name["cursor_left"] = control; - group->add( *control ); + button = new Button ( 98, 1, "cursor_left", *group ); + buttons[0x62] = button; + controls.push_back( button ); + controls_by_name["cursor_left"] = button; + group->add( *button ); group = groups["cursor"]; - control = new Button ( 99, 1, "cursor_right", *group ); - buttons[0x63] = control; - controls.push_back( control ); - controls_by_name["cursor_right"] = control; - group->add( *control ); + button = new Button ( 99, 1, "cursor_right", *group ); + buttons[0x63] = button; + controls.push_back( button ); + controls_by_name["cursor_right"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 100, 1, "zoom", *group ); - buttons[0x64] = control; - controls.push_back( control ); - controls_by_name["zoom"] = control; - group->add( *control ); + button = new Button ( 100, 1, "dyn", *group ); + buttons[0x64] = button; + controls.push_back( button ); + controls_by_name["dyn"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 101, 1, "scrub", *group ); - buttons[0x65] = control; - controls.push_back( control ); - controls_by_name["scrub"] = control; - group->add( *control ); + button = new Button ( 101, 1, "flip", *group ); + buttons[0x65] = button; + controls.push_back( button ); + controls_by_name["flip"] = button; + group->add( *button ); group = groups["user"]; - control = new Button ( 102, 1, "user_a", *group ); - buttons[0x66] = control; - controls.push_back( control ); - controls_by_name["user_a"] = control; - group->add( *control ); + button = new Button ( 102, 1, "user_a", *group ); + buttons[0x66] = button; + controls.push_back( button ); + controls_by_name["user_a"] = button; + group->add( *button ); group = groups["user"]; - control = new Button ( 103, 1, "user_b", *group ); - buttons[0x67] = control; - controls.push_back( control ); - controls_by_name["user_b"] = control; - group->add( *control ); + button = new Button ( 103, 1, "user_b", *group ); + buttons[0x67] = button; + controls.push_back( button ); + controls_by_name["user_b"] = button; + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 104, 1, "fader_touch", *group ); - buttons[0x68] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 104, 1, "fader_touch", *group ); + buttons[0x68] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 105, 2, "fader_touch", *group ); - buttons[0x69] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 105, 2, "fader_touch", *group ); + buttons[0x69] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 106, 3, "fader_touch", *group ); - buttons[0x6a] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 106, 3, "fader_touch", *group ); + buttons[0x6a] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 107, 4, "fader_touch", *group ); - buttons[0x6b] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 107, 4, "fader_touch", *group ); + buttons[0x6b] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 108, 5, "fader_touch", *group ); - buttons[0x6c] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 108, 5, "fader_touch", *group ); + buttons[0x6c] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 109, 6, "fader_touch", *group ); - buttons[0x6d] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 109, 6, "fader_touch", *group ); + buttons[0x6d] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 110, 7, "fader_touch", *group ); - buttons[0x6e] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 110, 7, "fader_touch", *group ); + buttons[0x6e] = button; + controls.push_back( button ); + group->add( *button ); group = groups["master"]; - control = new Button ( 111, 1, "fader_touch", *group ); - buttons[0x6f] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 111, 1, "fader_touch", *group ); + buttons[0x6f] = button; + controls.push_back( button ); + group->add( *button ); group = groups["master"]; - control = new Button ( 23, 1, "mute", *group ); - buttons[0x17] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 23, 1, "mute", *group ); + buttons[0x17] = button; + controls.push_back( button ); + group->add( *button ); group = groups["none"]; - control = new Button ( 51, 1, "clicking", *group ); - buttons[0x33] = control; - controls.push_back( control ); - controls_by_name["clicking"] = control; - group->add( *control ); + button = new Button ( 51, 1, "clicking", *group ); + buttons[0x33] = button; + controls.push_back( button ); + controls_by_name["clicking"] = button; + group->add( *button ); group = groups["none"]; - control = new Led ( 113, 1, "smpte", *group ); - leds[0x71] = control; - controls.push_back( control ); - controls_by_name["smpte"] = control; - group->add( *control ); + led = new Led ( 113, 1, "smpte", *group ); + leds[0x71] = led; + controls.push_back( led ); + controls_by_name["smpte"] = led; + group->add( *led ); group = groups["none"]; - control = new Led ( 114, 1, "beats", *group ); - leds[0x72] = control; - controls.push_back( control ); - controls_by_name["beats"] = control; - group->add( *control ); + led = new Led ( 114, 1, "beats", *group ); + leds[0x72] = led; + controls.push_back( led ); + controls_by_name["beats"] = led; + group->add( *led ); group = groups["none"]; - control = new Led ( 115, 1, "solo", *group ); - leds[0x73] = control; - controls.push_back( control ); - controls_by_name["solo"] = control; - group->add( *control ); + led = new Led ( 115, 1, "solo", *group ); + leds[0x73] = led; + controls.push_back( led ); + controls_by_name["solo"] = led; + group->add( *led ); group = groups["none"]; - control = new Led ( 118, 1, "relay_click", *group ); - leds[0x76] = control; - controls.push_back( control ); - controls_by_name["relay_click"] = control; - group->add( *control ); + led = new Led ( 118, 1, "relay_click", *group ); + leds[0x76] = led; + controls.push_back( led ); + controls_by_name["relay_click"] = led; + group->add( *led ); } @@ -974,10 +977,10 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b } break; - case 0x902d: // dyn + case 0x902d: // zoom switch ( bs ) { - case press: ls = mbh.dyn_press( button ); break; - case release: ls = mbh.dyn_release( button ); break; + case press: ls = mbh.zoom_press( button ); break; + case release: ls = mbh.zoom_release( button ); break; case neither: break; } break; @@ -1014,10 +1017,10 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b } break; - case 0x9032: // flip + case 0x9032: // scrub switch ( bs ) { - case press: ls = mbh.flip_press( button ); break; - case release: ls = mbh.flip_release( button ); break; + case press: ls = mbh.scrub_press( button ); break; + case release: ls = mbh.scrub_release( button ); break; case neither: break; } break; @@ -1398,18 +1401,18 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b } break; - case 0x9064: // zoom + case 0x9064: // dyn switch ( bs ) { - case press: ls = mbh.zoom_press( button ); break; - case release: ls = mbh.zoom_release( button ); break; + case press: ls = mbh.dyn_press( button ); break; + case release: ls = mbh.dyn_release( button ); break; case neither: break; } break; - case 0x9065: // scrub + case 0x9065: // flip switch ( bs ) { - case press: ls = mbh.scrub_press( button ); break; - case release: ls = mbh.scrub_release( button ); break; + case press: ls = mbh.flip_press( button ); break; + case release: ls = mbh.flip_release( button ); break; case neither: break; } break; diff --git a/libs/surfaces/mackie/controls.h b/libs/surfaces/mackie/controls.h index ed9e8b79fb..453ef4a091 100644 --- a/libs/surfaces/mackie/controls.h +++ b/libs/surfaces/mackie/controls.h @@ -267,9 +267,13 @@ public: } virtual type_t type() const { return type_button; }; + + bool pressed() const { return _pressed; } + Button & pressed( bool rhs ) { _pressed = rhs; return *this; } private: Led _led; + bool _pressed; }; class LedRing : public Led diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 1ed4dac038..f648ed059e 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -99,6 +99,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session) , _polling( true ) , pfd( 0 ) , nfds( 0 ) + , _jog_wheel( *this ) { #ifdef DEBUG cout << "MackieControlProtocol::MackieControlProtocol" << endl; @@ -907,27 +908,17 @@ void MackieControlProtocol::handle_control_event( SurfacePort & port, Control & { if ( control.name() == "jog" ) { - // TODO use current snap-to setting? - long delta = state.ticks * 1000; - nframes_t next = session->transport_frame() + delta; - if ( delta < 0 && session->transport_frame() < (nframes_t) abs( delta ) ) - { - next = session->current_start_frame(); - } - else if ( next > session->current_end_frame() ) - { - next = session->current_end_frame(); - } - - // doesn't work very well - session->request_locate( next, session->transport_rolling() ); + _jog_wheel.jog_event( port, control, state ); // turn off the led ring, for bcf emulation mode - port.write( builder.build_led_ring( dynamic_cast<Pot &>( control ), off ) ); + if ( mcu_port().emulation() == MackiePort::bcf2000 ) + { + port.write( builder.build_led_ring( dynamic_cast<Pot &>( control ), off ) ); + } } else { - cout << "external controller" << state.ticks << endl; + cout << "external controller" << state.ticks * state.sign << endl; } } break; @@ -1186,12 +1177,16 @@ LedState MackieControlProtocol::record_release( Button & button ) LedState MackieControlProtocol::rewind_press( Button & button ) { - session->request_transport_speed( -4.0 ); + _jog_wheel.push( JogWheel::speed ); + _jog_wheel.transport_direction( -1 ); + session->request_transport_speed( -_jog_wheel.transport_speed() ); return on; } LedState MackieControlProtocol::rewind_release( Button & button ) { + _jog_wheel.pop(); + _jog_wheel.transport_direction( 0 ); if ( _transport_previously_rolling ) session->request_transport_speed( 1.0 ); else @@ -1201,12 +1196,16 @@ LedState MackieControlProtocol::rewind_release( Button & button ) LedState MackieControlProtocol::ffwd_press( Button & button ) { - session->request_transport_speed( 4.0 ); + _jog_wheel.push( JogWheel::speed ); + _jog_wheel.transport_direction( 1 ); + session->request_transport_speed( _jog_wheel.transport_speed() ); return on; } LedState MackieControlProtocol::ffwd_release( Button & button ) { + _jog_wheel.pop(); + _jog_wheel.transport_direction( 0 ); if ( _transport_previously_rolling ) session->request_transport_speed( 1.0 ); else @@ -1506,3 +1505,50 @@ LedState MackieControlProtocol::marker_release( Button & button ) { return off; } + +void jog_wheel_state_display( JogWheel::State state, MackiePort & port ) +{ + switch( state ) + { + case JogWheel::zoom: port.write( builder.two_char_display( "Zm" ) ); break; + case JogWheel::scroll: port.write( builder.two_char_display( "Sc" ) ); break; + case JogWheel::scrub: port.write( builder.two_char_display( "Sb" ) ); break; + case JogWheel::shuttle: port.write( builder.two_char_display( "Sh" ) ); break; + case JogWheel::speed: port.write( builder.two_char_display( "Sp" ) ); break; + case JogWheel::select: port.write( builder.two_char_display( "Se" ) ); break; + } +} + +Mackie::LedState MackieControlProtocol::zoom_press( Mackie::Button & ) +{ + _jog_wheel.zoom_state_toggle(); + update_global_button( "scrub", _jog_wheel.jog_wheel_state() == JogWheel::scrub ); + jog_wheel_state_display( _jog_wheel.jog_wheel_state(), mcu_port() ); + return _jog_wheel.jog_wheel_state() == JogWheel::zoom; +} + +Mackie::LedState MackieControlProtocol::zoom_release( Mackie::Button & ) +{ + return _jog_wheel.jog_wheel_state() == JogWheel::zoom; +} + +Mackie::LedState MackieControlProtocol::scrub_press( Mackie::Button & ) +{ + _jog_wheel.scrub_state_cycle(); + update_global_button( "zoom", _jog_wheel.jog_wheel_state() == JogWheel::zoom ); + jog_wheel_state_display( _jog_wheel.jog_wheel_state(), mcu_port() ); + return + _jog_wheel.jog_wheel_state() == JogWheel::scrub + || + _jog_wheel.jog_wheel_state() == JogWheel::shuttle + ; +} + +Mackie::LedState MackieControlProtocol::scrub_release( Mackie::Button & ) +{ + return + _jog_wheel.jog_wheel_state() == JogWheel::scrub + || + _jog_wheel.jog_wheel_state() == JogWheel::shuttle + ; +} diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index e1b3fb5b4e..112b5c3f0f 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -35,6 +35,7 @@ #include "route_signal.h" #include "mackie_button_handler.h" #include "mackie_port.h" +#include "mackie_jog_wheel.h" #include "timer.h" namespace MIDI { @@ -184,6 +185,19 @@ class MackieControlProtocol virtual Mackie::LedState marker_press( Mackie::Button & ); virtual Mackie::LedState marker_release( Mackie::Button & ); + // jog wheel states + virtual Mackie::LedState zoom_press( Mackie::Button & ); + virtual Mackie::LedState zoom_release( Mackie::Button & ); + + virtual Mackie::LedState scrub_press( Mackie::Button & ); + virtual Mackie::LedState scrub_release( Mackie::Button & ); + + /// This is the main MCU port, ie not an extender port + /// Only for use by JogWheel + const Mackie::MackiePort & mcu_port() const; + Mackie::MackiePort & mcu_port(); + ARDOUR::Session & get_session() { return *session; } + protected: // create instances of MackiePort, depending on what's found in ardour.rc void create_ports(); @@ -222,10 +236,6 @@ class MackieControlProtocol // delete all RouteSignal objects connecting Routes to Strips void clear_route_signals(); - /// This is the main MCU port, ie not an extender port - const Mackie::MackiePort & mcu_port() const; - Mackie::MackiePort & mcu_port(); - typedef std::vector<Mackie::RouteSignal*> RouteSignals; RouteSignals route_signals; @@ -318,6 +328,8 @@ class MackieControlProtocol // timer for two quick marker left presses Mackie::Timer _frm_left_last; + + Mackie::JogWheel _jog_wheel; }; #endif // ardour_mackie_control_protocol_h diff --git a/libs/surfaces/mackie/mackie_control_protocol_poll.cc b/libs/surfaces/mackie/mackie_control_protocol_poll.cc index 6ae2da071e..a9e946cd7f 100644 --- a/libs/surfaces/mackie/mackie_control_protocol_poll.cc +++ b/libs/surfaces/mackie/mackie_control_protocol_poll.cc @@ -55,8 +55,6 @@ void * MackieControlProtocol::monitor_work() { if ( poll_ports() ) { - cout << "--------------------------------------" << endl; - cout << "MackieControlProtocol::read_ports _ports: " << _ports.size() << ", nfds: " << nfds << endl; try { read_ports(); } catch ( exception & e ) { cout << "MackieControlProtocol::poll_ports caught exception: " << e.what() << endl; @@ -66,6 +64,9 @@ void * MackieControlProtocol::monitor_work() } // poll for automation data from the routes poll_automation(); + + // check if we need to stop scrubbing + _jog_wheel.check_scrubbing(); } catch ( exception & e ) { diff --git a/libs/surfaces/mackie/mackie_jog_wheel.cc b/libs/surfaces/mackie/mackie_jog_wheel.cc new file mode 100644 index 0000000000..481c45bffc --- /dev/null +++ b/libs/surfaces/mackie/mackie_jog_wheel.cc @@ -0,0 +1,218 @@ +#include "mackie_jog_wheel.h" + +#include "mackie_control_protocol.h" +#include "surface_port.h" +#include "controls.h" + +#include <algorithm> + +using namespace Mackie; + +JogWheel::JogWheel( MackieControlProtocol & mcp ) +: _mcp( mcp ) +, _transport_speed( 4.0 ) +, _transport_direction( 0 ) +, _shuttle_speed( 0.0 ) +{ +} + +JogWheel::State JogWheel::jog_wheel_state() const +{ + if ( !_jog_wheel_states.empty() ) + return _jog_wheel_states.top(); + else + return scroll; +} + +void JogWheel::zoom_event( SurfacePort & port, Control & control, const ControlState & state ) +{ +} + +void JogWheel::scrub_event( SurfacePort & port, Control & control, const ControlState & state ) +{ +} + +void JogWheel::speed_event( SurfacePort & port, Control & control, const ControlState & state ) +{ +} + +void JogWheel::scroll_event( SurfacePort & port, Control & control, const ControlState & state ) +{ +} + +float scaled_delta( const ControlState & state, float current_speed ) +{ + return state.sign * ( pow( state.ticks + 1, 2 ) + current_speed ) / 100.0; +} + +void JogWheel::jog_event( SurfacePort & port, Control & control, const ControlState & state ) +{ +// TODO use current snap-to setting? +#if 0 + long delta = state.ticks * sign * 1000; + nframes_t next = session->transport_frame() + delta; + if ( delta < 0 && session->transport_frame() < (nframes_t) abs( delta ) ) + { + next = session->current_start_frame(); + } + else if ( next > session->current_end_frame() ) + { + next = session->current_end_frame(); + } + + // doesn't work very well + session->request_locate( next, session->transport_rolling() ); +#endif + + switch ( jog_wheel_state() ) + { + case scroll: + //ScrollTimeline causes crashes + if ( _mcp.mcu_port().emulation() == MackiePort::bcf2000 ) + _mcp.ScrollTimeline( state.ticks * state.sign / 100.0 ); + else + _mcp.ScrollTimeline( state.ticks * state.sign / 100.0 ); + break; + + case zoom: + // TODO do a for loop for each, to number of ticks + if ( state.sign > 0 ) + for ( unsigned int i = 0; i < state.ticks; ++i ) _mcp.ZoomIn(); + else + for ( unsigned int i = 0; i < state.ticks; ++i ) _mcp.ZoomOut(); + break; + + case speed: + { + // block because we initialize a variable + // locally, _transport_speed is an absolute value... + // fairly arbitrary scaling function + _transport_speed += scaled_delta( state, _mcp.get_session().transport_speed() ); + + // make sure not weirdness get so the session + if ( _transport_speed < 0 || isnan( _transport_speed ) ) + { + _transport_speed = 0.0; + } + + // translated current speed to a signed transport velocity + _mcp.get_session().request_transport_speed( transport_speed() * transport_direction() ); + break; + } + + case scrub: + { + add_scrub_interval( _scrub_timer.restart() ); + // copied from tranzport driver + float speed = 0.0; + + // This should really be part of the surface object + if ( _mcp.mcu_port().emulation() == MackiePort::bcf2000 ) + // 5 clicks per second => speed == 1.0 + speed = 50.0 / average_scrub_interval() * state.ticks; + else + // 10 clicks per second => speed == 1.0 + speed = 100.0 / average_scrub_interval() * state.ticks; + + _mcp.get_session().request_transport_speed( speed * state.sign ); + break; + } + + case shuttle: + _shuttle_speed = _mcp.get_session().transport_speed(); + _shuttle_speed += scaled_delta( state, _mcp.get_session().transport_speed() ); + _mcp.get_session().request_transport_speed( _shuttle_speed ); + break; + + case select: + cout << "JogWheel select not implemented" << endl; + break; + } +} + +void JogWheel::check_scrubbing() +{ + // if the last elapsed is greater than the average + std deviation, then stop + if ( !_scrub_intervals.empty() && _scrub_timer.elapsed() > average_scrub_interval() + std_dev_scrub_interval() ) + { + _mcp.get_session().request_transport_speed( 0.0 ); + _scrub_intervals.clear(); + } +} + +void JogWheel::push( State state ) +{ + _jog_wheel_states.push( state ); +} + +void JogWheel::pop() +{ + if ( _jog_wheel_states.size() > 0 ) + { + _jog_wheel_states.pop(); + } +} + +void JogWheel::zoom_state_toggle() +{ + if ( jog_wheel_state() == zoom ) + pop(); + else + push( zoom ); +} + +JogWheel::State JogWheel::scrub_state_cycle() +{ + State top = jog_wheel_state(); + if ( top == scrub ) + { + // stop scrubbing and go to shuttle + pop(); + push( shuttle ); + _shuttle_speed = 0.0; + } + else if ( top == shuttle ) + { + // default to scroll, or the last selected + pop(); + } + else + { + // start with scrub + push( scrub ); + } + + return jog_wheel_state(); +} + +void JogWheel::add_scrub_interval( unsigned long elapsed ) +{ + if ( _scrub_intervals.size() > 5 ) + { + _scrub_intervals.pop_front(); + } + _scrub_intervals.push_back( elapsed ); +} + +float JogWheel::average_scrub_interval() +{ + float sum = 0.0; + for ( std::deque<unsigned long>::iterator it = _scrub_intervals.begin(); it != _scrub_intervals.end(); ++it ) + { + sum += *it; + } + return sum / _scrub_intervals.size(); +} + +float JogWheel::std_dev_scrub_interval() +{ + float average = average_scrub_interval(); + + // calculate standard deviation + float sum = 0.0; + for ( std::deque<unsigned long>::iterator it = _scrub_intervals.begin(); it != _scrub_intervals.end(); ++it ) + { + sum += pow( *it - average, 2 ); + } + return sqrt( sum / _scrub_intervals.size() -1 ); +} diff --git a/libs/surfaces/mackie/mackie_jog_wheel.h b/libs/surfaces/mackie/mackie_jog_wheel.h new file mode 100644 index 0000000000..c22b75bd1b --- /dev/null +++ b/libs/surfaces/mackie/mackie_jog_wheel.h @@ -0,0 +1,102 @@ +#ifndef mackie_jog_wheel +#define mackie_jog_wheel + +#include "timer.h" + +#include <stack> +#include <deque> +#include <queue> + +class MackieControlProtocol; + +namespace Mackie +{ + +class SurfacePort; +class Control; +class ControlState; + +/** + A jog wheel can be used to control many things. This + handles all of the states and state transitions. + + Mainly it exists to avoid putting a bunch of messy + stuff in MackieControlProtocol. + + But it doesn't really know who it is, with stacks, queues and various + boolean state variables. +*/ +class JogWheel +{ +public: + enum State { scroll, zoom, speed, scrub, shuttle, select }; + + JogWheel( MackieControlProtocol & mcp ); + + /// As the wheel turns... + void jog_event( SurfacePort & port, Control & control, const ControlState & state ); + + // These are for incoming button presses that change the internal state + // but they're not actually used at the moment. + void zoom_event( SurfacePort & port, Control & control, const ControlState & state ); + void scrub_event( SurfacePort & port, Control & control, const ControlState & state ); + void speed_event( SurfacePort & port, Control & control, const ControlState & state ); + void scroll_event( SurfacePort & port, Control & control, const ControlState & state ); + + /// Return the current jog wheel mode, which defaults to Scroll + State jog_wheel_state() const; + + /// The current transport speed for ffwd and rew. Can be + /// set by wheel when they're pressed. + float transport_speed() const { return _transport_speed; } + + /// one of -1,0,1 + int transport_direction() const { return _transport_direction; } + void transport_direction( int rhs ) { _transport_direction = rhs; } + + void push( State state ); + void pop(); + + /// Turn zoom mode on and off + void zoom_state_toggle(); + + /** + Cycle scrub -> shuttle -> previous + */ + State scrub_state_cycle(); + + /// Check to see when the last scrub event was + /// And stop scrubbing if it was too long ago. + /// Intended to be called from a periodic timer of + /// some kind. + void check_scrubbing(); + +protected: + void add_scrub_interval( unsigned long elapsed ); + float average_scrub_interval(); + float std_dev_scrub_interval(); + +private: + MackieControlProtocol & _mcp; + + // transport speed for ffwd and rew, controller by jog + float _transport_speed; + int _transport_direction; + + /// Speed for shuttle + float _shuttle_speed; + + /// a stack for keeping track of states + std::stack<State> _jog_wheel_states; + + /// So we know how fast to set the transport speed while scrubbing + Timer _scrub_timer; + + /// to keep track of what the current scrub rate is + /// so we can calculate a moving average + std::deque<unsigned long> _scrub_intervals; +}; + +} + +#endif diff --git a/libs/surfaces/mackie/mackie_port.cc b/libs/surfaces/mackie/mackie_port.cc index 26c3612a86..2a859702dc 100644 --- a/libs/surfaces/mackie/mackie_port.cc +++ b/libs/surfaces/mackie/mackie_port.cc @@ -408,9 +408,9 @@ void MackiePort::handle_midi_any (MIDI::Parser & parser, MIDI::byte * raw_bytes, ControlState state; // bytes[2] & 0b01000000 (0x40) give sign - int sign = ( bytes[2] & 0x40 ) == 0 ? 1 : -1; + state.sign = ( bytes[2] & 0x40 ) == 0 ? 1 : -1; // bytes[2] & 0b00111111 (0x3f) gives delta - state.ticks = ( bytes[2] & 0x3f) * sign; + state.ticks = ( bytes[2] & 0x3f); state.delta = float( state.ticks ) / float( 0x3f ); control_event( *this, control, state ); diff --git a/libs/surfaces/mackie/mackie_surface.cc b/libs/surfaces/mackie/mackie_surface.cc index 8d10814b55..7b0344b683 100644 --- a/libs/surfaces/mackie/mackie_surface.cc +++ b/libs/surfaces/mackie/mackie_surface.cc @@ -85,893 +85,896 @@ void Mackie::MackieSurface::init_controls() // initialise controls - Control * control = 0; + Fader * fader = 0; + Pot * pot = 0; + Button * button = 0; + Led * led = 0; group = groups["strip_1"]; - control = new Fader ( 0, 1, "gain", *group ); - faders[0x00] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 0, 1, "gain", *group ); + faders[0x00] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_2"]; - control = new Fader ( 1, 2, "gain", *group ); - faders[0x01] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 1, 2, "gain", *group ); + faders[0x01] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_3"]; - control = new Fader ( 2, 3, "gain", *group ); - faders[0x02] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 2, 3, "gain", *group ); + faders[0x02] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_4"]; - control = new Fader ( 3, 4, "gain", *group ); - faders[0x03] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 3, 4, "gain", *group ); + faders[0x03] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_5"]; - control = new Fader ( 4, 5, "gain", *group ); - faders[0x04] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 4, 5, "gain", *group ); + faders[0x04] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_6"]; - control = new Fader ( 5, 6, "gain", *group ); - faders[0x05] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 5, 6, "gain", *group ); + faders[0x05] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_7"]; - control = new Fader ( 6, 7, "gain", *group ); - faders[0x06] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 6, 7, "gain", *group ); + faders[0x06] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_8"]; - control = new Fader ( 7, 8, "gain", *group ); - faders[0x07] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 7, 8, "gain", *group ); + faders[0x07] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["master"]; - control = new Fader ( 8, 1, "gain", *group ); - faders[0x08] = control; - controls.push_back( control ); - group->add( *control ); + fader = new Fader ( 8, 1, "gain", *group ); + faders[0x08] = fader; + controls.push_back( fader ); + group->add( *fader ); group = groups["strip_1"]; - control = new Pot ( 16, 1, "vpot", *group ); - pots[0x10] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 16, 1, "vpot", *group ); + pots[0x10] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_2"]; - control = new Pot ( 17, 2, "vpot", *group ); - pots[0x11] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 17, 2, "vpot", *group ); + pots[0x11] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_3"]; - control = new Pot ( 18, 3, "vpot", *group ); - pots[0x12] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 18, 3, "vpot", *group ); + pots[0x12] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_4"]; - control = new Pot ( 19, 4, "vpot", *group ); - pots[0x13] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 19, 4, "vpot", *group ); + pots[0x13] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_5"]; - control = new Pot ( 20, 5, "vpot", *group ); - pots[0x14] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 20, 5, "vpot", *group ); + pots[0x14] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_6"]; - control = new Pot ( 21, 6, "vpot", *group ); - pots[0x15] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 21, 6, "vpot", *group ); + pots[0x15] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_7"]; - control = new Pot ( 22, 7, "vpot", *group ); - pots[0x16] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 22, 7, "vpot", *group ); + pots[0x16] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["strip_8"]; - control = new Pot ( 23, 8, "vpot", *group ); - pots[0x17] = control; - controls.push_back( control ); - group->add( *control ); + pot = new Pot ( 23, 8, "vpot", *group ); + pots[0x17] = pot; + controls.push_back( pot ); + group->add( *pot ); group = groups["none"]; - control = new Pot ( 60, 1, "jog", *group ); - pots[0x3c] = control; - controls.push_back( control ); - controls_by_name["jog"] = control; - group->add( *control ); + pot = new Pot ( 60, 1, "jog", *group ); + pots[0x3c] = pot; + controls.push_back( pot ); + controls_by_name["jog"] = pot; + group->add( *pot ); group = groups["none"]; - control = new Pot ( 46, 1, "external", *group ); - pots[0x2e] = control; - controls.push_back( control ); - controls_by_name["external"] = control; - group->add( *control ); + pot = new Pot ( 46, 1, "external", *group ); + pots[0x2e] = pot; + controls.push_back( pot ); + controls_by_name["external"] = pot; + group->add( *pot ); group = groups["strip_1"]; - control = new Button ( 0, 1, "recenable", *group ); - buttons[0x00] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 0, 1, "recenable", *group ); + buttons[0x00] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 1, 2, "recenable", *group ); - buttons[0x01] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 1, 2, "recenable", *group ); + buttons[0x01] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 2, 3, "recenable", *group ); - buttons[0x02] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 2, 3, "recenable", *group ); + buttons[0x02] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 3, 4, "recenable", *group ); - buttons[0x03] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 3, 4, "recenable", *group ); + buttons[0x03] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 4, 5, "recenable", *group ); - buttons[0x04] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 4, 5, "recenable", *group ); + buttons[0x04] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 5, 6, "recenable", *group ); - buttons[0x05] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 5, 6, "recenable", *group ); + buttons[0x05] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 6, 7, "recenable", *group ); - buttons[0x06] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 6, 7, "recenable", *group ); + buttons[0x06] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_8"]; - control = new Button ( 7, 8, "recenable", *group ); - buttons[0x07] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 7, 8, "recenable", *group ); + buttons[0x07] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 8, 1, "solo", *group ); - buttons[0x08] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 8, 1, "solo", *group ); + buttons[0x08] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 9, 2, "solo", *group ); - buttons[0x09] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 9, 2, "solo", *group ); + buttons[0x09] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 10, 3, "solo", *group ); - buttons[0x0a] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 10, 3, "solo", *group ); + buttons[0x0a] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 11, 4, "solo", *group ); - buttons[0x0b] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 11, 4, "solo", *group ); + buttons[0x0b] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 12, 5, "solo", *group ); - buttons[0x0c] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 12, 5, "solo", *group ); + buttons[0x0c] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 13, 6, "solo", *group ); - buttons[0x0d] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 13, 6, "solo", *group ); + buttons[0x0d] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 14, 7, "solo", *group ); - buttons[0x0e] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 14, 7, "solo", *group ); + buttons[0x0e] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_8"]; - control = new Button ( 15, 8, "solo", *group ); - buttons[0x0f] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 15, 8, "solo", *group ); + buttons[0x0f] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 16, 1, "mute", *group ); - buttons[0x10] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 16, 1, "mute", *group ); + buttons[0x10] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 17, 2, "mute", *group ); - buttons[0x11] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 17, 2, "mute", *group ); + buttons[0x11] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 18, 3, "mute", *group ); - buttons[0x12] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 18, 3, "mute", *group ); + buttons[0x12] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 19, 4, "mute", *group ); - buttons[0x13] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 19, 4, "mute", *group ); + buttons[0x13] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 20, 5, "mute", *group ); - buttons[0x14] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 20, 5, "mute", *group ); + buttons[0x14] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 21, 6, "mute", *group ); - buttons[0x15] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 21, 6, "mute", *group ); + buttons[0x15] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 22, 7, "mute", *group ); - buttons[0x16] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 22, 7, "mute", *group ); + buttons[0x16] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_8"]; - control = new Button ( 23, 8, "mute", *group ); - buttons[0x17] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 23, 8, "mute", *group ); + buttons[0x17] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 24, 1, "select", *group ); - buttons[0x18] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 24, 1, "select", *group ); + buttons[0x18] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 25, 2, "select", *group ); - buttons[0x19] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 25, 2, "select", *group ); + buttons[0x19] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 26, 3, "select", *group ); - buttons[0x1a] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 26, 3, "select", *group ); + buttons[0x1a] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 27, 4, "select", *group ); - buttons[0x1b] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 27, 4, "select", *group ); + buttons[0x1b] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 28, 5, "select", *group ); - buttons[0x1c] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 28, 5, "select", *group ); + buttons[0x1c] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 29, 6, "select", *group ); - buttons[0x1d] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 29, 6, "select", *group ); + buttons[0x1d] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 30, 7, "select", *group ); - buttons[0x1e] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 30, 7, "select", *group ); + buttons[0x1e] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_8"]; - control = new Button ( 31, 8, "select", *group ); - buttons[0x1f] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 31, 8, "select", *group ); + buttons[0x1f] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 32, 1, "vselect", *group ); - buttons[0x20] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 32, 1, "vselect", *group ); + buttons[0x20] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 33, 2, "vselect", *group ); - buttons[0x21] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 33, 2, "vselect", *group ); + buttons[0x21] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 34, 3, "vselect", *group ); - buttons[0x22] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 34, 3, "vselect", *group ); + buttons[0x22] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 35, 4, "vselect", *group ); - buttons[0x23] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 35, 4, "vselect", *group ); + buttons[0x23] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 36, 5, "vselect", *group ); - buttons[0x24] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 36, 5, "vselect", *group ); + buttons[0x24] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 37, 6, "vselect", *group ); - buttons[0x25] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 37, 6, "vselect", *group ); + buttons[0x25] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 38, 7, "vselect", *group ); - buttons[0x26] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 38, 7, "vselect", *group ); + buttons[0x26] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_8"]; - control = new Button ( 39, 8, "vselect", *group ); - buttons[0x27] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 39, 8, "vselect", *group ); + buttons[0x27] = button; + controls.push_back( button ); + group->add( *button ); group = groups["assignment"]; - control = new Button ( 40, 1, "io", *group ); - buttons[0x28] = control; - controls.push_back( control ); - controls_by_name["io"] = control; - group->add( *control ); + button = new Button ( 40, 1, "io", *group ); + buttons[0x28] = button; + controls.push_back( button ); + controls_by_name["io"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 41, 1, "sends", *group ); - buttons[0x29] = control; - controls.push_back( control ); - controls_by_name["sends"] = control; - group->add( *control ); + button = new Button ( 41, 1, "sends", *group ); + buttons[0x29] = button; + controls.push_back( button ); + controls_by_name["sends"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 42, 1, "pan", *group ); - buttons[0x2a] = control; - controls.push_back( control ); - controls_by_name["pan"] = control; - group->add( *control ); + button = new Button ( 42, 1, "pan", *group ); + buttons[0x2a] = button; + controls.push_back( button ); + controls_by_name["pan"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 43, 1, "plugin", *group ); - buttons[0x2b] = control; - controls.push_back( control ); - controls_by_name["plugin"] = control; - group->add( *control ); + button = new Button ( 43, 1, "plugin", *group ); + buttons[0x2b] = button; + controls.push_back( button ); + controls_by_name["plugin"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 44, 1, "eq", *group ); - buttons[0x2c] = control; - controls.push_back( control ); - controls_by_name["eq"] = control; - group->add( *control ); + button = new Button ( 44, 1, "eq", *group ); + buttons[0x2c] = button; + controls.push_back( button ); + controls_by_name["eq"] = button; + group->add( *button ); group = groups["assignment"]; - control = new Button ( 45, 1, "dyn", *group ); - buttons[0x2d] = control; - controls.push_back( control ); - controls_by_name["dyn"] = control; - group->add( *control ); + button = new Button ( 45, 1, "dyn", *group ); + buttons[0x2d] = button; + controls.push_back( button ); + controls_by_name["dyn"] = button; + group->add( *button ); group = groups["bank"]; - control = new Button ( 46, 1, "left", *group ); - buttons[0x2e] = control; - controls.push_back( control ); - controls_by_name["left"] = control; - group->add( *control ); + button = new Button ( 46, 1, "left", *group ); + buttons[0x2e] = button; + controls.push_back( button ); + controls_by_name["left"] = button; + group->add( *button ); group = groups["bank"]; - control = new Button ( 47, 1, "right", *group ); - buttons[0x2f] = control; - controls.push_back( control ); - controls_by_name["right"] = control; - group->add( *control ); + button = new Button ( 47, 1, "right", *group ); + buttons[0x2f] = button; + controls.push_back( button ); + controls_by_name["right"] = button; + group->add( *button ); group = groups["bank"]; - control = new Button ( 48, 1, "channel_left", *group ); - buttons[0x30] = control; - controls.push_back( control ); - controls_by_name["channel_left"] = control; - group->add( *control ); + button = new Button ( 48, 1, "channel_left", *group ); + buttons[0x30] = button; + controls.push_back( button ); + controls_by_name["channel_left"] = button; + group->add( *button ); group = groups["bank"]; - control = new Button ( 49, 1, "channel_right", *group ); - buttons[0x31] = control; - controls.push_back( control ); - controls_by_name["channel_right"] = control; - group->add( *control ); + button = new Button ( 49, 1, "channel_right", *group ); + buttons[0x31] = button; + controls.push_back( button ); + controls_by_name["channel_right"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 50, 1, "flip", *group ); - buttons[0x32] = control; - controls.push_back( control ); - controls_by_name["flip"] = control; - group->add( *control ); + button = new Button ( 50, 1, "flip", *group ); + buttons[0x32] = button; + controls.push_back( button ); + controls_by_name["flip"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 51, 1, "edit", *group ); - buttons[0x33] = control; - controls.push_back( control ); - controls_by_name["edit"] = control; - group->add( *control ); + button = new Button ( 51, 1, "edit", *group ); + buttons[0x33] = button; + controls.push_back( button ); + controls_by_name["edit"] = button; + group->add( *button ); group = groups["display"]; - control = new Button ( 52, 1, "name_value", *group ); - buttons[0x34] = control; - controls.push_back( control ); - controls_by_name["name_value"] = control; - group->add( *control ); + button = new Button ( 52, 1, "name_value", *group ); + buttons[0x34] = button; + controls.push_back( button ); + controls_by_name["name_value"] = button; + group->add( *button ); group = groups["display"]; - control = new Button ( 53, 1, "smpte_beats", *group ); - buttons[0x35] = control; - controls.push_back( control ); - controls_by_name["smpte_beats"] = control; - group->add( *control ); + button = new Button ( 53, 1, "smpte_beats", *group ); + buttons[0x35] = button; + controls.push_back( button ); + controls_by_name["smpte_beats"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 54, 1, "F1", *group ); - buttons[0x36] = control; - controls.push_back( control ); - controls_by_name["F1"] = control; - group->add( *control ); + button = new Button ( 54, 1, "F1", *group ); + buttons[0x36] = button; + controls.push_back( button ); + controls_by_name["F1"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 55, 1, "F2", *group ); - buttons[0x37] = control; - controls.push_back( control ); - controls_by_name["F2"] = control; - group->add( *control ); + button = new Button ( 55, 1, "F2", *group ); + buttons[0x37] = button; + controls.push_back( button ); + controls_by_name["F2"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 56, 1, "F3", *group ); - buttons[0x38] = control; - controls.push_back( control ); - controls_by_name["F3"] = control; - group->add( *control ); + button = new Button ( 56, 1, "F3", *group ); + buttons[0x38] = button; + controls.push_back( button ); + controls_by_name["F3"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 57, 1, "F4", *group ); - buttons[0x39] = control; - controls.push_back( control ); - controls_by_name["F4"] = control; - group->add( *control ); + button = new Button ( 57, 1, "F4", *group ); + buttons[0x39] = button; + controls.push_back( button ); + controls_by_name["F4"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 58, 1, "F5", *group ); - buttons[0x3a] = control; - controls.push_back( control ); - controls_by_name["F5"] = control; - group->add( *control ); + button = new Button ( 58, 1, "F5", *group ); + buttons[0x3a] = button; + controls.push_back( button ); + controls_by_name["F5"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 59, 1, "F6", *group ); - buttons[0x3b] = control; - controls.push_back( control ); - controls_by_name["F6"] = control; - group->add( *control ); + button = new Button ( 59, 1, "F6", *group ); + buttons[0x3b] = button; + controls.push_back( button ); + controls_by_name["F6"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 60, 1, "F7", *group ); - buttons[0x3c] = control; - controls.push_back( control ); - controls_by_name["F7"] = control; - group->add( *control ); + button = new Button ( 60, 1, "F7", *group ); + buttons[0x3c] = button; + controls.push_back( button ); + controls_by_name["F7"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 61, 1, "F8", *group ); - buttons[0x3d] = control; - controls.push_back( control ); - controls_by_name["F8"] = control; - group->add( *control ); + button = new Button ( 61, 1, "F8", *group ); + buttons[0x3d] = button; + controls.push_back( button ); + controls_by_name["F8"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 62, 1, "F9", *group ); - buttons[0x3e] = control; - controls.push_back( control ); - controls_by_name["F9"] = control; - group->add( *control ); + button = new Button ( 62, 1, "F9", *group ); + buttons[0x3e] = button; + controls.push_back( button ); + controls_by_name["F9"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 63, 1, "F10", *group ); - buttons[0x3f] = control; - controls.push_back( control ); - controls_by_name["F10"] = control; - group->add( *control ); + button = new Button ( 63, 1, "F10", *group ); + buttons[0x3f] = button; + controls.push_back( button ); + controls_by_name["F10"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 64, 1, "F11", *group ); - buttons[0x40] = control; - controls.push_back( control ); - controls_by_name["F11"] = control; - group->add( *control ); + button = new Button ( 64, 1, "F11", *group ); + buttons[0x40] = button; + controls.push_back( button ); + controls_by_name["F11"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 65, 1, "F12", *group ); - buttons[0x41] = control; - controls.push_back( control ); - controls_by_name["F12"] = control; - group->add( *control ); + button = new Button ( 65, 1, "F12", *group ); + buttons[0x41] = button; + controls.push_back( button ); + controls_by_name["F12"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 66, 1, "F13", *group ); - buttons[0x42] = control; - controls.push_back( control ); - controls_by_name["F13"] = control; - group->add( *control ); + button = new Button ( 66, 1, "F13", *group ); + buttons[0x42] = button; + controls.push_back( button ); + controls_by_name["F13"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 67, 1, "F14", *group ); - buttons[0x43] = control; - controls.push_back( control ); - controls_by_name["F14"] = control; - group->add( *control ); + button = new Button ( 67, 1, "F14", *group ); + buttons[0x43] = button; + controls.push_back( button ); + controls_by_name["F14"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 68, 1, "F15", *group ); - buttons[0x44] = control; - controls.push_back( control ); - controls_by_name["F15"] = control; - group->add( *control ); + button = new Button ( 68, 1, "F15", *group ); + buttons[0x44] = button; + controls.push_back( button ); + controls_by_name["F15"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 69, 1, "F16", *group ); - buttons[0x45] = control; - controls.push_back( control ); - controls_by_name["F16"] = control; - group->add( *control ); + button = new Button ( 69, 1, "F16", *group ); + buttons[0x45] = button; + controls.push_back( button ); + controls_by_name["F16"] = button; + group->add( *button ); group = groups["modifiers"]; - control = new Button ( 70, 1, "shift", *group ); - buttons[0x46] = control; - controls.push_back( control ); - controls_by_name["shift"] = control; - group->add( *control ); + button = new Button ( 70, 1, "shift", *group ); + buttons[0x46] = button; + controls.push_back( button ); + controls_by_name["shift"] = button; + group->add( *button ); group = groups["modifiers"]; - control = new Button ( 71, 1, "option", *group ); - buttons[0x47] = control; - controls.push_back( control ); - controls_by_name["option"] = control; - group->add( *control ); + button = new Button ( 71, 1, "option", *group ); + buttons[0x47] = button; + controls.push_back( button ); + controls_by_name["option"] = button; + group->add( *button ); group = groups["modifiers"]; - control = new Button ( 72, 1, "control", *group ); - buttons[0x48] = control; - controls.push_back( control ); - controls_by_name["control"] = control; - group->add( *control ); + button = new Button ( 72, 1, "control", *group ); + buttons[0x48] = button; + controls.push_back( button ); + controls_by_name["control"] = button; + group->add( *button ); group = groups["modifiers"]; - control = new Button ( 73, 1, "cmd_alt", *group ); - buttons[0x49] = control; - controls.push_back( control ); - controls_by_name["cmd_alt"] = control; - group->add( *control ); + button = new Button ( 73, 1, "cmd_alt", *group ); + buttons[0x49] = button; + controls.push_back( button ); + controls_by_name["cmd_alt"] = button; + group->add( *button ); group = groups["automation"]; - control = new Button ( 74, 1, "on", *group ); - buttons[0x4a] = control; - controls.push_back( control ); - controls_by_name["on"] = control; - group->add( *control ); + button = new Button ( 74, 1, "on", *group ); + buttons[0x4a] = button; + controls.push_back( button ); + controls_by_name["on"] = button; + group->add( *button ); group = groups["automation"]; - control = new Button ( 75, 1, "rec_ready", *group ); - buttons[0x4b] = control; - controls.push_back( control ); - controls_by_name["rec_ready"] = control; - group->add( *control ); + button = new Button ( 75, 1, "rec_ready", *group ); + buttons[0x4b] = button; + controls.push_back( button ); + controls_by_name["rec_ready"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 76, 1, "undo", *group ); - buttons[0x4c] = control; - controls.push_back( control ); - controls_by_name["undo"] = control; - group->add( *control ); + button = new Button ( 76, 1, "undo", *group ); + buttons[0x4c] = button; + controls.push_back( button ); + controls_by_name["undo"] = button; + group->add( *button ); group = groups["automation"]; - control = new Button ( 77, 1, "snapshot", *group ); - buttons[0x4d] = control; - controls.push_back( control ); - controls_by_name["snapshot"] = control; - group->add( *control ); + button = new Button ( 77, 1, "snapshot", *group ); + buttons[0x4d] = button; + controls.push_back( button ); + controls_by_name["snapshot"] = button; + group->add( *button ); group = groups["automation"]; - control = new Button ( 78, 1, "touch", *group ); - buttons[0x4e] = control; - controls.push_back( control ); - controls_by_name["touch"] = control; - group->add( *control ); + button = new Button ( 78, 1, "touch", *group ); + buttons[0x4e] = button; + controls.push_back( button ); + controls_by_name["touch"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 79, 1, "redo", *group ); - buttons[0x4f] = control; - controls.push_back( control ); - controls_by_name["redo"] = control; - group->add( *control ); + button = new Button ( 79, 1, "redo", *group ); + buttons[0x4f] = button; + controls.push_back( button ); + controls_by_name["redo"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 80, 1, "marker", *group ); - buttons[0x50] = control; - controls.push_back( control ); - controls_by_name["marker"] = control; - group->add( *control ); + button = new Button ( 80, 1, "marker", *group ); + buttons[0x50] = button; + controls.push_back( button ); + controls_by_name["marker"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 81, 1, "enter", *group ); - buttons[0x51] = control; - controls.push_back( control ); - controls_by_name["enter"] = control; - group->add( *control ); + button = new Button ( 81, 1, "enter", *group ); + buttons[0x51] = button; + controls.push_back( button ); + controls_by_name["enter"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 82, 1, "cancel", *group ); - buttons[0x52] = control; - controls.push_back( control ); - controls_by_name["cancel"] = control; - group->add( *control ); + button = new Button ( 82, 1, "cancel", *group ); + buttons[0x52] = button; + controls.push_back( button ); + controls_by_name["cancel"] = button; + group->add( *button ); group = groups["functions"]; - control = new Button ( 83, 1, "mixer", *group ); - buttons[0x53] = control; - controls.push_back( control ); - controls_by_name["mixer"] = control; - group->add( *control ); + button = new Button ( 83, 1, "mixer", *group ); + buttons[0x53] = button; + controls.push_back( button ); + controls_by_name["mixer"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 84, 1, "frm_left", *group ); - buttons[0x54] = control; - controls.push_back( control ); - controls_by_name["frm_left"] = control; - group->add( *control ); + button = new Button ( 84, 1, "frm_left", *group ); + buttons[0x54] = button; + controls.push_back( button ); + controls_by_name["frm_left"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 85, 1, "frm_right", *group ); - buttons[0x55] = control; - controls.push_back( control ); - controls_by_name["frm_right"] = control; - group->add( *control ); + button = new Button ( 85, 1, "frm_right", *group ); + buttons[0x55] = button; + controls.push_back( button ); + controls_by_name["frm_right"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 86, 1, "loop", *group ); - buttons[0x56] = control; - controls.push_back( control ); - controls_by_name["loop"] = control; - group->add( *control ); + button = new Button ( 86, 1, "loop", *group ); + buttons[0x56] = button; + controls.push_back( button ); + controls_by_name["loop"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 87, 1, "punch_in", *group ); - buttons[0x57] = control; - controls.push_back( control ); - controls_by_name["punch_in"] = control; - group->add( *control ); + button = new Button ( 87, 1, "punch_in", *group ); + buttons[0x57] = button; + controls.push_back( button ); + controls_by_name["punch_in"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 88, 1, "punch_out", *group ); - buttons[0x58] = control; - controls.push_back( control ); - controls_by_name["punch_out"] = control; - group->add( *control ); + button = new Button ( 88, 1, "punch_out", *group ); + buttons[0x58] = button; + controls.push_back( button ); + controls_by_name["punch_out"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 89, 1, "home", *group ); - buttons[0x59] = control; - controls.push_back( control ); - controls_by_name["home"] = control; - group->add( *control ); + button = new Button ( 89, 1, "home", *group ); + buttons[0x59] = button; + controls.push_back( button ); + controls_by_name["home"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 90, 1, "end", *group ); - buttons[0x5a] = control; - controls.push_back( control ); - controls_by_name["end"] = control; - group->add( *control ); + button = new Button ( 90, 1, "end", *group ); + buttons[0x5a] = button; + controls.push_back( button ); + controls_by_name["end"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 91, 1, "rewind", *group ); - buttons[0x5b] = control; - controls.push_back( control ); - controls_by_name["rewind"] = control; - group->add( *control ); + button = new Button ( 91, 1, "rewind", *group ); + buttons[0x5b] = button; + controls.push_back( button ); + controls_by_name["rewind"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 92, 1, "ffwd", *group ); - buttons[0x5c] = control; - controls.push_back( control ); - controls_by_name["ffwd"] = control; - group->add( *control ); + button = new Button ( 92, 1, "ffwd", *group ); + buttons[0x5c] = button; + controls.push_back( button ); + controls_by_name["ffwd"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 93, 1, "stop", *group ); - buttons[0x5d] = control; - controls.push_back( control ); - controls_by_name["stop"] = control; - group->add( *control ); + button = new Button ( 93, 1, "stop", *group ); + buttons[0x5d] = button; + controls.push_back( button ); + controls_by_name["stop"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 94, 1, "play", *group ); - buttons[0x5e] = control; - controls.push_back( control ); - controls_by_name["play"] = control; - group->add( *control ); + button = new Button ( 94, 1, "play", *group ); + buttons[0x5e] = button; + controls.push_back( button ); + controls_by_name["play"] = button; + group->add( *button ); group = groups["transport"]; - control = new Button ( 95, 1, "record", *group ); - buttons[0x5f] = control; - controls.push_back( control ); - controls_by_name["record"] = control; - group->add( *control ); + button = new Button ( 95, 1, "record", *group ); + buttons[0x5f] = button; + controls.push_back( button ); + controls_by_name["record"] = button; + group->add( *button ); group = groups["cursor"]; - control = new Button ( 96, 1, "cursor_up", *group ); - buttons[0x60] = control; - controls.push_back( control ); - controls_by_name["cursor_up"] = control; - group->add( *control ); + button = new Button ( 96, 1, "cursor_up", *group ); + buttons[0x60] = button; + controls.push_back( button ); + controls_by_name["cursor_up"] = button; + group->add( *button ); group = groups["cursor"]; - control = new Button ( 97, 1, "cursor_down", *group ); - buttons[0x61] = control; - controls.push_back( control ); - controls_by_name["cursor_down"] = control; - group->add( *control ); + button = new Button ( 97, 1, "cursor_down", *group ); + buttons[0x61] = button; + controls.push_back( button ); + controls_by_name["cursor_down"] = button; + group->add( *button ); group = groups["cursor"]; - control = new Button ( 98, 1, "cursor_left", *group ); - buttons[0x62] = control; - controls.push_back( control ); - controls_by_name["cursor_left"] = control; - group->add( *control ); + button = new Button ( 98, 1, "cursor_left", *group ); + buttons[0x62] = button; + controls.push_back( button ); + controls_by_name["cursor_left"] = button; + group->add( *button ); group = groups["cursor"]; - control = new Button ( 99, 1, "cursor_right", *group ); - buttons[0x63] = control; - controls.push_back( control ); - controls_by_name["cursor_right"] = control; - group->add( *control ); + button = new Button ( 99, 1, "cursor_right", *group ); + buttons[0x63] = button; + controls.push_back( button ); + controls_by_name["cursor_right"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 100, 1, "zoom", *group ); - buttons[0x64] = control; - controls.push_back( control ); - controls_by_name["zoom"] = control; - group->add( *control ); + button = new Button ( 100, 1, "zoom", *group ); + buttons[0x64] = button; + controls.push_back( button ); + controls_by_name["zoom"] = button; + group->add( *button ); group = groups["none"]; - control = new Button ( 101, 1, "scrub", *group ); - buttons[0x65] = control; - controls.push_back( control ); - controls_by_name["scrub"] = control; - group->add( *control ); + button = new Button ( 101, 1, "scrub", *group ); + buttons[0x65] = button; + controls.push_back( button ); + controls_by_name["scrub"] = button; + group->add( *button ); group = groups["user"]; - control = new Button ( 102, 1, "user_a", *group ); - buttons[0x66] = control; - controls.push_back( control ); - controls_by_name["user_a"] = control; - group->add( *control ); + button = new Button ( 102, 1, "user_a", *group ); + buttons[0x66] = button; + controls.push_back( button ); + controls_by_name["user_a"] = button; + group->add( *button ); group = groups["user"]; - control = new Button ( 103, 1, "user_b", *group ); - buttons[0x67] = control; - controls.push_back( control ); - controls_by_name["user_b"] = control; - group->add( *control ); + button = new Button ( 103, 1, "user_b", *group ); + buttons[0x67] = button; + controls.push_back( button ); + controls_by_name["user_b"] = button; + group->add( *button ); group = groups["strip_1"]; - control = new Button ( 104, 1, "fader_touch", *group ); - buttons[0x68] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 104, 1, "fader_touch", *group ); + buttons[0x68] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_2"]; - control = new Button ( 105, 2, "fader_touch", *group ); - buttons[0x69] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 105, 2, "fader_touch", *group ); + buttons[0x69] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_3"]; - control = new Button ( 106, 3, "fader_touch", *group ); - buttons[0x6a] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 106, 3, "fader_touch", *group ); + buttons[0x6a] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_4"]; - control = new Button ( 107, 4, "fader_touch", *group ); - buttons[0x6b] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 107, 4, "fader_touch", *group ); + buttons[0x6b] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_5"]; - control = new Button ( 108, 5, "fader_touch", *group ); - buttons[0x6c] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 108, 5, "fader_touch", *group ); + buttons[0x6c] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_6"]; - control = new Button ( 109, 6, "fader_touch", *group ); - buttons[0x6d] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 109, 6, "fader_touch", *group ); + buttons[0x6d] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_7"]; - control = new Button ( 110, 7, "fader_touch", *group ); - buttons[0x6e] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 110, 7, "fader_touch", *group ); + buttons[0x6e] = button; + controls.push_back( button ); + group->add( *button ); group = groups["strip_8"]; - control = new Button ( 111, 8, "fader_touch", *group ); - buttons[0x6f] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 111, 8, "fader_touch", *group ); + buttons[0x6f] = button; + controls.push_back( button ); + group->add( *button ); group = groups["master"]; - control = new Button ( 112, 1, "fader_touch", *group ); - buttons[0x70] = control; - controls.push_back( control ); - group->add( *control ); + button = new Button ( 112, 1, "fader_touch", *group ); + buttons[0x70] = button; + controls.push_back( button ); + group->add( *button ); group = groups["none"]; - control = new Led ( 113, 1, "smpte", *group ); - leds[0x71] = control; - controls.push_back( control ); - controls_by_name["smpte"] = control; - group->add( *control ); + led = new Led ( 113, 1, "smpte", *group ); + leds[0x71] = led; + controls.push_back( led ); + controls_by_name["smpte"] = led; + group->add( *led ); group = groups["none"]; - control = new Led ( 114, 1, "beats", *group ); - leds[0x72] = control; - controls.push_back( control ); - controls_by_name["beats"] = control; - group->add( *control ); + led = new Led ( 114, 1, "beats", *group ); + leds[0x72] = led; + controls.push_back( led ); + controls_by_name["beats"] = led; + group->add( *led ); group = groups["none"]; - control = new Led ( 115, 1, "solo", *group ); - leds[0x73] = control; - controls.push_back( control ); - controls_by_name["solo"] = control; - group->add( *control ); + led = new Led ( 115, 1, "solo", *group ); + leds[0x73] = led; + controls.push_back( led ); + controls_by_name["solo"] = led; + group->add( *led ); group = groups["none"]; - control = new Led ( 118, 1, "relay_click", *group ); - leds[0x76] = control; - controls.push_back( control ); - controls_by_name["relay_click"] = control; - group->add( *control ); + led = new Led ( 118, 1, "relay_click", *group ); + leds[0x76] = led; + controls.push_back( led ); + controls_by_name["relay_click"] = led; + group->add( *led ); } diff --git a/libs/surfaces/mackie/scripts/bcf-controls.csv b/libs/surfaces/mackie/scripts/bcf-controls.csv index e22965a906..32d0dbb9a9 100644 --- a/libs/surfaces/mackie/scripts/bcf-controls.csv +++ b/libs/surfaces/mackie/scripts/bcf-controls.csv @@ -21,12 +21,12 @@ button,1,assignment,sends,1,1,0x5a button,1,assignment,pan,1,1,0x59 button,1,assignment,plugin,1,1,0x57 button,1,assignment,eq,1,1,0x58 -button,1,assignment,dyn,1,1,0x2d +button,1,assignment,zoom,1,1,0x2d button,1,bank,left,1,0,0x2e button,1,bank,right,1,0,0x2f button,1,bank,channel_left,1,0,0x30 button,1,bank,channel_right,1,0,0x31 -button,1,,flip,1,1,0x32 +button,1,,scrub,1,1,0x32 button,1,,edit,1,1,0x56 button,1,display,name_value,1,0,0x34 @@ -78,8 +78,8 @@ button,1,cursor,"cursor_up",1,0,0x60 button,1,cursor,"cursor_down",1,0,0x61 button,1,cursor,"cursor_left",1,0,0x62 button,1,cursor,"cursor_right",1,0,0x63 -button,1,,"zoom",1,1,0x64 -button,1,,"scrub",1,1,0x65 +button,1,,"dyn",1,1,0x64 +button,1,,"flip",1,1,0x65 button,1,user,"user_a",1,0,0x66 button,1,user,"user_b",1,0,0x67 diff --git a/libs/surfaces/mackie/scripts/host.rb b/libs/surfaces/mackie/scripts/host.rb index 4f3e4ec605..e9ccf695f4 100755 --- a/libs/surfaces/mackie/scripts/host.rb +++ b/libs/surfaces/mackie/scripts/host.rb @@ -99,7 +99,7 @@ while bytes = mck.file.read( 3 ) control = sf.midis[midi_type][control_id] print " Control Type: %-7s, " % sf.types[midi_type] - print "id: %4i" % control_id + print "id: %4x" % control_id print ", control: %15s" % ( control ? control.name : "nil control" ) print ", %15s" % ( control ? control.group.name : "nil group" ) print "\n" diff --git a/libs/surfaces/mackie/scripts/surface-cc-template.erb b/libs/surfaces/mackie/scripts/surface-cc-template.erb index a04d5addd7..79cd2e4ae0 100644 --- a/libs/surfaces/mackie/scripts/surface-cc-template.erb +++ b/libs/surfaces/mackie/scripts/surface-cc-template.erb @@ -52,17 +52,20 @@ void Mackie::<%= sf.name %>Surface::init_controls() % end // initialise controls - Control * control = 0; + Fader * fader = 0; + Pot * pot = 0; + Button * button = 0; + Led * led = 0; % sf.controls.each do |control| group = groups["<%=control.group.name%>"]; - control = new <%= control.class.name %> ( <%= control.id %>, <%= control.ordinal %>, "<%=control.name%>", *group ); - <%=control.class.name.downcase%>s[0x<%=control.id.to_hex %>] = control; - controls.push_back( control ); + <%= control.class.name.downcase %> = new <%= control.class.name %> ( <%= control.id %>, <%= control.ordinal %>, "<%=control.name%>", *group ); + <%=control.class.name.downcase%>s[0x<%=control.id.to_hex %>] = <%= control.class.name.downcase %>; + controls.push_back( <%= control.class.name.downcase %> ); <%- if control.group.class != Strip -%> - controls_by_name["<%= control.name %>"] = control; + controls_by_name["<%= control.name %>"] = <%= control.class.name.downcase %>; <%- end -%> - group->add( *control ); + group->add( *<%= control.class.name.downcase %> ); % end } diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h index 9b04e5decb..ac6ba808bf 100644 --- a/libs/surfaces/mackie/surface.h +++ b/libs/surfaces/mackie/surface.h @@ -56,10 +56,10 @@ public: Indexed by raw_id not by id. @see Control for the distinction. */ - std::map<int,Control*> faders; - std::map<int,Control*> pots; - std::map<int,Control*> buttons; - std::map<int,Control*> leds; + std::map<int,Fader*> faders; + std::map<int,Pot*> pots; + std::map<int,Button*> buttons; + std::map<int,Led*> leds; /// no strip controls in here because they usually /// have the same names. diff --git a/libs/surfaces/mackie/surface_port.cc b/libs/surfaces/mackie/surface_port.cc index cba4c2c494..38c3ae0607 100644 --- a/libs/surfaces/mackie/surface_port.cc +++ b/libs/surfaces/mackie/surface_port.cc @@ -87,7 +87,7 @@ MidiByteArray SurfacePort::read() retval.copy( nread, buf ); if ((size_t) nread == sizeof (buf)) { -#ifdef DEBUG +#ifdef PORT_DEBUG cout << "SurfacePort::read recursive" << endl; #endif retval << read(); @@ -106,7 +106,7 @@ MidiByteArray SurfacePort::read() throw MackieControlException( os.str() ); } } -#ifdef DEBUG +#ifdef PORT_DEBUG cout << "SurfacePort::read: " << retval << endl; #endif return retval; @@ -114,7 +114,7 @@ MidiByteArray SurfacePort::read() void SurfacePort::write( const MidiByteArray & mba ) { -#ifdef DEBUG +#ifdef PORT_DEBUG //if ( mba[0] == 0xf0 ) cout << "SurfacePort::write: " << mba << endl; cout << "SurfacePort::write: " << mba << endl; #endif @@ -140,7 +140,7 @@ void SurfacePort::write( const MidiByteArray & mba ) throw MackieControlException( os.str() ); } } -#ifdef DEBUG +#ifdef PORT_DEBUG cout << "SurfacePort::wrote " << count << endl; #endif } diff --git a/libs/surfaces/mackie/timer.h b/libs/surfaces/mackie/timer.h index 736e81baef..88875539fe 100644 --- a/libs/surfaces/mackie/timer.h +++ b/libs/surfaces/mackie/timer.h @@ -44,7 +44,7 @@ public: if ( shouldStart ) start(); } - + /** Start the timer running. Return the current timestamp, in milliseconds */ diff --git a/libs/surfaces/mackie/types.cc b/libs/surfaces/mackie/types.cc index d2818d7340..b9f2e9d488 100644 --- a/libs/surfaces/mackie/types.cc +++ b/libs/surfaces/mackie/types.cc @@ -2,8 +2,28 @@ namespace Mackie { - LedState on( LedState::on ); - LedState off( LedState::off ); - LedState flashing( LedState::flashing ); - LedState none( LedState::none ); +LedState on( LedState::on ); +LedState off( LedState::off ); +LedState flashing( LedState::flashing ); +LedState none( LedState::none ); + +std::ostream & operator << ( std::ostream & os, const ControlState & cs ) +{ + os << "ControlState { "; + os << "pos: " << cs.pos; + os << ", "; + os << "sign: " << cs.sign; + os << ", "; + os << "delta: " << cs.delta; + os << ", "; + os << "ticks: " << cs.ticks; + os << ", "; + os << "led_state: " << cs.led_state.state(); + os << ", "; + os << "button_state: " << cs.button_state; + os << " }"; + + return os; +} + } diff --git a/libs/surfaces/mackie/types.h b/libs/surfaces/mackie/types.h index ce15d6f6a9..21b0d1989a 100644 --- a/libs/surfaces/mackie/types.h +++ b/libs/surfaces/mackie/types.h @@ -18,7 +18,7 @@ #ifndef mackie_types_h #define mackie_types_h -#define DEBUG 1 +#include <iostream> namespace Mackie { @@ -71,16 +71,27 @@ struct ControlState // Note that this sets both pos and delta to the flt value ControlState( LedState ls, float flt ): pos(flt), delta(flt), ticks(0), led_state(ls), button_state(neither) {} ControlState( float flt ): pos(flt), delta(flt), ticks(0), led_state(none), button_state(neither) {} - ControlState( float flt, int tcks ): pos(flt), delta(flt), ticks(tcks), led_state(none), button_state(neither) {} + ControlState( float flt, unsigned int tcks ): pos(flt), delta(flt), ticks(tcks), led_state(none), button_state(neither) {} ControlState( ButtonState bs ): pos(0.0), delta(0.0), ticks(0), led_state(none), button_state(bs) {} + /// For faders. Between 0 and 1. float pos; + + /// For pots. Sign. Either -1 or 1; + int sign; + + /// For pots. Signed value of total movement. Between 0 and 1 float delta; - int ticks; + + /// For pots. Unsigned number of ticks. Usually between 1 and 16. + unsigned int ticks; + LedState led_state; ButtonState button_state; }; +std::ostream & operator << ( std::ostream &, const ControlState & ); + class Control; class Fader; class Button; |