{
ENSURE_GUI_THREAD (*this, &Editor::map_transport_state)
- if (_session->transport_stopped()) {
+ if (_session && _session->transport_stopped()) {
have_pending_keyboard_selection = false;
}
, gpm (sess, 250)
, panners (sess)
, _mono_button (_("Mono"))
- , button_table (3, 2)
- , middle_button_table (2, 2)
+ , button_table (4, 2)
+ , middle_button_table (1, 2)
, bottom_button_table (1, 2)
, meter_point_label (_("pre"))
, comment_button (_("Comments"))
button_table.attach (name_button, 0, 2, 0, 1);
button_table.attach (input_button, 0, 2, 1, 2);
+ button_table.attach (*invert_button, 0, 2, 3, 4);
middle_button_table.set_homogeneous (true);
middle_button_table.set_spacings (0);
middle_button_table.attach (*mute_button, 0, 1, 0, 1);
middle_button_table.attach (*solo_button, 1, 2, 0, 1);
- middle_button_table.attach (*invert_button, 0, 2, 1, 2);
bottom_button_table.set_col_spacings (0);
bottom_button_table.set_homogeneous (true);
items.push_back (MenuElem (_("Adjust latency"), sigc::mem_fun (*this, &RouteUI::adjust_latency)));
items.push_back (SeparatorElem());
- items.push_back (CheckMenuElem (_("Invert Polarity"), sigc::mem_fun (*this, &RouteUI::toggle_polarity)));
- polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
- polarity_menu_item->set_active (_route->phase_invert());
items.push_back (CheckMenuElem (_("Protect against denormals"), sigc::mem_fun (*this, &RouteUI::toggle_denormal_protection)));
denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
denormal_menu_item->set_active (_route->denormal_protection());
_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;
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_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::invert_press), false);
- invert_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::invert_release), false);
+ invert_button->signal_toggled().connect (sigc::mem_fun(*this, &RouteUI::invert_toggled), false);
}
}
route_active_menu_item = 0;
- polarity_menu_item = 0;
denormal_menu_item = 0;
}
_route->solo_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::solo_changed, this, _1), gui_context());
_route->listen_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::listen_changed, this, _1), gui_context());
_route->solo_isolated_changed.connect (route_connections, invalidator (*this), ui_bind (&RouteUI::solo_changed, this, _1), 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()) {
map_frozen ();
}
-bool
-RouteUI::invert_press (GdkEventButton* ev)
+void
+RouteUI::invert_toggled ()
{
- return false;
+ cerr << this << " button state = " << invert_button->get_active() << " PI = " << _route->phase_invert() << endl;
+ _route->set_phase_invert (invert_button->get_active());
}
-bool
-RouteUI::invert_release (GdkEventButton* ev)
+void
+RouteUI::polarity_changed ()
{
- return false;
+ if (!_route) {
+ return;
+ }
+
+ if (_route->phase_invert()) {
+ invert_button->set_active (true);
+ } else {
+ invert_button->set_active (false);
+ }
}
bool
}
}
-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 ()
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter param);
- bool invert_press(GdkEventButton*);
- bool invert_release(GdkEventButton*);
+ void invert_toggled();
bool mute_press(GdkEventButton*);
bool mute_release(GdkEventButton*);
bool solo_press(GdkEventButton*);
void toggle_route_active ();
virtual void route_active_changed ();
- Gtk::CheckMenuItem *polarity_menu_item;
- void toggle_polarity ();
virtual void polarity_changed ();
Gtk::CheckMenuItem *denormal_menu_item;
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i, ++chn) {
Sample* const sp = i->data();
- if (_phase_invert & chn) {
+ if (_phase_invert & (1<<chn)) {
for (nframes_t nx = 0; nx < nframes; ++nx) {
sp[nx] = -sp[nx];
}
Route::set_phase_invert (bool yn)
{
if (_phase_invert != yn) {
- _phase_invert = 0xffff; // XXX all channels
+ if (yn) {
+ _phase_invert = 0xffff; // XXX all channels
+ } else {
+ _phase_invert = 0; // XXX no channels
+ }
+
phase_invert_changed (); /* EMIT SIGNAL */
+ _session.set_dirty ();
}
}