Foldback: refactor spill logic

Prefer to reuse spill logic from the mixer-ui.
This allows to spill routes directly after spilling
foldbacks. Previously that resulted in FB "show sends"
to keep flashing even then no foldbacks were spilled anymore.

It also simplifies various aspects of foldback prev/next
logic.
This commit is contained in:
Robin Gareus 2021-03-25 21:38:10 +01:00
parent 32c7b18f6d
commit ce28065421
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
4 changed files with 61 additions and 110 deletions

View file

@ -128,8 +128,6 @@ FoldbackSend::FoldbackSend (boost::shared_ptr<Send> snd, \
_send_route->PropertyChanged.connect (_connections, invalidator (*this), boost::bind (&FoldbackSend::route_property_changed, this, _1), gui_context()); _send_route->PropertyChanged.connect (_connections, invalidator (*this), boost::bind (&FoldbackSend::route_property_changed, this, _1), gui_context());
show (); show ();
} }
FoldbackSend::~FoldbackSend () FoldbackSend::~FoldbackSend ()
@ -519,8 +517,8 @@ FoldbackStrip::init ()
output_button.signal_button_release_event().connect (sigc::mem_fun(*this, &FoldbackStrip::output_release), false); output_button.signal_button_release_event().connect (sigc::mem_fun(*this, &FoldbackStrip::output_release), false);
name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &FoldbackStrip::name_button_button_press), false); name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &FoldbackStrip::name_button_button_press), false);
_previous_button.signal_clicked.connect (sigc::mem_fun (*this, &FoldbackStrip::previous_button_clicked)); _previous_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &FoldbackStrip::cycle_foldbacks), false));
_next_button.signal_clicked.connect (sigc::mem_fun (*this, &FoldbackStrip::next_button_clicked)); _next_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &FoldbackStrip::cycle_foldbacks), true));
_hide_button.signal_clicked.connect (sigc::mem_fun(*this, &FoldbackStrip::hide_clicked)); _hide_button.signal_clicked.connect (sigc::mem_fun(*this, &FoldbackStrip::hide_clicked));
_show_sends_button.signal_clicked.connect (sigc::mem_fun(*this, &FoldbackStrip::show_sends_clicked)); _show_sends_button.signal_clicked.connect (sigc::mem_fun(*this, &FoldbackStrip::show_sends_clicked));
send_scroller.signal_button_press_event().connect (sigc::mem_fun (*this, &FoldbackStrip::send_button_press_event)); send_scroller.signal_button_press_event().connect (sigc::mem_fun (*this, &FoldbackStrip::send_button_press_event));
@ -546,6 +544,7 @@ FoldbackStrip::init ()
signal_enter_notify_event().connect (sigc::mem_fun(*this, &FoldbackStrip::mixer_strip_enter_event )); signal_enter_notify_event().connect (sigc::mem_fun(*this, &FoldbackStrip::mixer_strip_enter_event ));
signal_leave_notify_event().connect (sigc::mem_fun(*this, &FoldbackStrip::mixer_strip_leave_event )); signal_leave_notify_event().connect (sigc::mem_fun(*this, &FoldbackStrip::mixer_strip_leave_event ));
Mixer_UI::instance()->show_spill_change.connect (sigc::mem_fun (*this, &FoldbackStrip::spill_change));
} }
FoldbackStrip::~FoldbackStrip () FoldbackStrip::~FoldbackStrip ()
@ -604,31 +603,25 @@ FoldbackStrip::update_fb_level_control ()
void void
FoldbackStrip::set_route (boost::shared_ptr<Route> rt) FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
{ {
bool sh_snd = _showing_sends; RouteUI::set_route (rt);
if (_route) {
// before we do anything unset show sends
Mixer_UI::instance()->show_spill (boost::shared_ptr<ARDOUR::Stripable>());
BusSendDisplayChanged (boost::shared_ptr<Route> ()); /* EMIT SIGNAL */
_showing_sends = false;
_show_sends_button.set_active (false);
send_blink_connection.disconnect ();
}
/// FIX NO route
if (!rt) { if (!rt) {
clear_send_box (); clear_send_box ();
update_sensitivity ();
if (_showing_sends) {
Mixer_UI::instance()->show_spill (boost::shared_ptr<ARDOUR::Stripable>());
_showing_sends = false;
send_blink_connection.disconnect ();
}
RouteUI::set_route (rt);
RouteUI::self_delete (); RouteUI::self_delete ();
return; return;
} }
RouteUI::set_route (rt);
insert_box->set_route (_route); insert_box->set_route (_route);
revert_to_default_display (); revert_to_default_display ();
update_fb_level_control(); update_fb_level_control();
BusSendDisplayChanged (boost::shared_ptr<Route> ());
_showing_sends = false; _showing_sends = false;
_show_sends_button.set_active (false); _show_sends_button.set_active (false);
send_blink_connection.disconnect (); send_blink_connection.disconnect ();
@ -661,7 +654,7 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
update_output_display (); update_output_display ();
add_events (Gdk::BUTTON_RELEASE_MASK); add_events (Gdk::BUTTON_RELEASE_MASK);
prev_next_changed (); update_sensitivity ();
_previous_button.show(); _previous_button.show();
_next_button.show(); _next_button.show();
_hide_button.show(); _hide_button.show();
@ -682,16 +675,6 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
map_frozen(); map_frozen();
show (); show ();
if (sh_snd) {
// if last route had shows sends let it remain active
Mixer_UI::instance()->show_spill (_route);
BusSendDisplayChanged (_route); /* EMIT SIGNAL */
_showing_sends = true;
_show_sends_button.set_active (true);
send_blink_connection = Timers::blink_connect (sigc::mem_fun (*this, &FoldbackStrip::send_blink));
}
} }
// predicate for sort call in get_sorted_stripables // predicate for sort call in get_sorted_stripables
@ -1307,68 +1290,33 @@ FoldbackStrip::name_button_button_press (GdkEventButton* ev)
} }
void void
FoldbackStrip::previous_button_clicked () FoldbackStrip::cycle_foldbacks (bool next)
{ {
bool past_current = false; RouteList rl (_session->get_routelist (true, PresentationInfo::FoldbackBus));
boost::shared_ptr<Route> previous = boost::shared_ptr<Route> (); if (rl.size () < 2) {
RouteList fb_list;
fb_list = _session->get_routelist (true, PresentationInfo::FoldbackBus);
if (fb_list.size () > 1) {
for (RouteList::iterator s = fb_list.begin(); s != fb_list.end(); ++s) {
if ((*s) == _route) {
past_current = true;
}
if (!past_current) {
previous = boost::dynamic_pointer_cast<Route> (*s);
}
}
} else {
// only one route do nothing
return; return;
} }
//use previous to set route RouteList::iterator i = find (rl.begin (), rl.end (), _route);
if (previous) { assert (i != rl.end ());
set_route (previous);
if (_showing_sends) {
Mixer_UI::instance()->show_spill (_route);
}
}
}
void
FoldbackStrip::next_button_clicked ()
{
bool past_current = false;
boost::shared_ptr<Route> next = boost::shared_ptr<Route> ();
RouteList fb_list;
fb_list = _session->get_routelist (true, PresentationInfo::FoldbackBus);
if (fb_list.size () > 1) {
for (RouteList::iterator s = fb_list.begin(); s != fb_list.end(); ++s) {
if (past_current) {
next = boost::dynamic_pointer_cast<Route> (*s);
break;
}
if ((*s) == _route) {
past_current = true;
}
}
} else {
// only one route do nothing
return;
}
//use next to set route
if (next) { if (next) {
set_route (next); if (++i == rl.end ()) {
i = rl.begin ();
}
} else {
if (i == rl.begin ()) {
i = rl.end ();
}
--i;
}
set_route (*i);
if (_showing_sends) { if (_showing_sends) {
Mixer_UI::instance()->show_spill (_route); Mixer_UI::instance()->show_spill (_route);
} }
} }
}
void void
FoldbackStrip::prev_next_changed () FoldbackStrip::update_sensitivity ()
{ {
RouteList fb_list; RouteList fb_list;
fb_list = _session->get_routelist (true, PresentationInfo::FoldbackBus); fb_list = _session->get_routelist (true, PresentationInfo::FoldbackBus);
@ -1394,20 +1342,27 @@ FoldbackStrip::hide_clicked()
} }
void void
FoldbackStrip::show_sends_clicked () FoldbackStrip::spill_change (boost::shared_ptr<Stripable> s)
{ {
if (_showing_sends) { if (s == _route) {
Mixer_UI::instance()->show_spill (boost::shared_ptr<ARDOUR::Stripable>()); _showing_sends = true;
BusSendDisplayChanged (boost::shared_ptr<Route> ()); /* EMIT SIGNAL */ _show_sends_button.set_active (true);
send_blink_connection.disconnect ();
send_blink_connection = Timers::blink_connect (sigc::mem_fun (*this, &FoldbackStrip::send_blink));
} else {
_showing_sends = false; _showing_sends = false;
_show_sends_button.set_active (false); _show_sends_button.set_active (false);
send_blink_connection.disconnect (); send_blink_connection.disconnect ();
}
}
void
FoldbackStrip::show_sends_clicked ()
{
if (_showing_sends) {
Mixer_UI::instance()->show_spill (boost::shared_ptr<Stripable>());
} else { } else {
Mixer_UI::instance()->show_spill (_route); Mixer_UI::instance()->show_spill (_route);
BusSendDisplayChanged (_route); /* EMIT SIGNAL */
_showing_sends = true;
_show_sends_button.set_active (true);
send_blink_connection = Timers::blink_connect (sigc::mem_fun (*this, &FoldbackStrip::send_blink));
} }
} }
@ -1759,13 +1714,7 @@ FoldbackStrip::remove_current_fb ()
} }
} }
} }
if (next) {
set_route (next); set_route (next);
_session->remove_route (old_route); _session->remove_route (old_route);
prev_next_changed ();
} else {
clear_send_box ();
RouteUI::self_delete ();
_session->remove_route (old_route);
}
} }

View file

@ -123,19 +123,19 @@ public:
std::string name() const; std::string name() const;
boost::shared_ptr<ARDOUR::Stripable> stripable() const { return RouteUI::stripable(); }
PannerUI& panner_ui() { return panners; } PannerUI& panner_ui() { return panners; }
PluginSelector* plugin_selector(); PluginSelector* plugin_selector();
void set_embedded (bool); void set_embedded (bool);
void fast_update (); void fast_update ();
void set_route (boost::shared_ptr<ARDOUR::Route>); void set_route (boost::shared_ptr<ARDOUR::Route>);
void set_button_names (); void set_button_names ();
void revert_to_default_display (); void revert_to_default_display ();
boost::shared_ptr<ARDOUR::Stripable> stripable() const {
return RouteUI::stripable();
}
/** @return the delivery that is being edited using our fader; it will be the /** @return the delivery that is being edited using our fader; it will be the
* last send passed to show_send(), or our route's main out delivery. * last send passed to show_send(), or our route's main out delivery.
*/ */
@ -221,8 +221,7 @@ private:
Gtk::Menu output_menu; Gtk::Menu output_menu;
std::list<boost::shared_ptr<ARDOUR::Bundle> > output_menu_bundles; std::list<boost::shared_ptr<ARDOUR::Bundle> > output_menu_bundles;
void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &, void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &, ARDOUR::DataType type = ARDOUR::DataType::NIL);
ARDOUR::DataType type = ARDOUR::DataType::NIL);
void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>); void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
@ -243,9 +242,9 @@ private:
Gtk::Menu* build_route_ops_menu (); Gtk::Menu* build_route_ops_menu ();
Gtk::Menu* build_route_select_menu (); Gtk::Menu* build_route_select_menu ();
void previous_button_clicked (); void cycle_foldbacks (bool next);
void next_button_clicked (); void update_sensitivity ();
void prev_next_changed (); void spill_change (boost::shared_ptr<ARDOUR::Stripable>);
void show_sends_clicked (); void show_sends_clicked ();
void send_blink (bool); void send_blink (bool);

View file

@ -632,7 +632,6 @@ Mixer_UI::add_stripables (StripableList& slist)
if (foldback_strip) { if (foldback_strip) {
// last strip created is shown // last strip created is shown
foldback_strip->set_route (route); foldback_strip->set_route (route);
foldback_strip->prev_next_changed();
} else { } else {
foldback_strip = new FoldbackStrip (*this, _session, route); foldback_strip = new FoldbackStrip (*this, _session, route);
out_packer.pack_start (*foldback_strip, false, false); out_packer.pack_start (*foldback_strip, false, false);

View file

@ -320,6 +320,10 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
_route = rp; _route = rp;
if (!_route) {
return;
}
if (!_route->presentation_info().color_set()) { if (!_route->presentation_info().color_set()) {
/* deal with older 4.x color, which was stored in the GUI object state */ /* deal with older 4.x color, which was stored in the GUI object state */