,gainmode (gm)
,feedback (fb)
,nsends (0)
+ ,_last_gain (0.0)
{
addr = lo_address_new (lo_address_get_hostname(a) , lo_address_get_port(a));
+ as = ARDOUR::Off;
if (feedback[0]) { // buttons are separate feedback
_strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::name_changed, this, boost::lambda::_1), OSC::instance());
}
if (feedback[1]) { // level controls
- if (gainmode) {
- _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this, X_("/select/fader"), _strip->gain_control()), OSC::instance());
- gain_message ("/select/fader", _strip->gain_control());
- } else {
- _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this, X_("/select/gain"), _strip->gain_control()), OSC::instance());
- gain_message ("/select/gain", _strip->gain_control());
- }
+ _strip->gain_control()->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_automation, this), OSC::instance());
+ _strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this), OSC::instance());
+ gain_automation ();
boost::shared_ptr<Controllable> trim_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->trim_control());
if (trim_controllable) {
}
gain_timeout--;
}
+
+ if (as == ARDOUR::AutoState::Play || as == ARDOUR::AutoState::Touch) {
+ if(_last_gain != _strip->gain_control()->get_value()) {
+ _last_gain = _strip->gain_control()->get_value();
+ gain_message ();
+ }
+ }
}
if (feedback[13]) {
for (uint32_t i = 0; i < send_timeout.size(); i++) {
}
void
-OSCSelectObserver::gain_message (string path, boost::shared_ptr<Controllable> controllable)
+OSCSelectObserver::gain_message ()
{
- lo_message msg = lo_message_new ();
+ float value = _strip->gain_control()->get_value();
if (gainmode) {
- lo_message_add_float (msg, gain_to_slider_position (controllable->get_value()));
- text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (controllable->get_value())));
+ text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)));
gain_timeout = 8;
+ clear_strip ("/select/fader", gain_to_slider_position (value));
} else {
- if (controllable->get_value() < 1e-15) {
- lo_message_add_float (msg, -200);
+ if (value < 1e-15) {
+ clear_strip ("/select/gain", -200);
} else {
- lo_message_add_float (msg, accurate_coefficient_to_dB (controllable->get_value()));
+ clear_strip ("/select/gain", accurate_coefficient_to_dB (value));
}
}
+}
- lo_send_message (addr, path.c_str(), msg);
- lo_message_free (msg);
+void
+OSCSelectObserver::gain_automation ()
+{
+ as = _strip->gain_control()->alist()->automation_state();
+ if (gainmode) {
+ clear_strip ("/select/fader/automation", as);
+ } else {
+ clear_strip ("/select/gain/automation", as);
+ }
+
+ gain_message ();
}
void