#include "ardour/session.h"
#include "ardour/audioengine.h"
#include "ardour/audio_track.h"
-#include "ardour/audio_diskstream.h"
#include "ardour/midi_track.h"
-#include "ardour/midi_diskstream.h"
#include "ardour/template_utils.h"
#include "ardour/filename_extensions.h"
#include "ardour/directory_names.h"
post_fader_mute_check = 0;
listen_mute_check = 0;
main_mute_check = 0;
+ solo_safe_check = 0;
+ solo_isolated_check = 0;
ignore_toggle = false;
_solo_release = 0;
_mute_release = 0;
route_active_menu_item = 0;
- polarity_menu_item = 0;
denormal_menu_item = 0;
multiple_mute_change = false;
multiple_solo_change = false;
+ invert_button = manage (new BindableToggleButton ());
+ // mute_button->set_self_managed (true);
+ invert_button->set_name ("InvertButton");
+ invert_button->add (invert_button_label);
+ invert_button_label.show ();
+ UI::instance()->set_tip (invert_button, _("Invert (Phase reverse) this track"), "");
+
mute_button = manage (new BindableToggleButton ());
- mute_button->set_self_managed (true);
+ // mute_button->set_self_managed (true);
mute_button->set_name ("MuteButton");
mute_button->add (mute_button_label);
mute_button_label.show ();
UI::instance()->set_tip (mute_button, _("Mute this track"), "");
solo_button = manage (new BindableToggleButton ());
- solo_button->set_self_managed (true);
+ // solo_button->set_self_managed (true);
solo_button->set_name ("SoloButton");
solo_button->add (solo_button_label);
solo_button_label.show ();
rec_enable_button = manage (new BindableToggleButton ());
rec_enable_button->set_name ("RecordEnableButton");
- rec_enable_button->set_self_managed (true);
+ // rec_enable_button->set_self_managed (true);
rec_enable_button->add (rec_enable_button_label);
rec_enable_button_label.show ();
UI::instance()->set_tip (rec_enable_button, _("Enable recording on this track"), "");
show_sends_button = manage (new BindableToggleButton (""));
show_sends_button->set_name ("SendAlert");
- show_sends_button->set_self_managed (true);
+ // show_sends_button->set_self_managed (true);
UI::instance()->set_tip (show_sends_button, _("make mixer strips show sends to this bus"), "");
- _session->SoloChanged.connect (_session_connections, boost::bind (&RouteUI::solo_changed_so_update_mute, this), gui_context());
- _session->TransportStateChange.connect (_session_connections, boost::bind (&RouteUI::check_rec_enable_sensitivity, this), gui_context());
- _session->RecordStateChanged.connect (_session_connections, boost::bind (&RouteUI::session_rec_enable_changed, this), gui_context());
+ _session->SoloChanged.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::solo_changed_so_update_mute, this), gui_context());
+ _session->TransportStateChange.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::check_rec_enable_sensitivity, this), gui_context());
+ _session->RecordStateChanged.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::session_rec_enable_changed, this), gui_context());
- Config->ParameterChanged.connect (*this, ui_bind (&RouteUI::parameter_changed, this, _1), gui_context());
+ Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&RouteUI::parameter_changed, this, _1), gui_context());
rec_enable_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_press), false);
rec_enable_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_release), false);
solo_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::solo_release), false);
mute_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::mute_press), false);
mute_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::mute_release), false);
+ invert_button->signal_toggled().connect (sigc::mem_fun(*this, &RouteUI::invert_toggled), false);
+
}
void
}
route_active_menu_item = 0;
- polarity_menu_item = 0;
denormal_menu_item = 0;
}
}
if (self_destruct) {
- rp->DropReferences.connect (route_connections, boost::bind (&RouteUI::self_delete, this), gui_context());
+ rp->DropReferences.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::self_delete, this), gui_context());
}
mute_button->set_controllable (_route->mute_control());
solo_button->set_controllable (_route->solo_control());
- _route->active_changed.connect (route_connections, boost::bind (&RouteUI::route_active_changed, this), gui_context());
- _route->mute_changed.connect (route_connections, ui_bind (&RouteUI::mute_changed, this, _1), gui_context());
- _route->solo_changed.connect (route_connections, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
- _route->listen_changed.connect (route_connections, ui_bind (&RouteUI::listen_changed, this, _1), gui_context());
- _route->solo_isolated_changed.connect (route_connections, ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
- _route->PropertyChanged.connect (route_connections, ui_bind (&RouteUI::property_changed, this, _1), gui_context());
+ _route->active_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_active_changed, this), gui_context());
+ _route->mute_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::mute_changed, this, _1), gui_context());
+
+ _route->solo_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context());
+ _route->solo_safe_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context());
+ _route->listen_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context());
+ _route->solo_isolated_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context());
+
+ _route->phase_invert_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::polarity_changed, this), gui_context());
+ _route->PropertyChanged.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::property_changed, this, _1), gui_context());
if (_session->writable() && is_track()) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
- t->diskstream()->RecordEnableChanged.connect (route_connections, boost::bind (&RouteUI::route_rec_enable_changed, this), gui_context());
+ t->RecordEnableChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_rec_enable_changed, this), gui_context());
rec_enable_button->show();
rec_enable_button->set_controllable (t->rec_enable_control());
solo_button->unset_flags (Gtk::CAN_FOCUS);
mute_button->show();
+ invert_button->show ();
if (_route->is_monitor()) {
solo_button->hide ();
solo_button->show();
}
- /* map the current state */
+ map_frozen ();
+}
- mute_changed (0);
- solo_changed (0);
+void
+RouteUI::invert_toggled ()
+{
+ cerr << this << " button state = " << invert_button->get_active() << " PI = " << _route->phase_invert() << endl;
+ _route->set_phase_invert (invert_button->get_active());
+}
- map_frozen ();
+void
+RouteUI::polarity_changed ()
+{
+ if (!_route) {
+ return;
+ }
+
+ if (_route->phase_invert()) {
+ invert_button->set_active (true);
+ } else {
+ invert_button->set_active (false);
+ }
}
bool
return true;
}
- _mute_release = new SoloMuteRelease (_route->muted ());
+ _mute_release = new SoloMuteRelease (_route->self_muted ());
}
if (ev->button == 1 || Keyboard::is_button2_event (ev)) {
_mute_release->routes = _session->get_routes ();
}
- _session->set_mute (_session->get_routes(), !_route->muted());
+ _session->set_mute (_session->get_routes(), !_route->self_muted());
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
_mute_release->routes = _session->get_routes ();
}
- _session->set_mute (_session->get_routes(), !_route->muted(), Session::rt_cleanup, true);
+ _session->set_mute (_session->get_routes(), !_route->self_muted(), Session::rt_cleanup, true);
}
} else {
_mute_release->routes = rl;
}
- _session->set_mute (rl, !_route->muted());
+ _session->set_mute (rl, !_route->self_muted());
}
}
return true;
}
- _solo_release = new SoloMuteRelease (_route->soloed());
+ _solo_release = new SoloMuteRelease (_route->self_soloed());
}
if (ev->button == 1 || Keyboard::is_button2_event (ev)) {
if (Config->get_solo_control_is_listen_control()) {
_session->set_listen (_session->get_routes(), !_route->listening(), Session::rt_cleanup, true);
} else {
- _session->set_solo (_session->get_routes(), !_route->soloed(), Session::rt_cleanup, true);
+ _session->set_solo (_session->get_routes(), !_route->self_soloed(), Session::rt_cleanup, true);
}
} else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
if (Config->get_solo_control_is_listen_control()) {
_session->set_listen (_route->route_group()->route_list(), !_route->listening(), Session::rt_cleanup, true);
} else {
- _session->set_solo (_route->route_group()->route_list(), !_route->soloed(), Session::rt_cleanup, true);
+ _session->set_solo (_route->route_group()->route_list(), !_route->self_soloed(), Session::rt_cleanup, true);
}
}
if (Config->get_solo_control_is_listen_control()) {
_session->set_listen (rl, !_route->listening());
} else {
- _session->set_solo (rl, !_route->soloed());
+ _session->set_solo (rl, !_route->self_soloed());
}
}
}
if (_solo_release->exclusive) {
} else {
- _session->set_solo (_solo_release->routes, _solo_release->active, Session::rt_cleanup, true);
+ if (Config->get_solo_control_is_listen_control()) {
+ _session->set_listen (_solo_release->routes, _solo_release->active, Session::rt_cleanup, true);
+ } else {
+ _session->set_solo (_solo_release->routes, _solo_release->active, Session::rt_cleanup, true);
+ }
}
delete _solo_release;
}
}
-void
-RouteUI::solo_changed(void* /*src*/)
-{
- Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteUI::update_solo_display, this));
-}
-
-
-void
-RouteUI::listen_changed(void* /*src*/)
-{
- Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteUI::update_solo_display, this));
-}
-
int
RouteUI::solo_visual_state (boost::shared_ptr<Route> r)
{
if (r->listening()) {
return 1;
} else {
- return 0;
+ return 0;
}
}
if (r->solo_isolated()) {
return 2;
} else if (r->soloed()) {
- return 1;
+ if (!r->self_soloed()) {
+ return 3;
+ } else {
+ return 1;
+ }
} else {
return 0;
}
}
if (r->solo_isolated()) {
- return 1;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+int
+RouteUI::solo_safe_visual_state (boost::shared_ptr<Route> r)
+{
+ if (r->is_master() || r->is_monitor()) {
+ return 0;
+ }
+
+ if (r->solo_safe()) {
+ return 1;
} else {
return 0;
}
}
+ bool yn = _route->solo_safe ();
+
+ if (solo_safe_check && solo_safe_check->get_active() != yn) {
+ solo_safe_check->set_active (yn);
+ }
+
+ yn = _route->solo_isolated ();
+
+ if (solo_isolated_check && solo_isolated_check->get_active() != yn) {
+ solo_isolated_check->set_active (yn);
+ }
+
+ set_button_names ();
+
solo_button->set_visual_state (solo_visual_state_with_isolate (_route));
}
if (Config->get_show_solo_mutes()) {
- if (r->muted ()) {
+ if (r->self_muted ()) {
/* full mute */
return 2;
- } else if (s->soloing() && !r->soloed() && !r->solo_isolated()) {
- /* mute-because-not-soloed */
+ } else if (r->muted_by_others()) {
return 1;
} else {
/* no mute at all */
} else {
- if (r->muted()) {
+ if (r->self_muted()) {
/* full mute */
return 2;
} else {
void
RouteUI::route_rec_enable_changed ()
{
- Gtkmm2ext::UI::instance()->call_slot (boost::bind (&RouteUI::update_rec_display, this));
+ Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&RouteUI::update_rec_display, this));
}
void
check = new CheckMenuItem(_("Solo Isolate"));
check->set_active (_route->solo_isolated());
check->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_solo_isolated), check));
- _route->solo_isolated_changed.connect (route_connections, ui_bind (&RouteUI::solo_isolated_toggle, this, _1, check), gui_context());
items.push_back (CheckMenuElem(*check));
+ solo_isolated_check = dynamic_cast<CheckMenuItem*>(&items.back());
check->show_all();
check = new CheckMenuItem(_("Solo Safe"));
check->set_active (_route->solo_safe());
check->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_solo_safe), check));
- _route->solo_safe_changed.connect (route_connections, ui_bind (&RouteUI::solo_safe_toggle, this, _1, check), gui_context());
items.push_back (CheckMenuElem(*check));
+ solo_safe_check = dynamic_cast<CheckMenuItem*>(&items.back());
check->show_all();
//items.push_back (SeparatorElem());
//items.push_back (SeparatorElem());
// items.push_back (MenuElem (_("MIDI Bind"), sigc::mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
- _route->mute_points_changed.connect (route_connections, boost::bind (&RouteUI::muting_change, this), gui_context());
+ _route->mute_points_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::muting_change, this), gui_context());
}
void
RouteUI::route_active_changed ()
{
if (route_active_menu_item) {
- Gtkmm2ext::UI::instance()->call_slot (boost::bind (&CheckMenuItem::set_active, route_active_menu_item, _route->active()));
+ Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&CheckMenuItem::set_active, route_active_menu_item, _route->active()));
}
}
-void
-RouteUI::toggle_polarity ()
-{
- if (polarity_menu_item) {
-
- bool x;
-
- ENSURE_GUI_THREAD (*this, &RouteUI::toggle_polarity)
-
- if ((x = polarity_menu_item->get_active()) != _route->phase_invert()) {
- _route->set_phase_invert (x);
- if (x) {
- name_label.set_text (X_("Ø ") + name_label.get_text());
- } else {
- name_label.set_text (_route->name());
- }
- }
- }
-}
-
-void
-RouteUI::polarity_changed ()
-{
- if (_route->phase_invert()) {
- name_label.set_text (X_("Ø ") + name_label.get_text());
- } else {
- name_label.set_text (_route->name());
- }
-}
void
RouteUI::toggle_denormal_protection ()
}
}
-void
-RouteUI::solo_isolated_toggle(void* /*src*/, Gtk::CheckMenuItem* check)
-{
- bool yn = _route->solo_isolated ();
-
- if (check->get_active() != yn) {
- check->set_active (yn);
- }
-}
-
-
-void
-RouteUI::solo_safe_toggle(void* /*src*/, Gtk::CheckMenuItem* check)
-{
- bool yn = _route->solo_safe ();
-
- if (check->get_active() != yn) {
- check->set_active (yn);
- }
-}
-
void
RouteUI::disconnect_input ()
{
return boost::dynamic_pointer_cast<MidiTrack>(_route);
}
-boost::shared_ptr<Diskstream>
-RouteUI::get_diskstream () const
-{
- boost::shared_ptr<Track> t;
-
- if ((t = boost::dynamic_pointer_cast<Track>(_route)) != 0) {
- return t->diskstream();
- } else {
- return boost::shared_ptr<Diskstream> ((Diskstream*) 0);
- }
-}
-
string
RouteUI::name() const
{