mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
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:
parent
2bae75fa0b
commit
ec97b8e58d
10 changed files with 85 additions and 63 deletions
|
|
@ -709,6 +709,8 @@ Editor::Editor ()
|
||||||
ControlProtocol::Undo.connect (*this, invalidator (*this), boost::bind (&Editor::undo, this, true), gui_context());
|
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::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::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::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::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());
|
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
|
void
|
||||||
Editor::control_scroll (float fraction)
|
Editor::control_scroll (float fraction)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -978,6 +978,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||||
void control_vertical_zoom_out_all ();
|
void control_vertical_zoom_out_all ();
|
||||||
void control_vertical_zoom_in_selected ();
|
void control_vertical_zoom_in_selected ();
|
||||||
void control_vertical_zoom_out_selected ();
|
void control_vertical_zoom_out_selected ();
|
||||||
|
void control_step_tracks_up ();
|
||||||
|
void control_step_tracks_down ();
|
||||||
void control_view (uint32_t);
|
void control_view (uint32_t);
|
||||||
void control_scroll (float);
|
void control_scroll (float);
|
||||||
void control_select (uint32_t rid, Selection::Operation);
|
void control_select (uint32_t rid, Selection::Operation);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ PBD::Signal1<void,uint32_t> ControlProtocol::AddRouteToSelection;
|
||||||
PBD::Signal1<void,uint32_t> ControlProtocol::SetRouteSelection;
|
PBD::Signal1<void,uint32_t> ControlProtocol::SetRouteSelection;
|
||||||
PBD::Signal1<void,uint32_t> ControlProtocol::RemoveRouteFromSelection;
|
PBD::Signal1<void,uint32_t> ControlProtocol::RemoveRouteFromSelection;
|
||||||
PBD::Signal0<void> ControlProtocol::ClearRouteSelection;
|
PBD::Signal0<void> ControlProtocol::ClearRouteSelection;
|
||||||
|
PBD::Signal0<void> ControlProtocol::StepTracksDown;
|
||||||
|
PBD::Signal0<void> ControlProtocol::StepTracksUp;
|
||||||
|
|
||||||
ControlProtocol::ControlProtocol (Session& s, string str)
|
ControlProtocol::ControlProtocol (Session& s, string str)
|
||||||
: BasicUI (s)
|
: BasicUI (s)
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,8 @@ class ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList,
|
||||||
static PBD::Signal0<void> VerticalZoomOutAll;
|
static PBD::Signal0<void> VerticalZoomOutAll;
|
||||||
static PBD::Signal0<void> VerticalZoomInSelected;
|
static PBD::Signal0<void> VerticalZoomInSelected;
|
||||||
static PBD::Signal0<void> VerticalZoomOutSelected;
|
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> AddRouteToSelection;
|
||||||
static PBD::Signal1<void,uint32_t> SetRouteSelection;
|
static PBD::Signal1<void,uint32_t> SetRouteSelection;
|
||||||
|
|
|
||||||
|
|
@ -863,6 +863,7 @@ void
|
||||||
MackieControlProtocol::notify_transport_state_changed()
|
MackieControlProtocol::notify_transport_state_changed()
|
||||||
{
|
{
|
||||||
// switch various play and stop buttons on / off
|
// 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::Play, session->transport_speed() == 1.0);
|
||||||
update_global_button (Button::Stop, !session->transport_rolling());
|
update_global_button (Button::Stop, !session->transport_rolling());
|
||||||
update_global_button (Button::Rewind, session->transport_speed() < 0.0);
|
update_global_button (Button::Rewind, session->transport_speed() < 0.0);
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,8 @@ MackieControlProtocol::cursor_up_press (Button&)
|
||||||
} else {
|
} else {
|
||||||
VerticalZoomInAll (); /* EMIT SIGNAL */
|
VerticalZoomInAll (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
StepTracksUp (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
@ -255,6 +257,8 @@ MackieControlProtocol::cursor_down_press (Button&)
|
||||||
} else {
|
} else {
|
||||||
VerticalZoomOutAll (); /* EMIT SIGNAL */
|
VerticalZoomOutAll (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
StepTracksDown (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.
|
// TODO do an exact calc for 0.50? To allow manually re-centering the port.
|
||||||
|
|
||||||
// center on or off
|
// center on if val is "very close" to 0.50
|
||||||
MIDI::byte msg = (val > 0.45 && val < 0.55 ? 1 : 0) << 6;
|
MIDI::byte msg = (val > 0.48 && val < 0.58 ? 1 : 0) << 6;
|
||||||
|
|
||||||
// mode
|
// Pot/LED mode
|
||||||
msg |= (mode << 4);
|
msg |= (mode << 4);
|
||||||
|
|
||||||
// val, but only if off hasn't explicitly been set
|
// val, but only if off hasn't explicitly been set
|
||||||
|
if (onoff) {
|
||||||
if (onoff) {
|
|
||||||
if (mode == spread) {
|
if (mode == spread) {
|
||||||
msg += (lrintf (val * 6) + 1) & 0x0f; // 0b00001111
|
msg |= (lrintf (val * 6) + 1) & 0x0f; // 0b00001111
|
||||||
} else {
|
} else {
|
||||||
msg += (lrintf (val * 10.0) + 1) & 0x0f; // 0b00001111
|
msg |= (lrintf (val * 10.0) + 1) & 0x0f; // 0b00001111
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool with_messages)
|
||||||
|
|
||||||
boost::shared_ptr<Pannable> pannable = _route->pannable();
|
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_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());
|
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_input_list (_route->input()->n_ports());
|
||||||
build_output_list (_route->output()->n_ports());
|
build_output_list (_route->output()->n_ports());
|
||||||
|
|
||||||
current_pot_modes.clear();
|
possible_pot_parameters.clear();
|
||||||
|
|
||||||
if (pannable) {
|
if (pannable) {
|
||||||
boost::shared_ptr<Panner> panner = pannable->panner();
|
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;
|
set<Evoral::Parameter>::iterator a;
|
||||||
|
|
||||||
if ((a = automatable.find (PanAzimuthAutomation)) != automatable.end()) {
|
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()) {
|
if ((a = automatable.find (PanWidthAutomation)) != automatable.end()) {
|
||||||
current_pot_modes.push_back (PanWidthAutomation);
|
possible_pot_parameters.push_back (PanWidthAutomation);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "connected to route without a panner\n";
|
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();
|
boost::shared_ptr<Pannable> pannable = _route->pannable();
|
||||||
|
|
||||||
if (!pannable) {
|
if (!pannable || !pannable->panner()) {
|
||||||
_surface->write (_vpot->zero());
|
_surface->write (_vpot->zero());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -384,7 +384,7 @@ Strip::notify_panner_width_changed (bool force_update)
|
||||||
|
|
||||||
boost::shared_ptr<Pannable> pannable = _route->pannable();
|
boost::shared_ptr<Pannable> pannable = _route->pannable();
|
||||||
|
|
||||||
if (!pannable) {
|
if (!pannable || !pannable->panner()) {
|
||||||
_surface->write (_vpot->zero());
|
_surface->write (_vpot->zero());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -459,7 +459,6 @@ Strip::vselect_event (Button& button, ButtonState bs)
|
||||||
{
|
{
|
||||||
if (bs == press) {
|
if (bs == press) {
|
||||||
|
|
||||||
|
|
||||||
int ms = _surface->mcp().modifier_state();
|
int ms = _surface->mcp().modifier_state();
|
||||||
|
|
||||||
if (ms & MackieControlProtocol::MODIFIER_SHIFT) {
|
if (ms & MackieControlProtocol::MODIFIER_SHIFT) {
|
||||||
|
|
@ -944,13 +943,18 @@ Strip::next_pot_mode ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boost::shared_ptr<AutomationControl> ac = _vpot->control();
|
boost::shared_ptr<AutomationControl> ac = _vpot->control();
|
||||||
|
|
||||||
if (!ac) {
|
if (!ac) {
|
||||||
return;
|
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()) {
|
if ((*i) == ac->parameter()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -960,12 +964,12 @@ Strip::next_pot_mode ()
|
||||||
also happen if the current mode is not in the current pot mode list)
|
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;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == current_pot_modes.end()) {
|
if (i == possible_pot_parameters.end()) {
|
||||||
i = current_pot_modes.begin();
|
i = possible_pot_parameters.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
set_vpot_parameter (*i);
|
set_vpot_parameter (*i);
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ private:
|
||||||
void vselect_event (Button&, ButtonState);
|
void vselect_event (Button&, ButtonState);
|
||||||
void fader_touch_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 next_pot_mode ();
|
||||||
void set_vpot_parameter (Evoral::Parameter);
|
void set_vpot_parameter (Evoral::Parameter);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -350,50 +350,34 @@ Surface::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes* ev
|
||||||
|
|
||||||
Pot* pot = pots[ev->controller_number];
|
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 (!pot) {
|
||||||
if (ev->controller_number == Jog::ID && _jog_wheel) {
|
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));
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Jog wheel moved %1\n", ticks));
|
||||||
_jog_wheel->jog_event (delta);
|
_jog_wheel->jog_event (delta);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pot) {
|
Strip* strip = dynamic_cast<Strip*> (&pot->group());
|
||||||
// bit 6 gives the sign
|
if (strip) {
|
||||||
float sign = (ev->value & 0x40) == 0 ? 1.0 : -1.0;
|
strip->handle_pot (*pot, delta);
|
||||||
// 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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -726,7 +710,7 @@ void
|
||||||
Surface::update_view_mode_display ()
|
Surface::update_view_mode_display ()
|
||||||
{
|
{
|
||||||
string text;
|
string text;
|
||||||
Button* button = 0;
|
int id = -1;
|
||||||
|
|
||||||
if (!_active) {
|
if (!_active) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -735,19 +719,19 @@ Surface::update_view_mode_display ()
|
||||||
switch (_mcp.view_mode()) {
|
switch (_mcp.view_mode()) {
|
||||||
case MackieControlProtocol::Mixer:
|
case MackieControlProtocol::Mixer:
|
||||||
show_two_char_display ("Mx");
|
show_two_char_display ("Mx");
|
||||||
button = buttons[Button::Pan];
|
id = Button::Pan;
|
||||||
break;
|
break;
|
||||||
case MackieControlProtocol::Dynamics:
|
case MackieControlProtocol::Dynamics:
|
||||||
show_two_char_display ("Dy");
|
show_two_char_display ("Dy");
|
||||||
button = buttons[Button::Dyn];
|
id = Button::Dyn;
|
||||||
break;
|
break;
|
||||||
case MackieControlProtocol::EQ:
|
case MackieControlProtocol::EQ:
|
||||||
show_two_char_display ("EQ");
|
show_two_char_display ("EQ");
|
||||||
button = buttons[Button::Eq];
|
id = Button::Eq;
|
||||||
break;
|
break;
|
||||||
case MackieControlProtocol::Loop:
|
case MackieControlProtocol::Loop:
|
||||||
show_two_char_display ("LP");
|
show_two_char_display ("LP");
|
||||||
button = buttons[Button::Loop];
|
id = Button::Loop;
|
||||||
break;
|
break;
|
||||||
case MackieControlProtocol::AudioTracks:
|
case MackieControlProtocol::AudioTracks:
|
||||||
show_two_char_display ("AT");
|
show_two_char_display ("AT");
|
||||||
|
|
@ -757,18 +741,28 @@ Surface::update_view_mode_display ()
|
||||||
break;
|
break;
|
||||||
case MackieControlProtocol::Sends:
|
case MackieControlProtocol::Sends:
|
||||||
show_two_char_display ("Sn");
|
show_two_char_display ("Sn");
|
||||||
button = buttons[Button::Sends];
|
id = Button::Sends;
|
||||||
break;
|
break;
|
||||||
case MackieControlProtocol::Plugins:
|
case MackieControlProtocol::Plugins:
|
||||||
show_two_char_display ("Pl");
|
show_two_char_display ("Pl");
|
||||||
button = buttons[Button::Plugin];
|
id = Button::Plugin;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button) {
|
if (id >= 0) {
|
||||||
_port->write (button->set_state (on));
|
|
||||||
|
/* 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()) {
|
if (!text.empty()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue