projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
return to the old way of editing track names, but hopefully better than it was. likel...
[ardour.git]
/
gtk2_ardour
/
gain_meter.cc
diff --git
a/gtk2_ardour/gain_meter.cc
b/gtk2_ardour/gain_meter.cc
index 0324f3d93cfe39eb232b5e922e950d6e9bb2e5ee..a405f074ae5949431bdc8210826b83bd27a20e16 100644
(file)
--- a/
gtk2_ardour/gain_meter.cc
+++ b/
gtk2_ardour/gain_meter.cc
@@
-20,10
+20,7
@@
#include <limits.h>
#include "ardour/amp.h"
#include <limits.h>
#include "ardour/amp.h"
-#include "ardour/io.h"
-#include "ardour/route.h"
#include "ardour/route_group.h"
#include "ardour/route_group.h"
-#include "ardour/session.h"
#include "ardour/session_route.h"
#include "ardour/dB.h"
#include "ardour/utils.h"
#include "ardour/session_route.h"
#include "ardour/dB.h"
#include "ardour/utils.h"
@@
-64,21
+61,8
@@
sigc::signal<void> GainMeterBase::ResetAllPeakDisplays;
sigc::signal<void,RouteGroup*> GainMeterBase::ResetGroupPeakDisplays;
GainMeter::MetricPatterns GainMeter::metric_patterns;
sigc::signal<void,RouteGroup*> GainMeterBase::ResetGroupPeakDisplays;
GainMeter::MetricPatterns GainMeter::metric_patterns;
-Glib::RefPtr<Gdk::Pixbuf> GainMeter::slider;
-
-
-void
-GainMeter::setup_slider_pix ()
-{
- if ((slider = ::get_icon ("fader_belt")) == 0) {
- throw failed_constructor();
- }
-}
-GainMeterBase::GainMeterBase (Session* s,
- const Glib::RefPtr<Gdk::Pixbuf>& pix,
- bool horizontal,
- int fader_length)
+GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int fader_girth)
: gain_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0.0, 1.0, 0.01, 0.1)
, gain_automation_style_button ("")
, gain_automation_state_button ("")
: gain_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0.0, 1.0, 0.01, 0.1)
, gain_automation_style_button ("")
, gain_automation_state_button ("")
@@
-97,15
+81,9
@@
GainMeterBase::GainMeterBase (Session* s,
_width = Wide;
if (horizontal) {
_width = Wide;
if (horizontal) {
- gain_slider = manage (new HSliderController (pix,
- &gain_adjustment,
- fader_length,
- false));
+ gain_slider = manage (new HSliderController (&gain_adjustment, fader_length, fader_girth, false));
} else {
} else {
- gain_slider = manage (new VSliderController (pix,
- &gain_adjustment,
- fader_length,
- false));
+ gain_slider = manage (new VSliderController (&gain_adjustment, fader_length, fader_girth, false));
}
level_meter = new LevelMeter(_session);
}
level_meter = new LevelMeter(_session);
@@
-114,8
+92,8
@@
GainMeterBase::GainMeterBase (Session* s,
meter_metric_area.signal_button_press_event().connect (sigc::mem_fun (*this, &GainMeterBase::level_meter_button_press));
meter_metric_area.add_events (Gdk::BUTTON_PRESS_MASK);
meter_metric_area.signal_button_press_event().connect (sigc::mem_fun (*this, &GainMeterBase::level_meter_button_press));
meter_metric_area.add_events (Gdk::BUTTON_PRESS_MASK);
- gain_slider->signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeter::gain_slider_button_press));
- gain_slider->signal_button_release_event().connect (sigc::mem_fun(*this, &GainMeter::gain_slider_button_release));
+ gain_slider->signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeter::gain_slider_button_press)
, false
);
+ gain_slider->signal_button_release_event().connect (sigc::mem_fun(*this, &GainMeter::gain_slider_button_release)
, false
);
gain_slider->set_name ("GainFader");
gain_display.set_name ("MixerStripGainDisplay");
gain_slider->set_name ("GainFader");
gain_display.set_name ("MixerStripGainDisplay");
@@
-130,8
+108,8
@@
GainMeterBase::GainMeterBase (Session* s,
peak_display.set_label (_("-inf"));
peak_display.unset_flags (Gtk::CAN_FOCUS);
peak_display.set_label (_("-inf"));
peak_display.unset_flags (Gtk::CAN_FOCUS);
- gain_automation_style_button.set_name ("
MixerAutomationModeB
utton");
- gain_automation_state_button.set_name ("
MixerAutomationPlaybackB
utton");
+ gain_automation_style_button.set_name ("
mixer strip b
utton");
+ gain_automation_state_button.set_name ("
mixer strip b
utton");
ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
@@
-158,6
+136,16
@@
GainMeterBase::GainMeterBase (Session* s,
UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &GainMeterBase::on_theme_changed));
ColorsChanged.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), false));
DPIReset.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), true));
UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &GainMeterBase::on_theme_changed));
ColorsChanged.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), false));
DPIReset.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), true));
+
+// PBD::ScopedConnection _config_connection;
+// Config->ParameterChanged.connect ( _config_connection, MISSING_INVALIDATOR, boost::bind(&GainMeterBase::set_flat_buttons, this, _1), gui_context() );
+}
+
+void
+GainMeterBase::set_flat_buttons ()
+{
+printf("set_flat_butt\n");
+// gain_slider->set_flat_buttons( ARDOUR_UI::config()->flat_buttons.get() );
}
GainMeterBase::~GainMeterBase ()
}
GainMeterBase::~GainMeterBase ()
@@
-192,7
+180,7
@@
GainMeterBase::set_controls (boost::shared_ptr<Route> r,
if (amp) {
amp->ConfigurationChanged.connect (
if (amp) {
amp->ConfigurationChanged.connect (
- model_connections, invalidator (*this),
ui_
bind (&GainMeterBase::setup_gain_adjustment, this), gui_context ()
+ model_connections, invalidator (*this),
boost::
bind (&GainMeterBase::setup_gain_adjustment, this), gui_context ()
);
}
);
}
@@
-206,7
+194,7
@@
GainMeterBase::set_controls (boost::shared_ptr<Route> r,
gain_astate_menu.items().push_back (MenuElem (S_("Automation|Manual"),
sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
gain_astate_menu.items().push_back (MenuElem (S_("Automation|Manual"),
sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
-
Evoral::Parameter(GainAutomation), (AutoState)
Off)));
+
Evoral::Parameter(GainAutomation), (AutoState) ARDOUR::
Off)));
gain_astate_menu.items().push_back (MenuElem (_("Play"),
sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
Evoral::Parameter(GainAutomation), (AutoState) Play)));
gain_astate_menu.items().push_back (MenuElem (_("Play"),
sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
Evoral::Parameter(GainAutomation), (AutoState) Play)));
@@
-259,9
+247,9
@@
GainMeterBase::setup_gain_adjustment ()
_data_type = DataType::MIDI;
gain_adjustment.set_lower (0.0);
gain_adjustment.set_upper (2.0);
_data_type = DataType::MIDI;
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);
+ gain_adjustment.set_step_increment (
1.0/128.0
);
+ gain_adjustment.set_page_increment (
10.0/128.0
);
+ gain_slider->set_default_value (1
.0
);
}
ignore_toggle = false;
}
ignore_toggle = false;
@@
-391,16
+379,40
@@
GainMeterBase::gain_activated ()
{
float f;
{
float f;
- if (sscanf (gain_display.get_text().c_str(), "%f", &f) == 1) {
+ {
+ // Switch to user's preferred locale so that
+ // if they use different LC_NUMERIC conventions,
+ // we will honor them.
- /* clamp to displayable values */
+ PBD::LocaleGuard lg ("");
+ if (sscanf (gain_display.get_text().c_str(), "%f", &f) != 1) {
+ return;
+ }
+ }
+ /* clamp to displayable values */
+ if (_data_type == DataType::AUDIO) {
f = min (f, 6.0f);
f = min (f, 6.0f);
-
_amp->set_gain (dB_to_coefficient(f), this);
_amp->set_gain (dB_to_coefficient(f), this);
+ } else {
+ f = min (fabs (f), 2.0f);
+ _amp->set_gain (f, this);
+ }
- if (gain_display.has_focus()) {
- PublicEditor::instance().reset_focus();
+ if (gain_display.has_focus()) {
+ Gtk::Widget* w = gain_display.get_toplevel();
+ if (w) {
+ Gtk::Window* win = dynamic_cast<Gtk::Window*> (w);
+
+ /* sigh. gtkmm doesn't wrap get_default_widget() */
+
+ if (win) {
+ GtkWidget* f = gtk_window_get_default_widget (win->gobj());
+ if (f) {
+ gtk_widget_grab_focus (f);
+ return;
+ }
+ }
}
}
}
}
}
}
@@
-431,15
+443,14
@@
GainMeterBase::show_gain ()
void
GainMeterBase::gain_adjusted ()
{
void
GainMeterBase::gain_adjusted ()
{
- gain_t value
= 0
;
+ gain_t value;
- switch (_data_type) {
- case DataType::AUDIO:
+ /* convert from adjustment range (0..1) to gain coefficient */
+
+ if (_data_type == DataType::AUDIO) {
value = slider_position_to_gain_with_max (gain_adjustment.get_value(), Config->get_max_gain());
value = slider_position_to_gain_with_max (gain_adjustment.get_value(), Config->get_max_gain());
- break;
- case DataType::MIDI:
- value = gain_adjustment.get_value ();
- break;
+ } else {
+ value = gain_adjustment.get_value();
}
if (!ignore_toggle) {
}
if (!ignore_toggle) {
@@
-489,10
+500,7
@@
GainMeterBase::set_meter_strip_name (const char * name)
void
GainMeterBase::set_fader_name (const char * name)
{
void
GainMeterBase::set_fader_name (const char * name)
{
- uint32_t rgb_active = rgba_from_style (name, 0xff, 0, 0xff, 0, "bg", STATE_ACTIVE, false);
- uint32_t rgb_normal = rgba_from_style (name, 0xff, 0xff, 0, 0, "bg", STATE_NORMAL, false);
-
- gain_slider->set_border_colors (rgb_normal, rgb_active);
+ gain_slider->set_name (name);
}
void
}
void
@@
-647,14
+655,14
@@
GainMeterBase::gain_slider_button_press (GdkEventButton* ev)
return false;
}
return false;
}
- return
tru
e;
+ return
fals
e;
}
bool
GainMeterBase::gain_slider_button_release (GdkEventButton*)
{
_amp->gain_control()->stop_touch (false, _amp->session().transport_frame());
}
bool
GainMeterBase::gain_slider_button_release (GdkEventButton*)
{
_amp->gain_control()->stop_touch (false, _amp->session().transport_frame());
- return
tru
e;
+ return
fals
e;
}
gint
}
gint
@@
-710,7
+718,7
@@
GainMeterBase::_astate_string (AutoState state, bool shrt)
string sstr;
switch (state) {
string sstr;
switch (state) {
- case Off:
+ case
ARDOUR::
Off:
sstr = (shrt ? "M" : _("M"));
break;
case Play:
sstr = (shrt ? "M" : _("M"));
break;
case Play:
@@
-756,10
+764,10
@@
GainMeterBase::gain_automation_style_changed ()
{
switch (_width) {
case Wide:
{
switch (_width) {
case Wide:
- gain_automation_style_button.set_
label
(astyle_string(_amp->gain_control()->alist()->automation_style()));
+ gain_automation_style_button.set_
text
(astyle_string(_amp->gain_control()->alist()->automation_style()));
break;
case Narrow:
break;
case Narrow:
- gain_automation_style_button.set_
label
(short_astyle_string(_amp->gain_control()->alist()->automation_style()));
+ gain_automation_style_button.set_
text
(short_astyle_string(_amp->gain_control()->alist()->automation_style()));
break;
}
}
break;
}
}
@@
-773,14
+781,14
@@
GainMeterBase::gain_automation_state_changed ()
switch (_width) {
case Wide:
switch (_width) {
case Wide:
- gain_automation_state_button.set_
label
(astate_string(_amp->gain_control()->alist()->automation_state()));
+ gain_automation_state_button.set_
text
(astate_string(_amp->gain_control()->alist()->automation_state()));
break;
case Narrow:
break;
case Narrow:
- gain_automation_state_button.set_
label
(short_astate_string(_amp->gain_control()->alist()->automation_state()));
+ gain_automation_state_button.set_
text
(short_astate_string(_amp->gain_control()->alist()->automation_state()));
break;
}
break;
}
- x = (_amp->gain_control()->alist()->automation_state() != Off);
+ x = (_amp->gain_control()->alist()->automation_state() !=
ARDOUR::
Off);
if (gain_automation_state_button.get_active() != x) {
ignore_toggle = true;
if (gain_automation_state_button.get_active() != x) {
ignore_toggle = true;
@@
-842,17
+850,17
@@
GainMeterBase::on_theme_changed()
}
GainMeter::GainMeter (Session* s, int fader_length)
}
GainMeter::GainMeter (Session* s, int fader_length)
- : GainMeterBase (s,
slider, false, fader_length
)
+ : GainMeterBase (s,
false, fader_length, 24
)
, gain_display_box(true, 0)
, hbox(true, 2)
{
, gain_display_box(true, 0)
, hbox(true, 2)
{
-
gain_display_box.pack_start (gain_display, true, true);
+
//
gain_display_box.pack_start (gain_display, true, true);
meter_metric_area.set_name ("AudioTrackMetrics");
set_size_request_to_display_given_text (meter_metric_area, "-127", 0, 0);
meter_metric_area.set_name ("AudioTrackMetrics");
set_size_request_to_display_given_text (meter_metric_area, "-127", 0, 0);
- gain_automation_style_button.set_name ("
MixerAutomationModeB
utton");
- gain_automation_state_button.set_name ("
MixerAutomationPlaybackB
utton");
+ gain_automation_style_button.set_name ("
mixer strip b
utton");
+ gain_automation_state_button.set_name ("
mixer strip b
utton");
ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
@@
-893,19
+901,19
@@
GainMeter::set_controls (boost::shared_ptr<Route> r,
hbox.remove (meter_alignment);
}
hbox.remove (meter_alignment);
}
-
if (peak_display.get_parent()) {
-
gain_display_box.remove (peak_display);
-
}
+
//
if (peak_display.get_parent()) {
+
//
gain_display_box.remove (peak_display);
+
//
}
-
if (gain_automation_state_button.get_parent()) {
-
fader_vbox->remove (gain_automation_state_button);
-
}
+
//
if (gain_automation_state_button.get_parent()) {
+
//
fader_vbox->remove (gain_automation_state_button);
+
//
}
GainMeterBase::set_controls (r, meter, amp);
if (_meter) {
_meter->ConfigurationChanged.connect (
GainMeterBase::set_controls (r, meter, amp);
if (_meter) {
_meter->ConfigurationChanged.connect (
- model_connections, invalidator (*this),
ui_
bind (&GainMeter::meter_configuration_changed, this, _1), gui_context()
+ model_connections, invalidator (*this),
boost::
bind (&GainMeter::meter_configuration_changed, this, _1), gui_context()
);
meter_configuration_changed (_meter->input_streams ());
);
meter_configuration_changed (_meter->input_streams ());
@@
-917,12
+925,12
@@
GainMeter::set_controls (boost::shared_ptr<Route> r,
pack some route-dependent stuff.
*/
pack some route-dependent stuff.
*/
-
gain_display_box.pack_end (peak_display, true, true);
+
//
gain_display_box.pack_end (peak_display, true, true);
hbox.pack_start (meter_alignment, true, true);
hbox.pack_start (meter_alignment, true, true);
-
if (r && !r->is_hidden()) {
-
fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
-
}
+
//
if (r && !r->is_hidden()) {
+
//
fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
+
//
}
setup_meters ();
hbox.show_all ();
setup_meters ();
hbox.show_all ();