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
This commit is contained in:
Paul Davis 2012-04-26 03:46:18 +00:00
parent 2bae75fa0b
commit ec97b8e58d
10 changed files with 85 additions and 63 deletions

View file

@ -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());
@ -1003,6 +1005,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)
{

View file

@ -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);

View file

@ -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)

View file

@ -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;

View file

@ -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);

View file

@ -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;
}

View file

@ -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 (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
}
}

View file

@ -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);

View file

@ -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);

View file

@ -350,9 +350,6 @@ Surface::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes* ev
Pot* pot = pots[ev->controller_number];
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
@ -366,34 +363,21 @@ Surface::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes* ev
}
float delta = sign * (ticks / (float) 0x3f);
if (!pot) {
if (ev->controller_number == Jog::ID && _jog_wheel) {
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;
return;
}
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");
}
}
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,19 +741,29 @@ 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 (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()) {
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {