OSC: only use gain change signals if value changes
This commit is contained in:
@@ -49,6 +49,7 @@ OSCCueObserver::OSCCueObserver (boost::shared_ptr<Stripable> s, std::vector<boos
|
||||
send_change_message ("/cue/mute", 0, _strip->mute_control());
|
||||
|
||||
gain_timeout.push_back (0);
|
||||
_last_gain.push_back (0.0);
|
||||
_strip->gain_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCCueObserver::send_gain_message, this, 0, _strip->gain_control()), OSC::instance());
|
||||
send_gain_message (0, _strip->gain_control());
|
||||
|
||||
@@ -132,6 +133,7 @@ OSCCueObserver::send_init()
|
||||
|
||||
if (send->gain_control()) {
|
||||
gain_timeout.push_back (0);
|
||||
_last_gain.push_back (0.0);
|
||||
send->gain_control()->Changed.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCCueObserver::send_gain_message, this, i + 1, send->gain_control()), OSC::instance());
|
||||
send_gain_message (i + 1, send->gain_control());
|
||||
}
|
||||
@@ -213,6 +215,11 @@ OSCCueObserver::text_with_id (string path, uint32_t id, string val)
|
||||
void
|
||||
OSCCueObserver::send_gain_message (uint32_t id, boost::shared_ptr<Controllable> controllable)
|
||||
{
|
||||
if (_last_gain[id] != controllable->get_value()) {
|
||||
_last_gain[id] = controllable->get_value();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
string path = "/cue";
|
||||
if (id) {
|
||||
path = "/cue/send";
|
||||
|
||||
@@ -54,6 +54,7 @@ class OSCCueObserver
|
||||
float _last_meter;
|
||||
std::vector<uint32_t> gain_timeout;
|
||||
bool tick_enable;
|
||||
std::vector<float> _last_gain;
|
||||
|
||||
void name_changed (const PBD::PropertyChange& what_changed, uint32_t id);
|
||||
void send_change_message (std::string path, uint32_t id, boost::shared_ptr<PBD::Controllable> controllable);
|
||||
|
||||
@@ -39,6 +39,9 @@ using namespace ArdourSurface;
|
||||
OSCGlobalObserver::OSCGlobalObserver (Session& s, ArdourSurface::OSC::OSCSurface* su)
|
||||
: sur (su)
|
||||
,_init (true)
|
||||
,_last_master_gain (0.0)
|
||||
,_last_master_trim (0.0)
|
||||
,_last_monitor_gain (0.0)
|
||||
{
|
||||
addr = lo_address_new_from_url (sur->remote_url.c_str());
|
||||
//addr = lo_address_new (lo_address_get_hostname(a) , lo_address_get_port(a));
|
||||
@@ -268,10 +271,25 @@ OSCGlobalObserver::send_change_message (string path, boost::shared_ptr<Controlla
|
||||
void
|
||||
OSCGlobalObserver::send_gain_message (string path, boost::shared_ptr<Controllable> controllable)
|
||||
{
|
||||
bool ismaster = false;
|
||||
if (path.find("master") != std::string::npos) {
|
||||
ismaster = true;
|
||||
if (_last_master_gain != controllable->get_value()) {
|
||||
_last_master_gain = controllable->get_value();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (_last_monitor_gain != controllable->get_value()) {
|
||||
_last_monitor_gain = controllable->get_value();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (gainmode) {
|
||||
float_message (string_compose ("%1fader", path), controllable->internal_to_interface (controllable->get_value()));
|
||||
text_message (string_compose ("%1name", path), string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (controllable->get_value())));
|
||||
if (path.find("master") != std::string::npos) {
|
||||
if (ismaster) {
|
||||
master_timeout = 8;
|
||||
} else {
|
||||
monitor_timeout = 8;
|
||||
@@ -289,6 +307,11 @@ OSCGlobalObserver::send_gain_message (string path, boost::shared_ptr<Controllabl
|
||||
void
|
||||
OSCGlobalObserver::send_trim_message (string path, boost::shared_ptr<Controllable> controllable)
|
||||
{
|
||||
if (_last_master_trim != controllable->get_value()) {
|
||||
_last_master_trim = controllable->get_value();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
float_message (X_("/master/trimdB"), (float) accurate_coefficient_to_dB (controllable->get_value()));
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,9 @@ class OSCGlobalObserver
|
||||
|
||||
ArdourSurface::OSC::OSCSurface* sur;
|
||||
bool _init;
|
||||
float _last_master_gain;
|
||||
float _last_master_trim;
|
||||
float _last_monitor_gain;
|
||||
lo_address addr;
|
||||
std::string path;
|
||||
uint32_t gainmode;
|
||||
|
||||
@@ -43,6 +43,7 @@ OSCRouteObserver::OSCRouteObserver (boost::shared_ptr<Stripable> s, uint32_t ss,
|
||||
,ssid (ss)
|
||||
,sur (su)
|
||||
,_last_gain (0.0)
|
||||
,_last_trim (0.0)
|
||||
,_init (true)
|
||||
{
|
||||
addr = lo_address_new_from_url (sur->remote_url.c_str());
|
||||
@@ -342,6 +343,11 @@ OSCRouteObserver::send_monitor_status (boost::shared_ptr<Controllable> controlla
|
||||
void
|
||||
OSCRouteObserver::send_trim_message (string path, boost::shared_ptr<Controllable> controllable)
|
||||
{
|
||||
if (_last_trim != controllable->get_value()) {
|
||||
_last_trim = controllable->get_value();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (gainmode) {
|
||||
text_with_id ("/strip/name", ssid, string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (controllable->get_value())));
|
||||
trim_timeout = 8;
|
||||
@@ -364,6 +370,11 @@ OSCRouteObserver::send_trim_message (string path, boost::shared_ptr<Controllable
|
||||
void
|
||||
OSCRouteObserver::send_gain_message (string path, boost::shared_ptr<Controllable> controllable)
|
||||
{
|
||||
if (_last_gain != controllable->get_value()) {
|
||||
_last_gain = controllable->get_value();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
lo_message msg = lo_message_new ();
|
||||
|
||||
if (feedback[2]) {
|
||||
|
||||
@@ -59,6 +59,7 @@ class OSCRouteObserver
|
||||
uint32_t gain_timeout;
|
||||
uint32_t trim_timeout;
|
||||
float _last_gain;
|
||||
float _last_trim;
|
||||
bool _init;
|
||||
ARDOUR::AutoState as;
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ OSCSelectObserver::OSCSelectObserver (boost::shared_ptr<Stripable> s, lo_address
|
||||
,sur (su)
|
||||
,nsends (0)
|
||||
,_last_gain (0.0)
|
||||
,_last_trim (0.0)
|
||||
,_init (true)
|
||||
{
|
||||
addr = lo_address_new_from_url (sur->remote_url.c_str());
|
||||
@@ -278,6 +279,8 @@ OSCSelectObserver::send_init()
|
||||
uint32_t last_send = sur->send_page * send_size;
|
||||
uint32_t c = 1;
|
||||
send_timeout.push_back (2);
|
||||
_last_send.clear();
|
||||
_last_send.push_back (0.0);
|
||||
|
||||
for (uint32_t s = page_start; s < last_send; ++s, ++c) {
|
||||
|
||||
@@ -285,6 +288,7 @@ OSCSelectObserver::send_init()
|
||||
if (_strip->send_level_controllable (s)) {
|
||||
_strip->send_level_controllable(s)->Changed.connect (send_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::send_gain, this, c, _strip->send_level_controllable(s)), OSC::instance());
|
||||
send_timeout.push_back (2);
|
||||
_last_send.push_back (0.0);
|
||||
send_gain (c, _strip->send_level_controllable(s));
|
||||
send_valid = true;
|
||||
}
|
||||
@@ -619,6 +623,11 @@ OSCSelectObserver::monitor_status (boost::shared_ptr<Controllable> controllable)
|
||||
void
|
||||
OSCSelectObserver::trim_message (string path, boost::shared_ptr<Controllable> controllable)
|
||||
{
|
||||
if (_last_trim != controllable->get_value()) {
|
||||
_last_trim = controllable->get_value();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
lo_message msg = lo_message_new ();
|
||||
|
||||
lo_message_add_float (msg, (float) accurate_coefficient_to_dB (controllable->get_value()));
|
||||
@@ -631,6 +640,11 @@ void
|
||||
OSCSelectObserver::gain_message ()
|
||||
{
|
||||
float value = _strip->gain_control()->get_value();
|
||||
if (_last_gain != value) {
|
||||
_last_gain = value;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gainmode) {
|
||||
text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)));
|
||||
@@ -686,6 +700,11 @@ OSCSelectObserver::gain_automation ()
|
||||
void
|
||||
OSCSelectObserver::send_gain (uint32_t id, boost::shared_ptr<PBD::Controllable> controllable)
|
||||
{
|
||||
if (_last_send[id] != controllable->get_value()) {
|
||||
_last_send[id] = controllable->get_value();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
lo_message msg = lo_message_new ();
|
||||
string path;
|
||||
float value;
|
||||
|
||||
@@ -66,6 +66,8 @@ class OSCSelectObserver
|
||||
float _last_meter;
|
||||
uint32_t nsends;
|
||||
float _last_gain;
|
||||
float _last_trim;
|
||||
std::vector<float> _last_send;
|
||||
bool _init;
|
||||
float _comp_redux;
|
||||
ARDOUR::AutoState as;
|
||||
|
||||
Reference in New Issue
Block a user