13
0

MCP: tweak operation of most transport buttons, make save button work, start using button enums more widely

git-svn-id: svn://localhost/ardour2/branches/3.0@11879 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-04-11 02:30:35 +00:00
parent f03ff886c9
commit f387e834fd
6 changed files with 252 additions and 290 deletions

View File

@ -100,13 +100,13 @@ BasicUI::add_marker ()
void
BasicUI::rewind ()
{
session->request_transport_speed (-2.0f);
session->request_transport_speed (session->transport_speed() * 1.5);
}
void
BasicUI::ffwd ()
{
session->request_transport_speed (2.0f);
session->request_transport_speed (session->transport_speed() + 1.5);
}
void

View File

@ -31,70 +31,70 @@ class Button : public Control
{
public:
enum ButtonID {
ButtonIo = 0x28,
ButtonSends = 0x29,
ButtonPan = 0x2a,
ButtonPlugin = 0x2b,
ButtonEq = 0x2c,
ButtonDyn = 0x2d,
ButtonLeft = 0x2e,
ButtonRight = 0x2f,
ButtonChannelLeft = 0x30,
ButtonChannelRight = 0x31,
ButtonFlip = 0x32,
ButtonEdit = 0x33,
ButtonNameValue = 0x34,
ButtonTimecodeBeats = 0x35,
ButtonF1 = 0x36,
ButtonF2 = 0x37,
ButtonF3 = 0x38,
ButtonF4 = 0x39,
ButtonF5 = 0x3a,
ButtonF6 = 0x3b,
ButtonF7 = 0x3c,
ButtonF8 = 0x3d,
ButtonF9 = 0x3e,
ButtonF10 = 0x3f,
ButtonF11 = 0x40,
ButtonF12 = 0x41,
ButtonF13 = 0x42,
ButtonF14 = 0x43,
ButtonF15 = 0x44,
ButtonF16 = 0x45,
ButtonShift = 0x46,
ButtonOption = 0x47,
ButtonControl = 0x48,
ButtonCmdAlt = 0x49,
ButtonOn = 0x4a,
ButtonRecReady = 0x4b,
ButtonUndo = 0x4c,
ButtonSnapshot = 0x4d,
ButtonTouch = 0x4e,
ButtonRedo = 0x4f,
ButtonMarker = 0x50,
ButtonEnter = 0x51,
ButtonCancel = 0x52,
ButtonMixer = 0x53,
ButtonFrmLeft = 0x54,
ButtonFrmRight = 0x55,
ButtonLoop = 0x56,
ButtonPunchIn = 0x57,
ButtonPunchOut = 0x58,
ButtonHome = 0x59,
ButtonEnd = 0x5a,
ButtonRewind = 0x5b,
ButtonFfwd = 0x5c,
ButtonStop = 0x5d,
ButtonPlay = 0x5e,
ButtonRecord = 0x5f,
ButtonCursorUp = 0x60,
ButtonCursorDown = 0x61,
ButtonCursorLeft = 0x62,
ButtonCursorRight = 0x63,
ButtonZoom = 0x64,
ButtonScrub = 0x65,
ButtonUserA = 0x66,
ButtonUserB = 0x67,
Io = 0x28,
Sends = 0x29,
Pan = 0x2a,
Plugin = 0x2b,
Eq = 0x2c,
Dyn = 0x2d,
Left = 0x2e,
Right = 0x2f,
ChannelLeft = 0x30,
ChannelRight = 0x31,
Flip = 0x32,
Edit = 0x33,
NameValue = 0x34,
TimecodeBeats = 0x35,
F1 = 0x36,
F2 = 0x37,
F3 = 0x38,
F4 = 0x39,
F5 = 0x3a,
F6 = 0x3b,
F7 = 0x3c,
F8 = 0x3d,
F9 = 0x3e,
F10 = 0x3f,
F11 = 0x40,
F12 = 0x41,
F13 = 0x42,
F14 = 0x43,
F15 = 0x44,
F16 = 0x45,
Shift = 0x46,
Option = 0x47,
Ctrl = 0x48,
CmdAlt = 0x49,
On = 0x4a,
RecReady = 0x4b,
Undo = 0x4c,
Save = 0x4d,
Touch = 0x4e,
Redo = 0x4f,
Marker = 0x50,
Enter = 0x51,
Cancel = 0x52,
Mixer = 0x53,
FrmLeft = 0x54,
FrmRight = 0x55,
Loop = 0x56,
PunchIn = 0x57,
PunchOut = 0x58,
Home = 0x59,
End = 0x5a,
Rewind = 0x5b,
Ffwd = 0x5c,
Stop = 0x5d,
Play = 0x5e,
Record = 0x5f,
CursorUp = 0x60,
CursorDown = 0x61,
CursorLeft = 0x62,
CursorRight = 0x63,
Zoom = 0x64,
Scrub = 0x65,
UserA = 0x66,
UserB = 0x67,
};
Button (int id, std::string name, Group & group)

View File

@ -100,6 +100,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
, _gui (0)
, _zoom_mode (false)
, _scrub_mode (false)
, _flip_mode (false)
, _current_selected_track (-1)
{
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
@ -454,6 +455,7 @@ MackieControlProtocol::connect_session_signals()
session->RecordStateChanged.connect(session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_record_state_changed, this), this);
// receive transport state changed
session->TransportStateChange.connect(session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_transport_state_changed, this), this);
session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_loop_state_changed, this), this);
// receive punch-in and punch-out
Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this);
session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this);
@ -731,13 +733,9 @@ MackieControlProtocol::notify_remote_id_changed()
///////////////////////////////////////////
void
MackieControlProtocol::notify_record_state_changed()
MackieControlProtocol::notify_loop_state_changed()
{
// switch rec button on / off / flashing
Button * rec = reinterpret_cast<Button*> (surfaces.front()->controls_by_name["record"]);
if (rec) {
surfaces.front()->write (builder.build_led (*rec, record_release (*rec)));
}
update_global_button ("loop", session->get_play_loop());
}
void
@ -746,14 +744,33 @@ MackieControlProtocol::notify_transport_state_changed()
// switch various play and stop buttons on / off
update_global_button ("play", session->transport_rolling());
update_global_button ("stop", !session->transport_rolling());
update_global_button ("loop", session->get_play_loop());
update_global_button ("rewind", session->transport_speed() < 0.0);
update_global_button ("ffwd", session->transport_speed() > 1.0);
_transport_previously_rolling = session->transport_rolling();
// rec is special because it's tristate
}
void
MackieControlProtocol::notify_record_state_changed ()
{
Button * rec = reinterpret_cast<Button*> (surfaces.front()->controls_by_name["record"]);
if (rec) {
surfaces.front()->write (builder.build_led (*rec, record_release (*rec)));
LedState ls;
switch (session->record_status()) {
case Session::Disabled:
ls = off;
break;
case Session::Recording:
ls = on;
break;
case Session::Enabled:
ls = flashing;
break;
}
surfaces.front()->write (builder.build_led (*rec, ls));
}
}
@ -1126,7 +1143,7 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x48: // control
case Button::Ctrl:
switch (bs) {
case press: ls = control_press (button); break;
case release: ls = control_release (button); break;
@ -1158,7 +1175,7 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x4c: // undo
case Button::Undo: // undo
switch (bs) {
case press: ls = undo_press (button); break;
case release: ls = undo_release (button); break;
@ -1166,15 +1183,15 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x4d: // snapshot
switch (bs) {
case press: ls = snapshot_press (button); break;
case release: ls = snapshot_release (button); break;
case Button::Save:
switch (bs) {
case press: ls = save_press (button); break;
case release: ls = save_release (button); break;
case neither: break;
}
break;
case 0x4e: // touch
case Button::Touch: // touch
switch (bs) {
case press: ls = touch_press (button); break;
case release: ls = touch_release (button); break;
@ -1182,7 +1199,7 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x4f: // redo
case Button::Redo: // redo
switch (bs) {
case press: ls = redo_press (button); break;
case release: ls = redo_release (button); break;
@ -1190,7 +1207,7 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x50: // marker
case Button::Marker: // marker
switch (bs) {
case press: ls = marker_press (button); break;
case release: ls = marker_release (button); break;
@ -1198,7 +1215,7 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x51: // enter
case Button::Enter: // enter
switch (bs) {
case press: ls = enter_press (button); break;
case release: ls = enter_release (button); break;
@ -1278,7 +1295,7 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x5b: // rewind
case Button::Rewind:
switch (bs) {
case press: ls = rewind_press (button); break;
case release: ls = rewind_release (button); break;
@ -1286,7 +1303,7 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x5c: // ffwd
case Button::Ffwd:
switch (bs) {
case press: ls = ffwd_press (button); break;
case release: ls = ffwd_release (button); break;
@ -1294,7 +1311,7 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x5d: // stop
case Button::Stop:
switch (bs) {
case press: ls = stop_press (button); break;
case release: ls = stop_release (button); break;
@ -1302,7 +1319,7 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
}
break;
case 0x5e: // play
case Button::Play:
switch (bs) {
case press: ls = play_press (button); break;
case release: ls = play_release (button); break;

View File

@ -118,6 +118,7 @@ class MackieControlProtocol
// button-related signals
void notify_record_state_changed();
void notify_transport_state_changed();
void notify_loop_state_changed();
// mainly to pick up punch-in and punch-out
void notify_parameter_changed(std::string const &);
void notify_solo_active_changed(bool);
@ -358,6 +359,7 @@ class MackieControlProtocol
bool _zoom_mode;
bool _scrub_mode;
bool _flip_mode;
int _current_selected_track;
static const int MODIFIER_OPTION;

View File

@ -457,7 +457,7 @@ MackieControlProtocol::frm_right_release (Button &)
LedState
MackieControlProtocol::stop_press (Button &)
{
session->request_stop();
transport_stop ();
return on;
}
@ -470,7 +470,7 @@ MackieControlProtocol::stop_release (Button &)
LedState
MackieControlProtocol::play_press (Button &)
{
session->request_transport_speed (1.0);
transport_play ();
return on;
}
@ -483,77 +483,39 @@ MackieControlProtocol::play_release (Button &)
LedState
MackieControlProtocol::record_press (Button &)
{
if (session->get_record_enabled()) {
session->disable_record (false);
} else {
session->maybe_enable_record();
}
return on;
rec_enable_toggle ();
return off;
}
LedState
MackieControlProtocol::record_release (Button &)
{
if (session->get_record_enabled()) {
if (session->transport_rolling()) {
return on;
} else {
return flashing;
}
} else {
return off;
}
return off;
}
LedState
MackieControlProtocol::rewind_press (Button &)
{
JogWheel* jog = surfaces.front()->jog_wheel();
assert (jog);
jog->push (JogWheel::speed);
jog->transport_direction (-1);
session->request_transport_speed (-jog->transport_speed());
return on;
rewind ();
return off;
}
LedState
MackieControlProtocol::rewind_release (Button &)
{
JogWheel* jog = surfaces.front()->jog_wheel();
assert (jog);
jog->pop();
jog->transport_direction (0);
if (_transport_previously_rolling) {
session->request_transport_speed (1.0);
} else {
session->request_stop();
}
return off;
}
LedState
MackieControlProtocol::ffwd_press (Button &)
{
JogWheel* jog = surfaces.front()->jog_wheel();
assert (jog);
jog->push (JogWheel::speed);
jog->transport_direction (1);
session->request_transport_speed (jog->transport_speed());
return on;
ffwd ();
return off;
}
LedState
MackieControlProtocol::ffwd_release (Button &)
{
JogWheel* jog = surfaces.front()->jog_wheel();
assert (jog);
jog->pop();
jog->transport_direction (0);
if (_transport_previously_rolling) {
session->request_transport_speed (1.0);
} else {
session->request_stop();
}
return off;
}
@ -561,13 +523,13 @@ LedState
MackieControlProtocol::loop_press (Button &)
{
session->request_play_loop (!session->get_play_loop());
return on;
return off;
}
LedState
MackieControlProtocol::loop_release (Button &)
{
return session->get_play_loop();
return off;
}
LedState
@ -663,98 +625,6 @@ MackieControlProtocol::enter_release (Button &)
return off;
}
/* UNIMPLEMENTED */
LedState
MackieControlProtocol::io_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::io_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::sends_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::sends_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::pan_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::pan_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::plugin_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::plugin_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::eq_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::eq_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::dyn_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::dyn_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::flip_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::flip_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::edit_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::edit_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::name_value_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::name_value_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::F1_press (Button &)
{
@ -843,10 +713,103 @@ MackieControlProtocol::F8_release (Button &)
{
return off;
}
/* UNIMPLEMENTED */
LedState
MackieControlProtocol::io_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::io_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::sends_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::sends_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::pan_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::pan_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::plugin_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::plugin_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::eq_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::eq_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::dyn_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::dyn_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::flip_press (Button &)
{
_flip_mode = !_flip_mode;
return (_flip_mode ? on : off);
}
LedState
MackieControlProtocol::flip_release (Button &)
{
return (_flip_mode ? on : off);
}
LedState
MackieControlProtocol::edit_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::edit_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::name_value_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::name_value_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::F9_press (Button &)
{
GotoView (8); /* EMIT SIGNAL */
return off;
}
LedState
@ -945,16 +908,6 @@ MackieControlProtocol::rec_ready_release (Button &)
return off;
}
LedState
MackieControlProtocol::snapshot_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::snapshot_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::touch_press (Button &)
{
return off;
@ -1004,13 +957,3 @@ MackieControlProtocol::user_b_release (Button &)
{
return off;
}
LedState
MackieControlProtocol::fader_touch_press (Button &)
{
return off;
}
LedState
MackieControlProtocol::fader_touch_release (Button &)
{
return off;
}

View File

@ -148,22 +148,22 @@ static GlobalControlDefinition mackie_global_controls[] = {
{ "edit", 0x33, Button::factory, "none" },
{ "name_value", 0x34, Button::factory, "display" },
{ "timecode_beats", 0x35, Button::factory, "display" },
{ "F1", 0x36, Button::factory, "none" },
{ "F2", 0x37, Button::factory, "none" },
{ "F3", 0x38, Button::factory, "none" },
{ "F4", 0x39, Button::factory, "none" },
{ "F5", 0x3a, Button::factory, "none" },
{ "F6", 0x3b, Button::factory, "none" },
{ "F7", 0x3c, Button::factory, "none" },
{ "F8", 0x3d, Button::factory, "none" },
{ "F9", 0x3e, Button::factory, "none" },
{ "F10", 0x3f, Button::factory, "none" },
{ "F11", 0x40, Button::factory, "none" },
{ "F12", 0x41, Button::factory, "none" },
{ "F13", 0x42, Button::factory, "none" },
{ "F14", 0x43, Button::factory, "none" },
{ "F15", 0x44, Button::factory, "none" },
{ "F16", 0x45, Button::factory, "none" },
{ "F1", Button::F1, Button::factory, "none" },
{ "F2", Button::F2, Button::factory, "none" },
{ "F3", Button::F3, Button::factory, "none" },
{ "F4", Button::F4, Button::factory, "none" },
{ "F5", Button::F5, Button::factory, "none" },
{ "F6", Button::F6, Button::factory, "none" },
{ "F7", Button::F7, Button::factory, "none" },
{ "F8", Button::F8, Button::factory, "none" },
{ "F9", Button::F9, Button::factory, "none" },
{ "F10", Button::F10, Button::factory, "none" },
{ "F11", Button::F11, Button::factory, "none" },
{ "F12", Button::F12, Button::factory, "none" },
{ "F13", Button::F13, Button::factory, "none" },
{ "F14", Button::F14, Button::factory, "none" },
{ "F15", Button::F15, Button::factory, "none" },
{ "F16", Button::F16, Button::factory, "none" },
{ "shift", 0x46, Button::factory, "modifiers" },
{ "option", 0x47, Button::factory, "modifiers" },
{ "control", 0x48, Button::factory, "modifiers" },
@ -171,33 +171,33 @@ static GlobalControlDefinition mackie_global_controls[] = {
{ "on", 0x4a, Button::factory, "automation" },
{ "rec_ready", 0x4b, Button::factory, "automation" },
{ "undo", 0x4c, Button::factory, "functions" },
{ "snapshot", 0x4d, Button::factory, "automation" },
{ "touch", 0x4e, Button::factory, "automation" },
{ "redo", 0x4f, Button::factory, "functions" },
{ "marker", 0x50, Button::factory, "functions" },
{ "enter", 0x51, Button::factory, "functions" },
{ "cancel", 0x52, Button::factory, "functions" },
{ "mixer", 0x53, Button::factory, "functions" },
{ "save", Button::Save, Button::factory, "automation" },
{ "touch", Button::Touch, Button::factory, "automation" },
{ "redo", Button::Redo, Button::factory, "functions" },
{ "marker", Button::Marker, Button::factory, "functions" },
{ "enter", Button::Enter, Button::factory, "functions" },
{ "cancel", Button::Cancel, Button::factory, "functions" },
{ "mixer", Button::Mixer, Button::factory, "functions" },
{ "frm_left", 0x54, Button::factory, "transport" },
{ "frm_right", 0x55, Button::factory, "transport" },
{ "loop", 0x56, Button::factory, "transport" },
{ "loop", Button::Loop, Button::factory, "transport" },
{ "punch_in", 0x57, Button::factory, "transport" },
{ "punch_out", 0x58, Button::factory, "transport" },
{ "home", 0x59, Button::factory, "transport" },
{ "end", 0x5a, Button::factory, "transport" },
{ "rewind", 0x5b, Button::factory, "transport" },
{ "ffwd", 0x5c, Button::factory, "transport" },
{ "stop", 0x5d, Button::factory, "transport" },
{ "play", 0x5e, Button::factory, "transport" },
{ "record", 0x5f, Button::factory, "transport" },
{ "cursor_up", 0x60, Button::factory, "cursor" },
{ "cursor_down", 0x61, Button::factory, "cursor" },
{ "cursor_left", 0x62, Button::factory, "cursor" },
{ "cursor_right", 0x63, Button::factory, "cursor" },
{ "zoom", 0x64, Button::factory, "none" },
{ "scrub", 0x65, Button::factory, "none" },
{ "user_a", 0x66, Button::factory, "user" },
{ "user_b", 0x67, Button::factory, "user" },
{ "home", Button::Home, Button::factory, "transport" },
{ "end", Button::End, Button::factory, "transport" },
{ "rewind", Button::Rewind, Button::factory, "transport" },
{ "ffwd", Button::Ffwd, Button::factory, "transport" },
{ "stop", Button::Stop, Button::factory, "transport" },
{ "play", Button::Play, Button::factory, "transport" },
{ "record", Button::Record, Button::factory, "transport" },
{ "cursor_up", Button::CursorUp, Button::factory, "cursor" },
{ "cursor_down", Button::CursorDown, Button::factory, "cursor" },
{ "cursor_left", Button::CursorLeft, Button::factory, "cursor" },
{ "cursor_right", Button::CursorRight, Button::factory, "cursor" },
{ "zoom", Button::Zoom, Button::factory, "none" },
{ "scrub", Button::Scrub, Button::factory, "none" },
{ "user_a", Button::UserA, Button::factory, "user" },
{ "user_b", Button::UserB, Button::factory, "user" },
{ "fader_touch", 0x70, Led::factory, "master" },
{ "timecode", 0x71, Led::factory, "none" },
{ "beats", 0x72, Led::factory, "none" },