13
0

Mackie: make AudioInstruments button work correctly

Also toggle Global View LED appropriately
This commit is contained in:
Paul Davis 2022-12-10 10:32:47 -07:00
parent 4fdd8646b4
commit 9403b116ad
4 changed files with 33 additions and 5 deletions

View File

@ -350,6 +350,14 @@ MackieControlProtocol::get_sorted_stripables()
sorted.push_back (s);
}
break;
case AudioInstr:
if (has_instrument (s)){
sorted.push_back (s);
}
break;
case Inputs:
// nothing to do right now
break;
}
}
@ -1581,7 +1589,7 @@ MackieControlProtocol::build_device_specific_button_map()
{
/* this maps our device-dependent button codes to the methods that handle them.
*/
#define DEFINE_BUTTON_HANDLER(b,p,r) button_map.insert (pair<Button::ID,ButtonHandlers> ((b), ButtonHandlers ((p),(r))));
if (_device_info.is_platformMp()) {
@ -1856,11 +1864,15 @@ MackieControlProtocol::set_view_mode (ViewMode m)
void
MackieControlProtocol::display_view_mode ()
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
(*s)->update_view_mode_display (true);
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
(*s)->update_view_mode_display (true);
}
}
update_global_button (Button::View, (view_mode() == MackieControlProtocol::Mixer) ? on : off);
}
void
@ -2350,6 +2362,13 @@ MackieControlProtocol::is_midi_track (boost::shared_ptr<Stripable> r) const
return boost::dynamic_pointer_cast<MidiTrack>(r) != 0;
}
bool
MackieControlProtocol::has_instrument (boost::shared_ptr<Stripable> r) const
{
boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack>(r);
return mt && mt->the_instrument();
}
bool
MackieControlProtocol::is_mapped (boost::shared_ptr<Stripable> r) const
{

View File

@ -135,6 +135,7 @@ class MackieControlProtocol
bool is_track (boost::shared_ptr<ARDOUR::Stripable>) const;
bool is_audio_track (boost::shared_ptr<ARDOUR::Stripable>) const;
bool is_midi_track (boost::shared_ptr<ARDOUR::Stripable>) const;
bool has_instrument (boost::shared_ptr<ARDOUR::Stripable>) const;
bool is_mapped (boost::shared_ptr<ARDOUR::Stripable>) const;
boost::shared_ptr<ARDOUR::Stripable> first_selected_stripable () const;

View File

@ -1083,6 +1083,9 @@ MackieControlProtocol::audioinstruments_press (Mackie::Button& b)
Mackie::LedState
MackieControlProtocol::audioinstruments_release (Mackie::Button& b)
{
#ifndef MIXBUS
set_view_mode (AudioInstr);
#endif
return none;
}
@ -1365,4 +1368,4 @@ LedState
MackieControlProtocol::prog2_marker_release (Button &)
{
return off;
}
}

View File

@ -1354,6 +1354,11 @@ Surface::update_view_mode_display (bool with_helpful_text)
id = Button::User;
text = _("Selected Tracks");
break;
case MackieControlProtocol::AudioInstr:
show_two_char_display ("IS");
id = Button::AudioInstruments;
text = _("Instruments");
break;
default:
break;
}