mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
OSC: Expand gainmode to add two new options
fix bug where a surface might have more than one global observer
This commit is contained in:
parent
7671268bc3
commit
7d6e6424c7
7 changed files with 47 additions and 40 deletions
|
|
@ -2057,6 +2057,8 @@ OSC::get_surface (lo_address addr , bool quiet)
|
||||||
void
|
void
|
||||||
OSC::global_feedback (OSCSurface* sur)
|
OSC::global_feedback (OSCSurface* sur)
|
||||||
{
|
{
|
||||||
|
OSCGlobalObserver* o = sur->global_obs;
|
||||||
|
delete o;
|
||||||
if (sur->feedback[4] || sur->feedback[3] || sur->feedback[5] || sur->feedback[6]) {
|
if (sur->feedback[4] || sur->feedback[3] || sur->feedback[5] || sur->feedback[6]) {
|
||||||
|
|
||||||
// create a new Global Observer for this surface
|
// create a new Global Observer for this surface
|
||||||
|
|
@ -3821,7 +3823,7 @@ OSC::_strip_select (boost::shared_ptr<Stripable> s, lo_address addr)
|
||||||
OSCSelectObserver* so = dynamic_cast<OSCSelectObserver*>(sur->sel_obs);
|
OSCSelectObserver* so = dynamic_cast<OSCSelectObserver*>(sur->sel_obs);
|
||||||
if (sur->feedback[13]) {
|
if (sur->feedback[13]) {
|
||||||
if (so != 0) {
|
if (so != 0) {
|
||||||
so->refresh_strip (s, nsends, true);
|
so->refresh_strip (s, nsends, sur->gainmode, true);
|
||||||
} else {
|
} else {
|
||||||
OSCSelectObserver* sel_fb = new OSCSelectObserver (*this, sur);
|
OSCSelectObserver* sel_fb = new OSCSelectObserver (*this, sur);
|
||||||
sur->sel_obs = sel_fb;
|
sur->sel_obs = sel_fb;
|
||||||
|
|
|
||||||
|
|
@ -366,14 +366,16 @@ OSCGlobalObserver::send_gain_message (string path, boost::shared_ptr<Controllabl
|
||||||
}
|
}
|
||||||
if (gainmode) {
|
if (gainmode) {
|
||||||
_osc.float_message (string_compose ("%1fader", path), controllable->internal_to_interface (controllable->get_value()), addr);
|
_osc.float_message (string_compose ("%1fader", path), controllable->internal_to_interface (controllable->get_value()), addr);
|
||||||
|
if (gainmode == 1) {
|
||||||
_osc.text_message (string_compose ("%1name", path), string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (controllable->get_value())), addr);
|
_osc.text_message (string_compose ("%1name", path), string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (controllable->get_value())), addr);
|
||||||
if (ismaster) {
|
if (ismaster) {
|
||||||
master_timeout = 8;
|
master_timeout = 8;
|
||||||
} else {
|
} else {
|
||||||
monitor_timeout = 8;
|
monitor_timeout = 8;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
}
|
||||||
|
if (!gainmode || gainmode == 2) {
|
||||||
if (controllable->get_value() < 1e-15) {
|
if (controllable->get_value() < 1e-15) {
|
||||||
_osc.float_message (string_compose ("%1gain",path), -200, addr);
|
_osc.float_message (string_compose ("%1gain",path), -200, addr);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -461,7 +463,6 @@ OSCGlobalObserver::mark_update ()
|
||||||
_osc.text_message (X_("/marker"), send_str, addr);
|
_osc.text_message (X_("/marker"), send_str, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,8 @@ OSC_GUI::OSC_GUI (OSC& p)
|
||||||
table->attach (gainmode_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
table->attach (gainmode_combo, 1, 2, n, n+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
||||||
std::vector<std::string> gainmode_options;
|
std::vector<std::string> gainmode_options;
|
||||||
gainmode_options.push_back (_("/strip/gain (dB)"));
|
gainmode_options.push_back (_("/strip/gain (dB)"));
|
||||||
|
gainmode_options.push_back (_("/strip/fader (Position) and dB in control name"));
|
||||||
|
gainmode_options.push_back (_("/strip/fader (Position) and /strip/gain (dB)"));
|
||||||
gainmode_options.push_back (_("/strip/fader (Position)"));
|
gainmode_options.push_back (_("/strip/fader (Position)"));
|
||||||
|
|
||||||
set_popdown_strings (gainmode_combo, gainmode_options);
|
set_popdown_strings (gainmode_combo, gainmode_options);
|
||||||
|
|
@ -583,9 +585,15 @@ OSC_GUI::gainmode_changed ()
|
||||||
if (str == _("/strip/gain (dB)")) {
|
if (str == _("/strip/gain (dB)")) {
|
||||||
cp.set_gainmode (0);
|
cp.set_gainmode (0);
|
||||||
}
|
}
|
||||||
else if (str == _("/strip/fader (Position)")) {
|
else if (str == _("/strip/fader (Position) and dB in control name")) {
|
||||||
cp.set_gainmode (1);
|
cp.set_gainmode (1);
|
||||||
}
|
}
|
||||||
|
else if (str == _("/strip/fader (Position) and /strip/gain (dB)")) {
|
||||||
|
cp.set_gainmode (2);
|
||||||
|
}
|
||||||
|
else if (str == _("/strip/fader (Position)")) {
|
||||||
|
cp.set_gainmode (3);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
std::cerr << "Invalid OSC Gain Mode\n";
|
std::cerr << "Invalid OSC Gain Mode\n";
|
||||||
assert (0);
|
assert (0);
|
||||||
|
|
|
||||||
|
|
@ -322,12 +322,6 @@ OSCRouteObserver::tick ()
|
||||||
}
|
}
|
||||||
gain_timeout--;
|
gain_timeout--;
|
||||||
}
|
}
|
||||||
if (trim_timeout) {
|
|
||||||
if (trim_timeout == 1) {
|
|
||||||
_osc.text_message_with_id ("/strip/name", ssid, _strip->name(), in_line, addr);
|
|
||||||
}
|
|
||||||
trim_timeout--;
|
|
||||||
}
|
|
||||||
if (as == ARDOUR::Play || as == ARDOUR::Touch) {
|
if (as == ARDOUR::Play || as == ARDOUR::Touch) {
|
||||||
if(_last_gain != _strip->gain_control()->get_value()) {
|
if(_last_gain != _strip->gain_control()->get_value()) {
|
||||||
_last_gain = _strip->gain_control()->get_value();
|
_last_gain = _strip->gain_control()->get_value();
|
||||||
|
|
@ -392,11 +386,6 @@ OSCRouteObserver::send_trim_message ()
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (gainmode) {
|
|
||||||
_osc.text_message_with_id ("/strip/name", ssid, string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (_last_trim)), in_line, addr);
|
|
||||||
trim_timeout = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
_osc.float_message_with_id ("/strip/trimdB", ssid, (float) accurate_coefficient_to_dB (_last_trim), in_line, addr);
|
_osc.float_message_with_id ("/strip/trimdB", ssid, (float) accurate_coefficient_to_dB (_last_trim), in_line, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -412,9 +401,12 @@ OSCRouteObserver::send_gain_message ()
|
||||||
|
|
||||||
if (gainmode) {
|
if (gainmode) {
|
||||||
_osc.float_message_with_id ("/strip/fader", ssid, controllable->internal_to_interface (_last_gain), in_line, addr);
|
_osc.float_message_with_id ("/strip/fader", ssid, controllable->internal_to_interface (_last_gain), in_line, addr);
|
||||||
|
if (gainmode == 1) {
|
||||||
_osc.text_message_with_id ("/strip/name", ssid, string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (controllable->get_value())), in_line, addr);
|
_osc.text_message_with_id ("/strip/name", ssid, string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (controllable->get_value())), in_line, addr);
|
||||||
gain_timeout = 8;
|
gain_timeout = 8;
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
if (!gainmode || gainmode == 2) {
|
||||||
if (controllable->get_value() < 1e-15) {
|
if (controllable->get_value() < 1e-15) {
|
||||||
_osc.float_message_with_id ("/strip/gain", ssid, -200, in_line, addr);
|
_osc.float_message_with_id ("/strip/gain", ssid, -200, in_line, addr);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ class OSCRouteObserver
|
||||||
ArdourSurface::OSC::OSCSurface* sur;
|
ArdourSurface::OSC::OSCSurface* sur;
|
||||||
float _last_meter;
|
float _last_meter;
|
||||||
uint32_t gain_timeout;
|
uint32_t gain_timeout;
|
||||||
uint32_t trim_timeout;
|
|
||||||
float _last_gain;
|
float _last_gain;
|
||||||
float _last_trim;
|
float _last_trim;
|
||||||
bool _init;
|
bool _init;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ OSCSelectObserver::OSCSelectObserver (OSC& o, ArdourSurface::OSC::OSCSurface* su
|
||||||
} else {
|
} else {
|
||||||
plug_id = -1;
|
plug_id = -1;
|
||||||
}
|
}
|
||||||
refresh_strip (sur->select, sur->nsends, true);
|
refresh_strip (sur->select, sur->nsends, gainmode, true);
|
||||||
set_expand (sur->expand_enable);
|
set_expand (sur->expand_enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,12 +104,13 @@ OSCSelectObserver::no_strip ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
OSCSelectObserver::refresh_strip (boost::shared_ptr<ARDOUR::Stripable> new_strip, uint32_t s_nsends, bool force)
|
OSCSelectObserver::refresh_strip (boost::shared_ptr<ARDOUR::Stripable> new_strip, uint32_t s_nsends, uint32_t gm, bool force)
|
||||||
{
|
{
|
||||||
_init = true;
|
_init = true;
|
||||||
if (_tick_busy) {
|
if (_tick_busy) {
|
||||||
Glib::usleep(100); // let tick finish
|
Glib::usleep(100); // let tick finish
|
||||||
}
|
}
|
||||||
|
gainmode = gm;
|
||||||
|
|
||||||
if (_strip && (new_strip == _strip) && !force) {
|
if (_strip && (new_strip == _strip) && !force) {
|
||||||
_init = false;
|
_init = false;
|
||||||
|
|
@ -384,7 +385,7 @@ OSCSelectObserver::send_init()
|
||||||
_osc.float_message_with_id ("/select/send_enable", c, proc->enabled(), in_line, addr);
|
_osc.float_message_with_id ("/select/send_enable", c, proc->enabled(), in_line, addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!gainmode && send_valid) {
|
if ((gainmode != 1) && send_valid) {
|
||||||
_osc.text_message_with_id ("/select/send_name", c, _strip->send_name(s), in_line, addr);
|
_osc.text_message_with_id ("/select/send_name", c, _strip->send_name(s), in_line, addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -732,10 +733,13 @@ OSCSelectObserver::gain_message ()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gainmode) {
|
if (gainmode) {
|
||||||
|
_osc.float_message ("/select/fader", _strip->gain_control()->internal_to_interface (value), addr);
|
||||||
|
if (gainmode == 1) {
|
||||||
_osc.text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)), addr);
|
_osc.text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)), addr);
|
||||||
gain_timeout = 8;
|
gain_timeout = 8;
|
||||||
_osc.float_message ("/select/fader", _strip->gain_control()->internal_to_interface (value), addr);
|
}
|
||||||
} else {
|
}
|
||||||
|
if (!gainmode || gainmode == 2) {
|
||||||
if (value < 1e-15) {
|
if (value < 1e-15) {
|
||||||
_osc.float_message ("/select/gain", -200, addr);
|
_osc.float_message ("/select/gain", -200, addr);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -812,20 +816,21 @@ OSCSelectObserver::send_gain (uint32_t id, boost::shared_ptr<PBD::Controllable>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gainmode) {
|
if (gainmode) {
|
||||||
path = "/select/send_fader";
|
|
||||||
if (controllable) {
|
if (controllable) {
|
||||||
value = controllable->internal_to_interface (raw_value);
|
value = controllable->internal_to_interface (raw_value);
|
||||||
}
|
}
|
||||||
|
_osc.float_message_with_id ("/select/send_fader", id, value, in_line, addr);
|
||||||
|
if (gainmode == 1) {
|
||||||
_osc.text_message_with_id ("/select/send_name" , id, string_compose ("%1%2%3", std::fixed, std::setprecision(2), db), in_line, addr);
|
_osc.text_message_with_id ("/select/send_name" , id, string_compose ("%1%2%3", std::fixed, std::setprecision(2), db), in_line, addr);
|
||||||
if (send_timeout.size() > id) {
|
if (send_timeout.size() > id) {
|
||||||
send_timeout[id] = 8;
|
send_timeout[id] = 8;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
path = "/select/send_gain";
|
}
|
||||||
value = db;
|
if (!gainmode || gainmode == 2) {
|
||||||
|
_osc.float_message_with_id ("/select/send_gain", id, db, in_line, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
_osc.float_message_with_id (path, id, value, in_line, addr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class OSCSelectObserver
|
||||||
void renew_plugin (void);
|
void renew_plugin (void);
|
||||||
void eq_restart (int);
|
void eq_restart (int);
|
||||||
void clear_observer (void);
|
void clear_observer (void);
|
||||||
void refresh_strip (boost::shared_ptr<ARDOUR::Stripable> new_strip, uint32_t nsends, bool force);
|
void refresh_strip (boost::shared_ptr<ARDOUR::Stripable> new_strip, uint32_t nsends, uint32_t g_mode, bool force);
|
||||||
void set_expand (uint32_t expand);
|
void set_expand (uint32_t expand);
|
||||||
void set_send_page (uint32_t page);
|
void set_send_page (uint32_t page);
|
||||||
void set_send_size (uint32_t size);
|
void set_send_size (uint32_t size);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue