OSC add width feedback to strips

Also detect panner type change
This commit is contained in:
Len Ovens
2020-06-22 23:28:12 -07:00
parent 6f0e0000e6
commit 399192da4c
4 changed files with 86 additions and 41 deletions

View File

@@ -87,6 +87,7 @@ OSCRouteObserver::OSCRouteObserver (OSC& o, uint32_t ss, ArdourSurface::OSC::OSC
OSCRouteObserver::~OSCRouteObserver ()
{
_init = true;
pan_connections.drop_connections ();
strip_connections.drop_connections ();
lo_address_free (addr);
@@ -98,6 +99,7 @@ OSCRouteObserver::no_strip ()
// This gets called on drop references
_init = true;
pan_connections.drop_connections ();
strip_connections.drop_connections ();
_gain_control = boost::shared_ptr<ARDOUR::GainControl> ();
_send = boost::shared_ptr<ARDOUR::Send> ();
@@ -128,6 +130,7 @@ OSCRouteObserver::refresh_strip (boost::shared_ptr<ARDOUR::Stripable> new_strip,
_init = false;
return;
}
pan_connections.drop_connections ();
strip_connections.drop_connections ();
_strip = new_strip;
if (!_strip) {
@@ -199,11 +202,12 @@ OSCRouteObserver::refresh_strip (boost::shared_ptr<ARDOUR::Stripable> new_strip,
send_trim_message ();
}
boost::shared_ptr<Controllable> pan_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_azimuth_control());
if (pan_controllable) {
pan_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/pan_stereo_position"), _strip->pan_azimuth_control()), OSC::instance());
send_change_message (X_("/strip/pan_stereo_position"), _strip->pan_azimuth_control());
}
boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (_strip);
boost::shared_ptr<PannerShell> pan_sh = rt->panner_shell();
current_pan_shell = pan_sh;
pan_sh->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::panner_changed, this, current_pan_shell), OSC::instance());
panner_changed (pan_sh);
}
_init = false;
tick();
@@ -227,6 +231,7 @@ OSCRouteObserver::refresh_send (boost::shared_ptr<ARDOUR::Send> new_send, bool f
_init = false;
return;
}
pan_connections.drop_connections ();
strip_connections.drop_connections ();
if (!_strip) {
// this strip is blank and should be cleared
@@ -249,15 +254,11 @@ OSCRouteObserver::refresh_send (boost::shared_ptr<ARDOUR::Send> new_send, bool f
_gain_control->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_gain_message, this), OSC::instance());
gain_automation ();
if (_send->pan_outs() > 1) {
boost::shared_ptr<Controllable> pan_controllable = boost::dynamic_pointer_cast<Controllable>(_send->panner_shell()->panner()->pannable()->pan_azimuth_control);
if (pan_controllable) {
pan_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/pan_stereo_position"), pan_controllable), OSC::instance());
send_change_message (X_("/strip/pan_stereo_position"), pan_controllable);
}
} else {
_osc.float_message_with_id (X_("/strip/pan_stereo_position"), ssid, 0.5, in_line, addr);
}
boost::shared_ptr<PannerShell> pan_sh = _send->panner_shell();
current_pan_shell = pan_sh;
pan_sh->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::panner_changed, this, current_pan_shell), OSC::instance());
panner_changed (pan_sh);
}
_init = false;
tick();
@@ -440,6 +441,29 @@ OSCRouteObserver::name_changed (const PBD::PropertyChange& what_changed)
}
}
void
OSCRouteObserver::panner_changed (boost::shared_ptr<ARDOUR::PannerShell> pan_sh)
{
pan_connections.drop_connections ();
if (feedback[1]) {
boost::shared_ptr<Controllable> pan_controllable = boost::dynamic_pointer_cast<Controllable>(pan_sh->panner()->pannable()->pan_azimuth_control);
if (pan_controllable) {
pan_controllable->Changed.connect (pan_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/pan_stereo_position"), current_pan_shell->panner()->pannable()->pan_azimuth_control), OSC::instance());
send_change_message (X_("/strip/pan_stereo_position"), pan_controllable);
} else {
_osc.float_message_with_id (X_("/strip/pan_stereo_position"), ssid, 0.5, in_line, addr);
}
boost::shared_ptr<Controllable> width_controllable = boost::dynamic_pointer_cast<Controllable>(pan_sh->panner()->pannable()->pan_width_control);
if (width_controllable) {
width_controllable->Changed.connect (pan_connections, MISSING_INVALIDATOR, boost::bind (&OSCRouteObserver::send_change_message, this, X_("/strip/pan_stereo_width"), current_pan_shell->panner()->pannable()->pan_width_control), OSC::instance());
send_change_message (X_("/strip/pan_stereo_width"), width_controllable);
} else {
_osc.float_message_with_id (X_("/strip/pan_stereo_width"), ssid, 1.0, in_line, addr);
}
}
}
void
OSCRouteObserver::group_name ()
{

View File

@@ -29,6 +29,7 @@
#include "pbd/controllable.h"
#include "pbd/stateful.h"
#include "ardour/types.h"
#include "ardour/panner_shell.h"
#include "osc.h"
@@ -56,6 +57,7 @@ class OSCRouteObserver
boost::shared_ptr<ARDOUR::GainControl> _gain_control;
PBD::ScopedConnectionList strip_connections;
PBD::ScopedConnectionList pan_connections;
ArdourSurface::OSC& _osc;
lo_address addr;
@@ -73,10 +75,11 @@ class OSCRouteObserver
bool in_line;
ARDOUR::AutoState as;
bool _tick_busy;
boost::shared_ptr<ARDOUR::PannerShell> current_pan_shell;
void send_clear ();
void name_changed (const PBD::PropertyChange& what_changed);
void panner_changed (boost::shared_ptr<ARDOUR::PannerShell>);
void group_name ();
void pi_changed (PBD::PropertyChange const&);
void send_change_message (std::string path, boost::shared_ptr<PBD::Controllable> controllable);

View File

@@ -35,6 +35,7 @@
#include "ardour/route_group.h"
#include "ardour/route_group_member.h"
#include "ardour/send.h"
#include "ardour/panner_shell.h"
#include "ardour/plugin.h"
#include "ardour/plugin_insert.h"
#include "ardour/processor.h"
@@ -97,6 +98,7 @@ OSCSelectObserver::no_strip ()
// This gets called on drop references
_init = true;
pan_connections.drop_connections ();
strip_connections.drop_connections ();
send_connections.drop_connections ();
plugin_connections.drop_connections ();
@@ -211,31 +213,9 @@ OSCSelectObserver::refresh_strip (boost::shared_ptr<ARDOUR::Stripable> new_strip
trim_message (X_("/select/trimdB"), _strip->trim_control());
}
boost::shared_ptr<Controllable> pan_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_azimuth_control());
if (pan_controllable) {
pan_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_stereo_position"), _strip->pan_azimuth_control()), OSC::instance());
change_message (X_("/select/pan_stereo_position"), _strip->pan_azimuth_control());
}
boost::shared_ptr<Controllable> width_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_width_control());
if (width_controllable) {
width_controllable->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_stereo_width"), _strip->pan_width_control()), OSC::instance());
change_message (X_("/select/pan_stereo_width"), _strip->pan_width_control());
}
// Rest of possible pan controls... Untested because I can't find a way to get them in the GUI :)
if (_strip->pan_elevation_control ()) {
_strip->pan_elevation_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_elevation_position"), _strip->pan_elevation_control()), OSC::instance());
change_message (X_("/select/pan_elevation_position"), _strip->pan_elevation_control());
}
if (_strip->pan_frontback_control ()) {
_strip->pan_frontback_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_frontback_position"), _strip->pan_frontback_control()), OSC::instance());
change_message (X_("/select/pan_frontback_position"), _strip->pan_frontback_control());
}
if (_strip->pan_lfe_control ()) {
_strip->pan_lfe_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_lfe_control"), _strip->pan_lfe_control()), OSC::instance());
change_message (X_("/select/pan_lfe_control"), _strip->pan_lfe_control());
}
boost::shared_ptr<PannerShell> pan_sh = rt->panner_shell();
pan_sh->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::panner_changed, this), OSC::instance());
panner_changed ();
// sends, plugins and eq
// detecting processor changes is now in osc.cc
@@ -676,6 +656,42 @@ OSCSelectObserver::name_changed (const PBD::PropertyChange& what_changed)
}
}
void
OSCSelectObserver::panner_changed ()
{
pan_connections.drop_connections ();
if (feedback[1]) {
boost::shared_ptr<Controllable> pan_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_azimuth_control());
if (pan_controllable) {
pan_controllable->Changed.connect (pan_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_stereo_position"), _strip->pan_azimuth_control()), OSC::instance());
change_message (X_("/select/pan_stereo_position"), _strip->pan_azimuth_control());
}
boost::shared_ptr<Controllable> width_controllable = boost::dynamic_pointer_cast<Controllable>(_strip->pan_width_control());
if (width_controllable) {
width_controllable->Changed.connect (pan_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_stereo_width"), _strip->pan_width_control()), OSC::instance());
change_message (X_("/select/pan_stereo_width"), _strip->pan_width_control());
}
// Rest of possible pan controls... Untested because I can't find a way to get them in the GUI :)
if (_strip->pan_elevation_control ()) {
_strip->pan_elevation_control()->Changed.connect (pan_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_elevation_position"), _strip->pan_elevation_control()), OSC::instance());
change_message (X_("/select/pan_elevation_position"), _strip->pan_elevation_control());
}
if (_strip->pan_frontback_control ()) {
_strip->pan_frontback_control()->Changed.connect (pan_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_frontback_position"), _strip->pan_frontback_control()), OSC::instance());
change_message (X_("/select/pan_frontback_position"), _strip->pan_frontback_control());
}
if (_strip->pan_lfe_control ()) {
_strip->pan_lfe_control()->Changed.connect (pan_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/pan_lfe_control"), _strip->pan_lfe_control()), OSC::instance());
change_message (X_("/select/pan_lfe_control"), _strip->pan_lfe_control());
}
}
}
void
OSCSelectObserver::group_name ()
{

View File

@@ -59,7 +59,8 @@ class OSCSelectObserver
ArdourSurface::OSC& _osc;
PBD::ScopedConnectionList strip_connections;
// sends, plugins and eq need their own
// pans, sends, plugins and eq need their own
PBD::ScopedConnectionList pan_connections;
PBD::ScopedConnectionList send_connections;
PBD::ScopedConnectionList plugin_connections;
PBD::ScopedConnectionList eq_connections;
@@ -97,6 +98,7 @@ class OSCSelectObserver
ARDOUR::Session* session;
void name_changed (const PBD::PropertyChange& what_changed);
void panner_changed ();
void group_name ();
void group_sharing (ARDOUR::RouteGroup *rg_c);
void comment_changed ();