13
0

Set up fader for audio / MIDI when the fader position

changes (part of #4233).


git-svn-id: svn://localhost/ardour2/branches/3.0@10011 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-08-19 17:52:32 +00:00
parent 6f4e224f71
commit ad0e7319c8
2 changed files with 47 additions and 15 deletions

View File

@ -186,21 +186,14 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r,
level_meter->set_meter (pm.get()); level_meter->set_meter (pm.get());
gain_slider->set_controllable (amp->gain_control()); gain_slider->set_controllable (amp->gain_control());
if (!_route || _route->output()->n_ports().n_midi() == 0) { if (amp) {
_is_midi = false; amp->ConfigurationChanged.connect (
gain_adjustment.set_lower (0.0); model_connections, invalidator (*this), ui_bind (&GainMeterBase::setup_gain_adjustment, this), gui_context ()
gain_adjustment.set_upper (1.0); );
gain_adjustment.set_step_increment (0.01);
gain_adjustment.set_page_increment (0.1);
} else {
_is_midi = true;
gain_adjustment.set_lower (0.0);
gain_adjustment.set_upper (2.0);
gain_adjustment.set_step_increment (0.05);
gain_adjustment.set_page_increment (0.1);
gain_slider->set_default_value (1);
} }
setup_gain_adjustment ();
if (!_route || !_route->is_hidden()) { if (!_route || !_route->is_hidden()) {
using namespace Menu_Helpers; using namespace Menu_Helpers;
@ -238,6 +231,42 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r,
update_gain_sensitive (); update_gain_sensitive ();
} }
void
GainMeterBase::setup_gain_adjustment ()
{
if (!_amp) {
return;
}
if (_previous_amp_output_streams == _amp->output_streams ()) {
return;
}
ignore_toggle = true;
if (_amp->output_streams().n_midi() == 0) {
_is_midi = false;
gain_adjustment.set_lower (0.0);
gain_adjustment.set_upper (1.0);
gain_adjustment.set_step_increment (0.01);
gain_adjustment.set_page_increment (0.1);
gain_slider->set_default_value (gain_to_slider_position (1));
} else {
_is_midi = true;
gain_adjustment.set_lower (0.0);
gain_adjustment.set_upper (2.0);
gain_adjustment.set_step_increment (0.05);
gain_adjustment.set_page_increment (0.1);
gain_slider->set_default_value (1);
}
ignore_toggle = false;
effective_gain_display ();
_previous_amp_output_streams = _amp->output_streams ();
}
void void
GainMeterBase::hide_all_meters () GainMeterBase::hide_all_meters ()
{ {
@ -413,9 +442,9 @@ GainMeterBase::gain_adjusted ()
void void
GainMeterBase::effective_gain_display () GainMeterBase::effective_gain_display ()
{ {
gfloat value; float value;
if (!_route || _route->output()->n_ports().n_midi() == 0) { if (!_is_midi) {
value = gain_to_slider_position_with_max (_amp->gain(), Config->get_max_gain()); value = gain_to_slider_position_with_max (_amp->gain(), Config->get_max_gain());
} else { } else {
value = _amp->gain (); value = _amp->gain ();

View File

@ -123,6 +123,8 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
void gain_automation_state_changed(); void gain_automation_state_changed();
void gain_automation_style_changed(); void gain_automation_style_changed();
void setup_gain_adjustment ();
std::string astate_string (ARDOUR::AutoState); std::string astate_string (ARDOUR::AutoState);
std::string short_astate_string (ARDOUR::AutoState); std::string short_astate_string (ARDOUR::AutoState);
std::string _astate_string (ARDOUR::AutoState, bool); std::string _astate_string (ARDOUR::AutoState, bool);
@ -179,6 +181,7 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
bool color_changed; bool color_changed;
void color_handler(bool); void color_handler(bool);
bool _is_midi; bool _is_midi;
ARDOUR::ChanCount _previous_amp_output_streams;
}; };
class GainMeter : public GainMeterBase, public Gtk::VBox class GainMeter : public GainMeterBase, public Gtk::VBox