13
0

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
This commit is contained in:
Paul Davis 2010-03-31 00:59:09 +00:00
parent e3dd8cc3ee
commit f7a9434034
5 changed files with 30 additions and 52 deletions

View File

@ -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;
}

View File

@ -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());

View File

@ -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 ()

View File

@ -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;

View File

@ -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 ();
}
}