#include "i18n.h"
using namespace ARDOUR;
+using namespace PBD;
using namespace Gtkmm2ext;
using namespace Gtk;
using namespace sigc;
// 0.781787 is the value needed for gain to be set to 0.
gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1),
gain_display (&gain_adjustment, "MixerStripGainDisplay"),
- gain_unit_label (_("dbFS")),
- meter_point_label (_("pre")),
- top_table (1, 2),
gain_automation_style_button (""),
gain_automation_state_button ("")
gain_slider = manage (new VSliderController (slider, rail,
&gain_adjustment,
- & _io.midi_gain_control(),
+ _io.gain_control(),
false));
gain_slider->signal_button_press_event().connect (mem_fun(*this, &GainMeter::start_gain_touch));
gain_slider->signal_button_release_event().connect (mem_fun(*this, &GainMeter::end_gain_touch));
gain_slider->set_name ("MixerGainMeter");
- if (_session.midi_port()) {
- _io.set_midi_to_gain_function (slider_position_to_gain);
- _io.set_gain_to_midi_function (gain_to_slider_position);
- }
-
gain_display.set_print_func (_gain_printer, this);
- gain_unit_button.add (gain_unit_label);
- gain_unit_button.set_name ("MixerStripGainUnitButton");
- gain_unit_label.set_name ("MixerStripGainUnitButton");
-
- meter_point_button.signal_button_press_event().connect (mem_fun (*this, &GainMeter::meter_press), false);
- meter_point_button.signal_button_release_event().connect (mem_fun (*this, &GainMeter::meter_release), false);
-
-
- top_table.set_col_spacings (2);
- top_table.set_homogeneous (true);
- top_table.attach (gain_unit_button, 0, 1, 0, 1);
-
- Route* r;
-
- if ((r = dynamic_cast<Route*> (&_io)) != 0) {
-
- r->meter_change.connect (mem_fun(*this, &GainMeter::meter_changed));
- meter_point_button.add (meter_point_label);
- meter_point_button.set_name ("MixerStripMeterPreButton");
- meter_point_label.set_name ("MixerStripMeterPreButton");
-
- switch (r->meter_point()) {
- case MeterInput:
- meter_point_label.set_text (_("input"));
- break;
-
- case MeterPreFader:
- meter_point_label.set_text (_("pre"));
- break;
-
- case MeterPostFader:
- meter_point_label.set_text (_("post"));
- break;
- }
-
- /* TRANSLATORS: this string should be longest of the strings
- used to describe meter points. In english, its "input".
- */
-
- set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5);
-
-
- top_table.attach (meter_point_button, 1, 2, 0, 1);
- }
gain_display_box.set_spacing (2);
set_size_request_to_display_given_text (gain_display_frame, "-86.g", 2, 6); /* note the descender */
gain_display_frame.set_shadow_type (Gtk::SHADOW_IN);
max_peak = minus_infinity();
peak_display_label.set_text (_("-inf"));
- gain_display_box.pack_end (peak_display_frame, Gtk::PACK_SHRINK);
-
meter_metric_area.set_size_request (25, -1);
meter_metric_area.set_name ("MeterMetricsStrip");
gain_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
- using namespace Menu_Helpers;
-
- gain_astate_menu.items().push_back (MenuElem (_("Isolate"),
- bind (mem_fun (dynamic_cast<Route*>(&_io), &IO::set_gain_automation_state), (AutoState) Off)));
- gain_astate_menu.items().push_back (MenuElem (_("Play"),
- bind (mem_fun (dynamic_cast<Route*>(&_io), &IO::set_gain_automation_state), (AutoState) Play)));
- gain_astate_menu.items().push_back (MenuElem (_("Write"),
- bind (mem_fun (dynamic_cast<Route*>(&_io), &IO::set_gain_automation_state), (AutoState) Write)));
- gain_astate_menu.items().push_back (MenuElem (_("Touch"),
- bind (mem_fun (dynamic_cast<Route*>(&_io), &IO::set_gain_automation_state), (AutoState) Touch)));
-
- gain_astyle_menu.items().push_back (MenuElem (_("Trim")));
- gain_astyle_menu.items().push_back (MenuElem (_("Abs")));
-
- Route* _route = dynamic_cast<Route*>(&_io);
-
- gain_astate_menu.set_name ("ArdourContextMenu");
- gain_astyle_menu.set_name ("ArdourContextMenu");
-
- gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_style_button_event), false);
- gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_state_button_event), false);
-
- _route->gain_automation_curve().automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed));
- _route->gain_automation_curve().automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed));
+ gain_automation_state_button.set_size_request(15, 15);
+ gain_automation_style_button.set_size_request(15, 15);
fader_vbox = manage (new Gtk::VBox());
fader_vbox->set_spacing (0);
fader_vbox->pack_start (*gain_slider, false, false, 0);
- fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
hbox.set_spacing (0);
hbox.pack_start (*fader_vbox, false, false, 2);
- hbox.pack_start (meter_packer, true, false);
+
+ set_width(Narrow);
+
+ Route* r;
+
+ if ((r = dynamic_cast<Route*> (&_io)) != 0) {
+ /*
+ if we don't have a route (if we're the click),
+ pack some route-dependent stuff.
+ */
+
+ gain_display_box.pack_end (peak_display_frame, Gtk::PACK_SHRINK);
+
+ hbox.pack_start (meter_packer, true, false);
+
+ using namespace Menu_Helpers;
+
+ gain_astate_menu.items().push_back (MenuElem (_("Off"),
+ bind (mem_fun (&_io, &IO::set_gain_automation_state), (AutoState) Off)));
+ gain_astate_menu.items().push_back (MenuElem (_("Play"),
+ bind (mem_fun (&_io, &IO::set_gain_automation_state), (AutoState) Play)));
+ gain_astate_menu.items().push_back (MenuElem (_("Write"),
+ bind (mem_fun (&_io, &IO::set_gain_automation_state), (AutoState) Write)));
+ gain_astate_menu.items().push_back (MenuElem (_("Touch"),
+ bind (mem_fun (&_io, &IO::set_gain_automation_state), (AutoState) Touch)));
+
+ gain_astyle_menu.items().push_back (MenuElem (_("Trim")));
+ gain_astyle_menu.items().push_back (MenuElem (_("Abs")));
+
+ gain_astate_menu.set_name ("ArdourContextMenu");
+ gain_astyle_menu.set_name ("ArdourContextMenu");
+
+ gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_style_button_event), false);
+ gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_state_button_event), false);
+
+ r->gain_automation_curve().automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed));
+ r->gain_automation_curve().automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed));
+ fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
+
+ gain_automation_state_changed ();
+ }
+
set_spacing (4);
- pack_start (top_table, Gtk::PACK_SHRINK);
pack_start (gain_display_box, Gtk::PACK_SHRINK);
pack_start (hbox, Gtk::PACK_SHRINK);
peak_display.signal_button_release_event().connect (mem_fun(*this, &GainMeter::peak_button_release));
_session.MeterHoldChanged.connect (mem_fun(*this, &GainMeter::meter_hold_changed));
-
- gain_automation_state_changed ();
gain_changed (0);
update_gain_sensitive ();
char buf[32];
for (n = 0, i = meters.begin(); i != meters.end(); ++i, ++n) {
- if ((*i).packed) {
- peak = _io.peak_input_power (n);
+ if ((*i).packed) {
+ peak = _io.peak_input_power (n);
(*i).meter->set (log_meter (peak), peak);
-
- if (peak > max_peak) {
- max_peak = peak;
- /* set peak display */
- snprintf (buf, sizeof(buf), "%.1f", max_peak);
- peak_display_label.set_text (buf);
+
+ if (peak > max_peak) {
+ max_peak = peak;
+ /* set peak display */
+ if (max_peak <= -200.0f) {
+ peak_display_label.set_text (_("-inf"));
+ } else {
+ snprintf (buf, sizeof(buf), "%.1f", max_peak);
+ peak_display_label.set_text (buf);
+ }
- if (max_peak >= 0.0f) {
- peak_display.set_name ("MixerStripPeakDisplayPeak");
- }
- }
- }
- }
+ if (max_peak >= 0.0f) {
+ peak_display.set_name ("MixerStripPeakDisplayPeak");
+ }
+ }
+ }
+ }
}
void
}
}
-void
-GainMeter::meter_changed (void *src)
-{
- Route* r;
-
- ENSURE_GUI_THREAD (bind (mem_fun(*this, &GainMeter::meter_changed), src));
-
- if ((r = dynamic_cast<Route*> (&_io)) != 0) {
-
- switch (r->meter_point()) {
- case MeterInput:
- meter_point_label.set_text (_("input"));
- break;
-
- case MeterPreFader:
- meter_point_label.set_text (_("pre"));
- break;
-
- case MeterPostFader:
- meter_point_label.set_text (_("post"));
- break;
- }
-
- setup_meters ();
- }
-}
-
void
GainMeter::meter_point_clicked ()
{
switch (state) {
case Off:
- sstr = (shrt ? "I" : _("I"));
+ sstr = (shrt ? "O" : _("O"));
break;
case Play:
sstr = (shrt ? "P" : _("P"));
void
GainMeter::gain_automation_style_changed ()
{
- Route* _route = dynamic_cast<Route*>(&_io);
+ // Route* _route = dynamic_cast<Route*>(&_io);
switch (_width) {
case Wide:
- gain_automation_style_button.set_label (astyle_string(_route->gain_automation_curve().automation_style()));
+ gain_automation_style_button.set_label (astyle_string(_io.gain_automation_curve().automation_style()));
break;
case Narrow:
- gain_automation_style_button.set_label (short_astyle_string(_route->gain_automation_curve().automation_style()));
+ gain_automation_style_button.set_label (short_astyle_string(_io.gain_automation_curve().automation_style()));
break;
}
}
GainMeter::gain_automation_state_changed ()
{
ENSURE_GUI_THREAD(mem_fun(*this, &GainMeter::gain_automation_state_changed));
- Route* _route = dynamic_cast<Route*>(&_io);
+ //Route* _route = dynamic_cast<Route*>(&_io);
bool x;
switch (_width) {
case Wide:
- gain_automation_state_button.set_label (astate_string(_route->gain_automation_curve().automation_state()));
+ gain_automation_state_button.set_label (astate_string(_io.gain_automation_curve().automation_state()));
break;
case Narrow:
- gain_automation_state_button.set_label (short_astate_string(_route->gain_automation_curve().automation_state()));
+ gain_automation_state_button.set_label (short_astate_string(_io.gain_automation_curve().automation_state()));
break;
}
- x = (_route->gain_automation_state() != Off);
+ x = (_io.gain_automation_state() != Off);
if (gain_automation_state_button.get_active() != x) {
ignore_toggle = true;