diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-26 03:46:18 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-26 03:46:18 +0000 |
commit | ec97b8e58d4d476cd340cddfabc388505fb1ef7e (patch) | |
tree | ec3eaa1084dafe54a08d3c453de91b48a4711e9c | |
parent | 2bae75fa0b3d10b844738e0cb5d03c5de23d0c49 (diff) |
MCP: lots of good stuff - recenable bug fixed, cursor keys for vertical scroll work, loop button lights/unlightspan pots don't adjust if there is no panner, etc.
git-svn-id: svn://localhost/ardour2/branches/3.0@12093 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor.cc | 14 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol.cc | 2 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/control_protocol/control_protocol.h | 2 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 1 | ||||
-rw-r--r-- | libs/surfaces/mackie/mcp_buttons.cc | 4 | ||||
-rw-r--r-- | libs/surfaces/mackie/pot.cc | 13 | ||||
-rw-r--r-- | libs/surfaces/mackie/strip.cc | 26 | ||||
-rw-r--r-- | libs/surfaces/mackie/strip.h | 2 | ||||
-rw-r--r-- | libs/surfaces/mackie/surface.cc | 82 |
10 files changed, 85 insertions, 63 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index dbc57ea077..b7f768adca 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -709,6 +709,8 @@ Editor::Editor () ControlProtocol::Undo.connect (*this, invalidator (*this), boost::bind (&Editor::undo, this, true), gui_context()); ControlProtocol::Redo.connect (*this, invalidator (*this), boost::bind (&Editor::redo, this, true), gui_context()); ControlProtocol::ScrollTimeline.connect (*this, invalidator (*this), boost::bind (&Editor::control_scroll, this, _1), gui_context()); + ControlProtocol::StepTracksUp.connect (*this, invalidator (*this), boost::bind (&Editor::control_step_tracks_up, this), gui_context()); + ControlProtocol::StepTracksDown.connect (*this, invalidator (*this), boost::bind (&Editor::control_step_tracks_down, this), gui_context()); ControlProtocol::GotoView.connect (*this, invalidator (*this), boost::bind (&Editor::control_view, this, _1), gui_context()); ControlProtocol::CloseDialog.connect (*this, invalidator (*this), Keyboard::close_current_dialog, gui_context()); ControlProtocol::VerticalZoomInAll.connect (*this, invalidator (*this), boost::bind (&Editor::control_vertical_zoom_in_all, this), gui_context()); @@ -1004,6 +1006,18 @@ Editor::control_select (uint32_t rid, Selection::Operation op) } void +Editor::control_step_tracks_up () +{ + scroll_tracks_up_line (); +} + +void +Editor::control_step_tracks_down () +{ + scroll_tracks_down_line (); +} + +void Editor::control_scroll (float fraction) { ENSURE_GUI_THREAD (*this, &Editor::control_scroll, fraction) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 587c2c5b7c..589b0ead6c 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -978,6 +978,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void control_vertical_zoom_out_all (); void control_vertical_zoom_in_selected (); void control_vertical_zoom_out_selected (); + void control_step_tracks_up (); + void control_step_tracks_down (); void control_view (uint32_t); void control_scroll (float); void control_select (uint32_t rid, Selection::Operation); diff --git a/libs/surfaces/control_protocol/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc index 1868957d3f..ec58dc2f21 100644 --- a/libs/surfaces/control_protocol/control_protocol.cc +++ b/libs/surfaces/control_protocol/control_protocol.cc @@ -49,6 +49,8 @@ PBD::Signal1<void,uint32_t> ControlProtocol::AddRouteToSelection; PBD::Signal1<void,uint32_t> ControlProtocol::SetRouteSelection; PBD::Signal1<void,uint32_t> ControlProtocol::RemoveRouteFromSelection; PBD::Signal0<void> ControlProtocol::ClearRouteSelection; +PBD::Signal0<void> ControlProtocol::StepTracksDown; +PBD::Signal0<void> ControlProtocol::StepTracksUp; ControlProtocol::ControlProtocol (Session& s, string str) : BasicUI (s) diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h index fc45f1e92a..b75a04db2a 100644 --- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h +++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h @@ -73,6 +73,8 @@ class ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList, static PBD::Signal0<void> VerticalZoomOutAll; static PBD::Signal0<void> VerticalZoomInSelected; static PBD::Signal0<void> VerticalZoomOutSelected; + static PBD::Signal0<void> StepTracksDown; + static PBD::Signal0<void> StepTracksUp; static PBD::Signal1<void,uint32_t> AddRouteToSelection; static PBD::Signal1<void,uint32_t> SetRouteSelection; diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 93202f607b..82e9ea6df2 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -863,6 +863,7 @@ void MackieControlProtocol::notify_transport_state_changed() { // switch various play and stop buttons on / off + update_global_button (Button::Loop, session->get_play_loop()); update_global_button (Button::Play, session->transport_speed() == 1.0); update_global_button (Button::Stop, !session->transport_rolling()); update_global_button (Button::Rewind, session->transport_speed() < 0.0); diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc index 576267d09d..f8ebedb7b9 100644 --- a/libs/surfaces/mackie/mcp_buttons.cc +++ b/libs/surfaces/mackie/mcp_buttons.cc @@ -236,6 +236,8 @@ MackieControlProtocol::cursor_up_press (Button&) } else { VerticalZoomInAll (); /* EMIT SIGNAL */ } + } else { + StepTracksUp (); /* EMIT SIGNAL */ } return off; } @@ -255,6 +257,8 @@ MackieControlProtocol::cursor_down_press (Button&) } else { VerticalZoomOutAll (); /* EMIT SIGNAL */ } + } else { + StepTracksDown (); /* EMIT SIGNAL */ } return off; } diff --git a/libs/surfaces/mackie/pot.cc b/libs/surfaces/mackie/pot.cc index 78973b40df..838753bf31 100644 --- a/libs/surfaces/mackie/pot.cc +++ b/libs/surfaces/mackie/pot.cc @@ -42,19 +42,18 @@ Pot::set (float val, bool onoff, Mode mode) { // TODO do an exact calc for 0.50? To allow manually re-centering the port. - // center on or off - MIDI::byte msg = (val > 0.45 && val < 0.55 ? 1 : 0) << 6; + // center on if val is "very close" to 0.50 + MIDI::byte msg = (val > 0.48 && val < 0.58 ? 1 : 0) << 6; - // mode + // Pot/LED mode msg |= (mode << 4); // val, but only if off hasn't explicitly been set - - if (onoff) { + if (onoff) { if (mode == spread) { - msg += (lrintf (val * 6) + 1) & 0x0f; // 0b00001111 + msg |= (lrintf (val * 6) + 1) & 0x0f; // 0b00001111 } else { - msg += (lrintf (val * 10.0) + 1) & 0x0f; // 0b00001111 + msg |= (lrintf (val * 10.0) + 1) & 0x0f; // 0b00001111 } } diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index 6f3ed10bad..76fcc25a6c 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -167,7 +167,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool with_messages) boost::shared_ptr<Pannable> pannable = _route->pannable(); - if (pannable) { + if (pannable && pannable->panner()) { pannable->pan_azimuth_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_azi_changed, this, false), ui_context()); pannable->pan_width_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_width_changed, this, false), ui_context()); } @@ -198,7 +198,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool with_messages) build_input_list (_route->input()->n_ports()); build_output_list (_route->output()->n_ports()); - current_pot_modes.clear(); + possible_pot_parameters.clear(); if (pannable) { boost::shared_ptr<Panner> panner = pannable->panner(); @@ -207,11 +207,11 @@ Strip::set_route (boost::shared_ptr<Route> r, bool with_messages) set<Evoral::Parameter>::iterator a; if ((a = automatable.find (PanAzimuthAutomation)) != automatable.end()) { - current_pot_modes.push_back (PanAzimuthAutomation); + possible_pot_parameters.push_back (PanAzimuthAutomation); } if ((a = automatable.find (PanWidthAutomation)) != automatable.end()) { - current_pot_modes.push_back (PanWidthAutomation); + possible_pot_parameters.push_back (PanWidthAutomation); } } else { std::cerr << "connected to route without a panner\n"; @@ -345,7 +345,7 @@ Strip::notify_panner_azi_changed (bool force_update) boost::shared_ptr<Pannable> pannable = _route->pannable(); - if (!pannable) { + if (!pannable || !pannable->panner()) { _surface->write (_vpot->zero()); return; } @@ -384,7 +384,7 @@ Strip::notify_panner_width_changed (bool force_update) boost::shared_ptr<Pannable> pannable = _route->pannable(); - if (!pannable) { + if (!pannable || !pannable->panner()) { _surface->write (_vpot->zero()); return; } @@ -459,7 +459,6 @@ Strip::vselect_event (Button& button, ButtonState bs) { if (bs == press) { - int ms = _surface->mcp().modifier_state(); if (ms & MackieControlProtocol::MODIFIER_SHIFT) { @@ -944,13 +943,18 @@ Strip::next_pot_mode () return; } + boost::shared_ptr<AutomationControl> ac = _vpot->control(); if (!ac) { return; } - for (i = current_pot_modes.begin(); i != current_pot_modes.end(); ++i) { + if (possible_pot_parameters.empty() || (possible_pot_parameters.size() == 1 && possible_pot_parameters.front() == ac->parameter())) { + return; + } + + for (i = possible_pot_parameters.begin(); i != possible_pot_parameters.end(); ++i) { if ((*i) == ac->parameter()) { break; } @@ -960,12 +964,12 @@ Strip::next_pot_mode () also happen if the current mode is not in the current pot mode list) */ - if (i != current_pot_modes.end()) { + if (i != possible_pot_parameters.end()) { ++i; } - if (i == current_pot_modes.end()) { - i = current_pot_modes.begin(); + if (i == possible_pot_parameters.end()) { + i = possible_pot_parameters.begin(); } set_vpot_parameter (*i); diff --git a/libs/surfaces/mackie/strip.h b/libs/surfaces/mackie/strip.h index 9123ef6b70..684d3a2108 100644 --- a/libs/surfaces/mackie/strip.h +++ b/libs/surfaces/mackie/strip.h @@ -136,7 +136,7 @@ private: void vselect_event (Button&, ButtonState); void fader_touch_event (Button&, ButtonState); - std::vector<Evoral::Parameter> current_pot_modes; + std::vector<Evoral::Parameter> possible_pot_parameters; void next_pot_mode (); void set_vpot_parameter (Evoral::Parameter); diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 7c604138c3..71198a7464 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -350,50 +350,34 @@ Surface::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes* ev Pot* pot = pots[ev->controller_number]; + // bit 6 gives the sign + float sign = (ev->value & 0x40) == 0 ? 1.0 : -1.0; + // bits 0..5 give the velocity. we interpret this as "ticks + // moved before this message was sent" + float ticks = (ev->value & 0x3f); + if (ticks == 0) { + /* euphonix and perhaps other devices send zero + when they mean 1, we think. + */ + ticks = 1; + } + float delta = sign * (ticks / (float) 0x3f); + if (!pot) { if (ev->controller_number == Jog::ID && _jog_wheel) { - // bit 6 gives the sign - float sign = (ev->value & 0x40) == 0 ? 1.0 : -1.0; - // bits 0..5 give the velocity. we interpret this as "ticks - // moved before this message was sent" - float ticks = (ev->value & 0x3f); - if (ticks == 0) { - /* euphonix and perhaps other devices send zero - when they mean 1, we think. - */ - ticks = 1; - } - float delta = sign * (ticks / (float) 0x3f); - DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Jog wheel moved %1\n", ticks)); _jog_wheel->jog_event (delta); return; } - } - - if (pot) { - // bit 6 gives the sign - float sign = (ev->value & 0x40) == 0 ? 1.0 : -1.0; - // bits 0..5 give the velocity. we interpret this as "ticks - // moved before this message was sent" - float ticks = (ev->value & 0x3f); - if (ticks == 0) { - /* euphonix and perhaps other devices send zero - when they mean 1, we think. - */ - ticks = 1; - } - float delta = sign * (ticks / (float) 0x3f); - Strip* strip = dynamic_cast<Strip*> (&pot->group()); - - if (strip) { - strip->handle_pot (*pot, delta); - } - } else { - DEBUG_TRACE (DEBUG::MackieControl, "pot not found\n"); + return; } + + Strip* strip = dynamic_cast<Strip*> (&pot->group()); + if (strip) { + strip->handle_pot (*pot, delta); + } } void @@ -726,7 +710,7 @@ void Surface::update_view_mode_display () { string text; - Button* button = 0; + int id = -1; if (!_active) { return; @@ -735,19 +719,19 @@ Surface::update_view_mode_display () switch (_mcp.view_mode()) { case MackieControlProtocol::Mixer: show_two_char_display ("Mx"); - button = buttons[Button::Pan]; + id = Button::Pan; break; case MackieControlProtocol::Dynamics: show_two_char_display ("Dy"); - button = buttons[Button::Dyn]; + id = Button::Dyn; break; case MackieControlProtocol::EQ: show_two_char_display ("EQ"); - button = buttons[Button::Eq]; + id = Button::Eq; break; case MackieControlProtocol::Loop: show_two_char_display ("LP"); - button = buttons[Button::Loop]; + id = Button::Loop; break; case MackieControlProtocol::AudioTracks: show_two_char_display ("AT"); @@ -757,18 +741,28 @@ Surface::update_view_mode_display () break; case MackieControlProtocol::Sends: show_two_char_display ("Sn"); - button = buttons[Button::Sends]; + id = Button::Sends; break; case MackieControlProtocol::Plugins: show_two_char_display ("Pl"); - button = buttons[Button::Plugin]; + id = Button::Plugin; break; default: break; } - if (button) { - _port->write (button->set_state (on)); + if (id >= 0) { + + /* we are attempting to turn a global button/LED on */ + + map<int,Control*>::iterator x = controls_by_device_independent_id.find (id); + + if (x != controls_by_device_independent_id.end()) { + Button* button = dynamic_cast<Button*> (x->second); + if (button) { + _port->write (button->set_state (on)); + } + } } if (!text.empty()) { |