mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 05:35:47 +01:00
redesign/reimplement selection knowledge in MackieControlProtocol object
strips listen to Stripable::presentation_info().PropertyChange, and forward selected status changes to the MCP object
This commit is contained in:
parent
4717080aee
commit
a8d7b0fca3
3 changed files with 37 additions and 20 deletions
|
|
@ -1728,12 +1728,16 @@ MackieControlProtocol::redisplay_subview_mode ()
|
|||
int
|
||||
MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Stripable> r)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("set subview mode %1 with stripable %2, current flip mode %3\n", sm, (r ? r->name() : string ("null")), _flip_mode));
|
||||
|
||||
if (_flip_mode != Normal) {
|
||||
set_flip_mode (Normal);
|
||||
}
|
||||
|
||||
if (!subview_mode_would_be_ok (sm, r)) {
|
||||
|
||||
DEBUG_TRACE (DEBUG::MackieControl, "subview mode not OK\n");
|
||||
|
||||
if (r) {
|
||||
|
||||
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||
|
|
@ -2347,9 +2351,7 @@ MackieControlProtocol::is_midi_track (boost::shared_ptr<Stripable> r) const
|
|||
bool
|
||||
MackieControlProtocol::selected (boost::shared_ptr<Stripable> r) const
|
||||
{
|
||||
const StripableNotificationList* rl = &_last_selected_stripables;
|
||||
|
||||
for (ARDOUR::StripableNotificationList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
|
||||
for (Selection::const_iterator i = _last_selected_stripables.begin(); i != _last_selected_stripables.end(); ++i) {
|
||||
boost::shared_ptr<ARDOUR::Stripable> rt = (*i).lock();
|
||||
if (rt == r) {
|
||||
return true;
|
||||
|
|
@ -2381,6 +2383,16 @@ MackieControlProtocol::is_mapped (boost::shared_ptr<Stripable> r) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
MackieControlProtocol::update_selected (boost::shared_ptr<Stripable> s, bool selected)
|
||||
{
|
||||
if (selected) {
|
||||
_last_selected_stripables.insert (boost::weak_ptr<Stripable> (s));
|
||||
} else {
|
||||
_last_selected_stripables.erase (boost::weak_ptr<Stripable> (s));
|
||||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<Stripable>
|
||||
MackieControlProtocol::first_selected_stripable () const
|
||||
{
|
||||
|
|
@ -2388,7 +2400,7 @@ MackieControlProtocol::first_selected_stripable () const
|
|||
return boost::shared_ptr<Stripable>();
|
||||
}
|
||||
|
||||
boost::shared_ptr<Stripable> r = _last_selected_stripables.front().lock();
|
||||
boost::shared_ptr<Stripable> r = (*(_last_selected_stripables.begin())).lock();
|
||||
|
||||
if (r) {
|
||||
/* check it is on one of our surfaces */
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ class MackieControlProtocol
|
|||
bool is_hidden (boost::shared_ptr<ARDOUR::Stripable>) const;
|
||||
bool is_mapped (boost::shared_ptr<ARDOUR::Stripable>) const;
|
||||
boost::shared_ptr<ARDOUR::Stripable> first_selected_stripable () const;
|
||||
void update_selected (boost::shared_ptr<ARDOUR::Stripable>, bool selected);
|
||||
|
||||
void check_fader_automation_state ();
|
||||
void update_fader_automation_state ();
|
||||
|
|
@ -334,7 +335,8 @@ class MackieControlProtocol
|
|||
bool needs_ipmidi_restart;
|
||||
bool _metering_active;
|
||||
bool _initialized;
|
||||
ARDOUR::StripableNotificationList _last_selected_stripables;
|
||||
typedef std::set<boost::weak_ptr<ARDOUR::Stripable> > Selection;
|
||||
Selection _last_selected_stripables;
|
||||
XMLNode* configuration_state;
|
||||
int state_version;
|
||||
int _last_bank[9];
|
||||
|
|
|
|||
|
|
@ -381,6 +381,7 @@ Strip::notify_property_changed (const PropertyChange& what_changed)
|
|||
if (what_changed.contains (ARDOUR::Properties::selected)) {
|
||||
if (_stripable) {
|
||||
_surface->write (_select->set_state (_stripable->presentation_info().selected()));
|
||||
_surface->mcp().update_selected (_stripable, _stripable->presentation_info().selected());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1352,25 +1353,27 @@ Strip::flip_mode_changed ()
|
|||
boost::shared_ptr<AutomationControl> fader_control = _fader->control();
|
||||
|
||||
if (pot_control && fader_control) {
|
||||
|
||||
_vpot->set_control (fader_control);
|
||||
_fader->set_control (pot_control);
|
||||
|
||||
/* update fader with pot value */
|
||||
|
||||
_surface->write (_fader->set_position (pot_control->internal_to_interface (pot_control->get_value ())));
|
||||
|
||||
/* update pot with fader value */
|
||||
|
||||
_surface->write (_vpot->set (fader_control->internal_to_interface (fader_control->get_value()), true, Pot::wrap));
|
||||
|
||||
|
||||
if (_surface->mcp().flip_mode() == MackieControlProtocol::Normal) {
|
||||
do_parameter_display (GainAutomation, fader_control->get_value());
|
||||
} else {
|
||||
do_parameter_display (BusSendLevel, pot_control->get_value());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (_surface->mcp().flip_mode() == MackieControlProtocol::Normal) {
|
||||
do_parameter_display (GainAutomation, fader_control->get_value());
|
||||
} else {
|
||||
do_parameter_display (BusSendLevel, fader_control->get_value());
|
||||
}
|
||||
|
||||
/* update fader */
|
||||
|
||||
_surface->write (_fader->set_position (pot_control->internal_to_interface (pot_control->get_value ())));
|
||||
|
||||
/* update pot */
|
||||
|
||||
_surface->write (_vpot->set (fader_control->internal_to_interface (fader_control->get_value()), true, Pot::wrap));
|
||||
|
||||
|
||||
} else {
|
||||
/* do nothing */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue