13
0

OSC: Fix select fader automation play feedback as well fixes issue #7160

This commit is contained in:
Len Ovens 2017-05-09 14:10:49 -07:00
parent a12d4c87c6
commit 82fed14f41
2 changed files with 38 additions and 5 deletions

View File

@ -49,8 +49,10 @@ OSCSelectObserver::OSCSelectObserver (boost::shared_ptr<Stripable> s, lo_address
,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::AutoState::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());
@ -99,12 +101,15 @@ OSCSelectObserver::OSCSelectObserver (boost::shared_ptr<Stripable> s, lo_address
}
if (feedback[1]) { // level controls
boost::shared_ptr<GainControl> gain_cont = _strip->gain_control();
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());
gain_cont->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCSelectObserver::gain_automation, this, X_("/select/fader")), OSC::instance());
gain_cont->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this, X_("/select/fader"), gain_cont), OSC::instance());
gain_automation ("/select/fader");
} 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());
gain_cont->alist()->automation_state_changed.connect (strip_connections, MISSING_INVALIDATOR, bind (&OSCSelectObserver::gain_automation, this, X_("/select/gain")), OSC::instance());
gain_cont->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::gain_message, this, X_("/select/gain"), _strip->gain_control()), OSC::instance());
gain_automation ("/strip/gain");
}
boost::shared_ptr<Controllable> trim_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->trim_control());
@ -366,6 +371,18 @@ OSCSelectObserver::tick ()
}
}
}
if (feedback[1]) {
if (as != ARDOUR::AutoState::Off) {
if(_last_gain != _strip->gain_control()->get_value()) {
_last_gain = _strip->gain_control()->get_value();
if (gainmode) {
gain_message ("/select/fader", _strip->gain_control());
} else {
gain_message ("/select/fader", _strip->gain_control());
}
}
}
}
}
@ -510,6 +527,20 @@ OSCSelectObserver::gain_message (string path, boost::shared_ptr<Controllable> co
lo_message_free (msg);
}
void
OSCSelectObserver::gain_automation (string path)
{
lo_message msg = lo_message_new ();
string apath = string_compose ("%1/automation", path);
boost::shared_ptr<GainControl> control = _strip->gain_control();
as = control->alist()->automation_state();
lo_message_add_float (msg, as);
gain_message (path, control);
lo_send_message (addr, apath.c_str(), msg);
lo_message_free (msg);
}
void
OSCSelectObserver::send_gain (uint32_t id, boost::shared_ptr<PBD::Controllable> controllable)
{

View File

@ -58,7 +58,8 @@ class OSCSelectObserver
uint32_t gain_timeout;
float _last_meter;
uint32_t nsends;
float _last_gain;
ARDOUR::AutoState as;
void name_changed (const PBD::PropertyChange& what_changed);
void change_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable);
@ -70,6 +71,7 @@ class OSCSelectObserver
void text_with_id (std::string path, uint32_t id, std::string name);
void monitor_status (boost::shared_ptr<PBD::Controllable> controllable);
void gain_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable);
void gain_automation (std::string path);
void trim_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable);
// sends stuff
void send_init (void);