#include "gui_thread.h"
#include "monitor_section.h"
#include "public_editor.h"
+#include "volume_controller.h"
#include "utils.h"
#include "i18n.h"
/* Dim */
- dim_control = new MotionFeedback (little_knob_pixbuf, MotionFeedback::Rotary, "", &dim_adjustment, false, 30, 30);
+ dim_control = new VolumeController (little_knob_pixbuf, &dim_adjustment, false, 30, 30);
HBox* dim_packer = manage (new HBox);
dim_packer->show ();
/* Solo Boost */
- solo_boost_control = new MotionFeedback (little_knob_pixbuf, MotionFeedback::Rotary, "", &solo_boost_adjustment, false, 30, 30);
+ solo_boost_control = new VolumeController (little_knob_pixbuf, &solo_boost_adjustment, false, 30, 30);
HBox* solo_packer = manage (new HBox);
solo_packer->set_spacing (12);
/* Solo (SiP) cut */
- solo_cut_control = new MotionFeedback (little_knob_pixbuf, MotionFeedback::Rotary, "", &solo_cut_adjustment, false, 30, 30);
+ solo_cut_control = new VolumeController (little_knob_pixbuf, &solo_cut_adjustment, false, 30, 30);
spin_label = manage (new Label (_("SiP Cut")));
spin_packer = manage (new VBox);
/* Gain */
- gain_control = new MotionFeedback (big_knob_pixbuf, MotionFeedback::Rotary, "", &gain_adjustment, false, 80, 80);
+ gain_control = new VolumeController (big_knob_pixbuf, &gain_adjustment, false, 80, 80);
spin_label = manage (new Label (_("Gain")));
spin_packer = manage (new VBox);
}
if (_session) {
- solo_cut_control->set_controllable (_session->solo_cut_control());
+ boost::shared_ptr<Controllable> c = _session->solo_cut_control();
+ solo_cut_control->set_controllable (c);
+ solo_cut_control->get_adjustment()->set_value (c->get_value());
} else {
solo_cut_control->set_controllable (none);
}
if (_route) {
gain_control->set_controllable (_route->gain_control());
- control_link (control_connections, _route->gain_control(), gain_adjustment);
} else {
gain_control->set_controllable (none);
}
dim_control->set_controllable (c);
dim_adjustment.set_lower (c->lower());
dim_adjustment.set_upper (c->upper());
- control_link (control_connections, c, dim_adjustment);
c = _monitor->solo_boost_control ();
solo_boost_control->set_controllable (c);
solo_boost_adjustment.set_lower (c->lower());
solo_boost_adjustment.set_upper (c->upper());
- control_link (control_connections, c, solo_boost_adjustment);
} else {
class MotionFeedback;
}
+class VolumeController;
+
class MonitorSection : public RouteUI
{
public:
ChannelButtons _channel_buttons;
Gtk::Adjustment gain_adjustment;
- Gtkmm2ext::MotionFeedback* gain_control;
+ VolumeController* gain_control;
Gtk::Adjustment dim_adjustment;
- Gtkmm2ext::MotionFeedback* dim_control;
+ VolumeController* dim_control;
Gtk::Adjustment solo_boost_adjustment;
- Gtkmm2ext::MotionFeedback* solo_boost_control;
+ VolumeController* solo_boost_control;
Gtk::Adjustment solo_cut_adjustment;
- Gtkmm2ext::MotionFeedback* solo_cut_control;
+ VolumeController* solo_cut_control;
void populate_buttons ();
void set_button_names ();
return o;
}
-static void
-adjustment_to_controllable (Gtk::Adjustment* adj, boost::weak_ptr<Controllable> wcont)
-{
- boost::shared_ptr<Controllable> cont = wcont.lock();
-
- if (cont) {
- double val = adj->get_value();
- if (val != cont->get_value()) {
- cont->set_value (val);
- }
- }
-}
-
-static void
-controllable_to_adjustment (Gtk::Adjustment* adj, boost::weak_ptr<Controllable> wcont)
-{
- boost::shared_ptr<Controllable> cont = wcont.lock();
-
- if (cont) {
- float val = cont->get_value();
-
- if (val != adj->get_value()) {
- adj->set_value (val);
- }
- }
-}
-
-void
-control_link (ScopedConnectionList& scl, boost::shared_ptr<Controllable> c, Gtk::Adjustment& a)
-{
- boost::weak_ptr<Controllable> wc (c);
-
- a.signal_value_changed().connect (sigc::bind (sigc::ptr_fun (adjustment_to_controllable), &a, wc));
- c->Changed.connect (scl, MISSING_INVALIDATOR, boost::bind (controllable_to_adjustment, &a, wc),
- gui_context());
-}