summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-31 00:59:09 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-31 00:59:09 +0000
commitf7a943403485c63032362c8f29cdc4abb43e18b4 (patch)
treeadfe8f3413ba49ea532ae43d25cb249af648835a
parente3dd8cc3ee481924997a1650e3a130b2579be209 (diff)
functioning invert (polarity) button; menu item removed and track name button no longer relablled when inverted
git-svn-id: svn://localhost/ardour2/branches/3.0@6813 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor.cc2
-rw-r--r--gtk2_ardour/mixer_strip.cc9
-rw-r--r--gtk2_ardour/route_ui.cc56
-rw-r--r--gtk2_ardour/route_ui.h5
-rw-r--r--libs/ardour/route.cc10
5 files changed, 30 insertions, 52 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index ca01aa606e..efec451e63 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -3147,7 +3147,7 @@ Editor::map_transport_state ()
{
ENSURE_GUI_THREAD (*this, &Editor::map_transport_state)
- if (_session->transport_stopped()) {
+ if (_session && _session->transport_stopped()) {
have_pending_keyboard_selection = false;
}
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index abfa792f4b..a0cc11092e 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -83,8 +83,8 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
, 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"))
@@ -190,12 +190,12 @@ MixerStrip::init ()
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);
@@ -1390,9 +1390,6 @@ MixerStrip::build_route_ops_menu ()
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());
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 60fead1e21..99b8b24a4b 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -103,7 +103,6 @@ RouteUI::init ()
_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;
@@ -158,8 +157,7 @@ RouteUI::init ()
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);
}
@@ -180,7 +178,6 @@ RouteUI::reset ()
}
route_active_menu_item = 0;
- polarity_menu_item = 0;
denormal_menu_item = 0;
}
@@ -215,6 +212,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
_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()) {
@@ -248,16 +246,25 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
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
@@ -1219,35 +1226,6 @@ RouteUI::route_active_changed ()
}
}
-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 ()
diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h
index 66d2629634..43dc45d321 100644
--- a/gtk2_ardour/route_ui.h
+++ b/gtk2_ardour/route_ui.h
@@ -111,8 +111,7 @@ class RouteUI : public virtual AxisView
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*);
@@ -174,8 +173,6 @@ class RouteUI : public virtual AxisView
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;
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index d4bef14176..2744b71f91 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -418,7 +418,7 @@ Route::process_output_buffers (BufferSet& bufs,
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];
}
@@ -3257,8 +3257,14 @@ void
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 ();
}
}