mackie support omnibus patch

Fixes all kinds of miscellaneous issues with MCP. Also removes several theoretical pan modes, replace "Tracks"
pan mode with "Trim", and takes a tiny step towards view modes
This commit is contained in:
Paul Davis 2015-10-13 15:34:53 -04:00
parent 2d27009410
commit 53a28c230a
7 changed files with 129 additions and 86 deletions

View file

@ -448,6 +448,12 @@ DeviceInfo::has_meters() const
return _has_meters;
}
bool
DeviceInfo::has_separate_meters() const
{
return _has_meters;
}
bool
DeviceInfo::has_two_character_display() const
{

View file

@ -279,10 +279,7 @@ MackieControlProtocol::get_sorted_routes()
if (route_is_locked_to_strip(route)) {
continue;
}
/* This next section which is not used yet, looks wrong to me
The first four belong here but the bottom five are not a selection
of routes and belong elsewhere as they are v-pot modes.
*/
switch (_view_mode) {
case Mixer:
break;
@ -292,7 +289,9 @@ MackieControlProtocol::get_sorted_routes()
break;
case MidiTracks:
break;
case Loop:
case Plugins:
break;
case Auxes:
break;
}
@ -531,17 +530,21 @@ MackieControlProtocol::update_timecode_beats_led()
void
MackieControlProtocol::update_global_button (int id, LedState ls)
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
boost::shared_ptr<Surface> surface;
if (surfaces.empty()) {
return;
}
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
if (!_device_info.has_global_controls()) {
return;
if (surfaces.empty()) {
return;
}
if (!_device_info.has_global_controls()) {
return;
}
// surface needs to be master surface
surface = _master_surface;
}
// surface needs to be master surface
boost::shared_ptr<Surface> surface = _master_surface;
map<int,Control*>::iterator x = surface->controls_by_device_independent_id.find (id);
if (x != surface->controls_by_device_independent_id.end()) {
@ -704,7 +707,12 @@ MackieControlProtocol::set_device (const string& device_name, bool force)
we will have its state available.
*/
update_configuration_state ();
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
if (!surfaces.empty()) {
update_configuration_state ();
}
}
if (set_device_info (device_name)) {
return -1;
@ -807,9 +815,9 @@ MackieControlProtocol::create_surfaces ()
}
}
if (this_device) {
XMLNode* surfaces = this_device->child (X_("Surfaces"));
if (surfaces) {
surface->set_state (*surfaces, state_version);
XMLNode* snode = this_device->child (X_("Surfaces"));
if (snode) {
surface->set_state (*snode, state_version);
}
}
}
@ -911,6 +919,8 @@ MackieControlProtocol::close()
void
MackieControlProtocol::update_configuration_state ()
{
/* CALLER MUST HOLD SURFACES LOCK */
if (!configuration_state) {
configuration_state = new XMLNode (X_("Configurations"));
}
@ -922,14 +932,12 @@ MackieControlProtocol::update_configuration_state ()
configuration_state->add_child_nocopy (*devnode);
XMLNode* snode = new XMLNode (X_("Surfaces"));
devnode->add_child_nocopy (*snode);
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
snode->add_child_nocopy ((*s)->get_state());
}
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
snode->add_child_nocopy ((*s)->get_state());
}
devnode->add_child_nocopy (*snode);
}
XMLNode&
@ -951,7 +959,10 @@ MackieControlProtocol::get_state()
node.add_property (X_("device-profile"), _device_profile.name());
node.add_property (X_("device-name"), _device_info.name());
update_configuration_state ();
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
update_configuration_state ();
}
/* force a copy of the _surfaces_state node, because we want to retain ownership */
node.add_child_copy (*configuration_state);
@ -1552,15 +1563,33 @@ MackieControlProtocol::set_flip_mode (FlipMode fm)
void
MackieControlProtocol::set_pot_mode (PotMode m)
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
_pot_mode = m;
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
(*s)->update_potmode ();
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
(*s)->update_potmode ();
}
}
switch (_pot_mode) {
case Trim:
update_global_button (Button::Track, on);
update_global_button (Button::Send, off);
update_global_button (Button::Pan, off);
break;
case Send:
update_global_button (Button::Track, off);
update_global_button (Button::Send, on);
update_global_button (Button::Pan, off);
break;
case Pan:
update_global_button (Button::Track, off);
update_global_button (Button::Send, off);
update_global_button (Button::Pan, on);
};
}
void

View file

@ -103,19 +103,17 @@ class MackieControlProtocol
enum ViewMode {
Mixer,
Loop,
AudioTracks,
MidiTracks,
Busses,
Auxes,
Plugins,
};
enum PotMode {
Tracks,
Trim,
Send,
Pan,
PlugIn,
EQ,
Instrument,
};
enum FlipMode {

View file

@ -504,13 +504,9 @@ MackieControlProtocol::ffwd_release (Button &)
LedState
MackieControlProtocol::loop_press (Button &)
{
if (main_modifier_state() & MODIFIER_CONTROL) {
set_view_mode (Loop);
return on;
} else {
session->request_play_loop (!session->get_play_loop());
return none;
}
bool was_on = session->get_play_loop();
session->request_play_loop (!was_on);
return was_on ? off : on;
}
LedState
@ -660,13 +656,7 @@ LedState
MackieControlProtocol::pan_press (Button &)
{
set_pot_mode (Pan);
update_global_button (Button::Track, off);
update_global_button (Button::Send, off);
update_global_button (Button::Plugin, off);
update_global_button (Button::Eq, off);
update_global_button (Button::Dyn, off);
return on;
return none;
}
LedState
MackieControlProtocol::pan_release (Button &)
@ -681,7 +671,8 @@ MackieControlProtocol::plugin_press (Button &)
LedState
MackieControlProtocol::plugin_release (Button &)
{
return none;
set_view_mode (Plugins);
return none; /* LED state set by set_view_mode */
}
LedState
MackieControlProtocol::eq_press (Button &)
@ -837,14 +828,8 @@ MackieControlProtocol::clearsolo_release (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::track_press (Mackie::Button&)
{
set_pot_mode (Tracks);
update_global_button (Button::Pan, off);
update_global_button (Button::Send, off);
update_global_button (Button::Plugin, off);
update_global_button (Button::Eq, off);
update_global_button (Button::Dyn, off);
return on;
set_pot_mode (Trim);
return none;
}
Mackie::LedState
MackieControlProtocol::track_release (Mackie::Button&)
@ -854,15 +839,10 @@ MackieControlProtocol::track_release (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::send_press (Mackie::Button&)
{
return off;
return none;
// remove above line when sends implemented
set_pot_mode (Send);
update_global_button (Button::Track, off);
update_global_button (Button::Pan, off);
update_global_button (Button::Plugin, off);
update_global_button (Button::Eq, off);
update_global_button (Button::Dyn, off);
return on;
return none;
}
Mackie::LedState
MackieControlProtocol::send_release (Mackie::Button&)
@ -877,6 +857,7 @@ MackieControlProtocol::miditracks_press (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::miditracks_release (Mackie::Button&)
{
set_view_mode (MidiTracks);
return none;
}
Mackie::LedState
@ -897,6 +878,7 @@ MackieControlProtocol::audiotracks_press (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::audiotracks_release (Mackie::Button&)
{
set_view_mode (AudioTracks);
return none;
}
Mackie::LedState
@ -917,6 +899,7 @@ MackieControlProtocol::aux_press (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::aux_release (Mackie::Button&)
{
set_view_mode (Auxes);
return none;
}
Mackie::LedState
@ -927,6 +910,7 @@ MackieControlProtocol::busses_press (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::busses_release (Mackie::Button&)
{
set_view_mode (Busses);
return none;
}
Mackie::LedState

View file

@ -797,7 +797,9 @@ Strip::periodic (ARDOUR::microseconds_t now)
}
if (_block_screen_redisplay_until >= now) {
if (_surface->mcp().device_info().has_separate_meters()) {
goto meters;
}
/* no drawing here, for now */
return;
@ -832,6 +834,7 @@ Strip::periodic (ARDOUR::microseconds_t now)
update_automation ();
}
meters:
update_meter ();
}
@ -1014,25 +1017,23 @@ Strip::potmode_changed (bool notify)
block_vpot_mode_display_for (1000);
return;
}
// WIP
int pm = _surface->mcp().pot_mode();
switch (pm) {
case MackieControlProtocol::Pan:
// This needs to set current pan mode (azimuth or width... or whatever)
set_vpot_parameter (_pan_mode);
DEBUG_TRACE (DEBUG::MackieControl, "Assign pot to Pan mode.\n");
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Assign pot to Pan mode %1\n", enum_2_string (_pan_mode)));
break;
case MackieControlProtocol::Tracks: // should change the Tracks to Trim
case MackieControlProtocol::Trim:
DEBUG_TRACE (DEBUG::MackieControl, "Assign pot to Trim mode.\n");
set_vpot_parameter (TrimAutomation);
break;
set_vpot_parameter (TrimAutomation);
break;
case MackieControlProtocol::Send:
DEBUG_TRACE (DEBUG::MackieControl, "Assign pot to Send mode.\n");
// set to current send
break;
default:
cerr << "Pot mode " << pm << " not yet handled\n";
break;
}
if (notify) {

View file

@ -109,7 +109,7 @@ private:
boost::shared_ptr<ARDOUR::Route> _route;
PBD::ScopedConnectionList route_connections;
int _pan_mode;
ARDOUR::AutomationType _pan_mode;
float _last_gain_position_written;
float _last_pan_azi_position_written;

View file

@ -1032,40 +1032,65 @@ Surface::update_view_mode_display ()
switch (_mcp.view_mode()) {
case MackieControlProtocol::Mixer:
show_two_char_display ("Mx");
//id = Button::Pan;
break;
case MackieControlProtocol::Loop:
show_two_char_display ("LP");
id = Button::Loop;
id = Button::Track;
text = _("Mixer View");
break;
case MackieControlProtocol::AudioTracks:
show_two_char_display ("AT");
id = Button::AudioTracks;
text = _("Audio Tracks");
break;
case MackieControlProtocol::MidiTracks:
show_two_char_display ("MT");
id = Button::MidiTracks;
text = _("MIDI Tracks");
break;
case MackieControlProtocol::Plugins:
show_two_char_display ("PL");
id = Button::Plugin;
text = _("Plugins");
break;
case MackieControlProtocol::Busses:
show_two_char_display ("BS");
id = Button::Busses;
text = _("Busses");
break;
case MackieControlProtocol::Auxes:
show_two_char_display ("AB");
id = Button::Aux;
text = _("Auxes");
break;
default:
break;
}
vector<int> view_mode_buttons;
view_mode_buttons.push_back (Button::Track);
view_mode_buttons.push_back (Button::Busses);
view_mode_buttons.push_back (Button::Plugin);
view_mode_buttons.push_back (Button::AudioTracks);
view_mode_buttons.push_back (Button::MidiTracks);
view_mode_buttons.push_back (Button::Aux);
if (id >= 0) {
/* we are attempting to turn a global button/LED on */
for (vector<int>::iterator i = view_mode_buttons.begin(); i != view_mode_buttons.end(); ++i) {
map<int,Control*>::iterator x = controls_by_device_independent_id.find (id);
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) {
bool onoff;
onoff = (*i) == id;
if (x != controls_by_device_independent_id.end()) {
Button* button = dynamic_cast<Button*> (x->second);
if (button) {
_port->write (button->set_state (on));
_port->write (button->set_state (onoff));
}
}
}
}
if (!text.empty()) {
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
_port->write ((*s)->display (1, text));
}
display_message_for (text, 1000);
}
}