#include "ardour/solo_isolate_control.h"
#include "ardour/solo_safe_control.h"
#include "ardour/route.h"
+#include "ardour/route_group.h"
#include "ardour/send.h"
#include "ardour/plugin.h"
#include "ardour/plugin_insert.h"
feedback = sur->feedback;
in_line = feedback[2];
send_page_size = sur->send_page_size;
- plug_page_size = sur->plug_page_size;
+ send_size = send_page_size;
send_page = sur->send_page;
- refresh_strip (sur->select, sur->nsends, true);
+ plug_page_size = sur->plug_page_size;
+ plug_size = plug_page_size;
+ plug_page = sur->plug_page;
+ if (sur->plugins.size () > 0) {
+ plug_id = sur->plugins[sur->plugin_id - 1];
+ } else {
+ plug_id = -1;
+ }
+ refresh_strip (sur->select, sur->nsends, gainmode, true);
set_expand (sur->expand_enable);
}
}
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;
if (_tick_busy) {
Glib::usleep(100); // let tick finish
}
+ gainmode = gm;
if (_strip && (new_strip == _strip) && !force) {
_init = false;
_strip->DropReferences.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::no_strip, this), OSC::instance());
as = ARDOUR::Off;
- send_size = 0;
- plug_size = 0;
_comp_redux = 1;
nsends = s_nsends;
_last_gain = -1.0;
_strip->PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::name_changed, this, boost::lambda::_1), OSC::instance());
name_changed (ARDOUR::Properties::name);
+ boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (_strip);
+ rt->route_group_changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::group_name, this), OSC::instance());
+ group_name ();
+
+ _strip->presentation_info().PropertyChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::pi_changed, this, _1), OSC::instance());
+ _osc.float_message ("/select/hide", _strip->is_hidden (), addr);
+
_strip->mute_control()->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/mute"), _strip->mute_control()), OSC::instance());
change_message ("/select/mute", _strip->mute_control());
}
}
-void
-OSCSelectObserver::set_send_page (uint32_t page)
-{
- send_page = page;
- renew_sends ();
-}
-
-void
-OSCSelectObserver::set_send_size (uint32_t size)
-{
- send_page_size = size;
- renew_sends ();
-}
-
void
OSCSelectObserver::clear_observer ()
{
// all strip buttons should be off and faders 0 and etc.
_osc.float_message ("/select/expand", 0, addr);
_osc.text_message ("/select/name", " ", addr);
+ _osc.text_message ("/select/group/name", " ", addr);
_osc.text_message ("/select/comment", " ", addr);
_osc.float_message ("/select/mute", 0, addr);
_osc.float_message ("/select/solo", 0, addr);
eq_end();
}
+void
+OSCSelectObserver::set_send_page (uint32_t page)
+{
+ if (send_page != page) {
+ send_page = page;
+ renew_sends ();
+ }
+}
+
+void
+OSCSelectObserver::set_send_size (uint32_t size)
+{
+ send_page_size = size;
+ renew_sends ();
+}
+
void
OSCSelectObserver::renew_sends () {
send_connections.drop_connections ();
send_init();
}
-void
-OSCSelectObserver::renew_plugin () {
- plugin_end();
- plugin_init();
-}
-
void
OSCSelectObserver::send_init()
{
_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);
}
}
}
+void
+OSCSelectObserver::send_end ()
+{
+ send_connections.drop_connections ();
+ for (uint32_t i = 1; i <= send_size; i++) {
+ if (gainmode) {
+ _osc.float_message_with_id ("/select/send_fader", i, 0, in_line, addr);
+ } else {
+ _osc.float_message_with_id ("/select/send_gain", i, -193, in_line, addr);
+ }
+ // next enable
+ _osc.float_message_with_id ("/select/send_enable", i, 0, in_line, addr);
+ // next name
+ _osc.text_message_with_id ("/select/send_name", i, " ", in_line, addr);
+ }
+ // need to delete or clear send_timeout
+ send_size = 0;
+ send_timeout.clear();
+}
+
+void
+OSCSelectObserver::set_plugin_id (int id, uint32_t page)
+{
+ plug_id = id;
+ plug_page = page;
+ renew_plugin ();
+}
+
+void
+OSCSelectObserver::set_plugin_page (uint32_t page)
+{
+ plug_page = page;
+ renew_plugin ();
+}
+
+void
+OSCSelectObserver::set_plugin_size (uint32_t size)
+{
+ plug_page_size = size;
+ renew_plugin ();
+}
+
+void
+OSCSelectObserver::renew_plugin () {
+ plugin_connections.drop_connections ();
+ plugin_init();
+}
+
void
OSCSelectObserver::plugin_init()
{
- if (!sur->plugin_id || !sur->plugins.size ()) {
+ if (plug_id < 0) {
+ plugin_end ();
return;
}
-
boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(_strip);
if (!r) {
+ plugin_end ();
return;
}
// we have a plugin number now get the processor
- boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]);
+ boost::shared_ptr<Processor> proc = r->nth_plugin (plug_id);
boost::shared_ptr<PluginInsert> pi;
if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
+ plugin_end ();
return;
}
boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
+ // we have a plugin we can ask if it is activated
+ proc->ActiveChanged.connect (plugin_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::plug_enable, this, X_("/select/plugin/activate"), proc), OSC::instance());
+ _osc.float_message ("/select/plugin/activate", proc->enabled(), addr);
bool ok = false;
- nplug_params = sur->plug_params.size ();
+ // put only input controls into a vector
+ plug_params.clear ();
+ uint32_t nplug_params = pip->parameter_count();
+ for ( uint32_t ppi = 0; ppi < nplug_params; ++ppi) {
+ uint32_t controlid = pip->nth_parameter(ppi, ok);
+ if (!ok) {
+ continue;
+ }
+ if (pip->parameter_is_input(controlid)) {
+ plug_params.push_back (ppi);
+ }
+ }
+ nplug_params = plug_params.size ();
// default of 0 page size means show all
plug_size = nplug_params;
plug_size = plug_page_size;
}
_osc.text_message ("/select/plugin/name", pip->name(), addr);
- uint32_t page_end = nplug_params;
- uint32_t max_page = 1;
- if (plug_size && nplug_params) {
- max_page = (uint32_t)((nplug_params - 1) / plug_size) + 1;
- }
-
- if (sur->plug_page < 1) {
- sur->plug_page = 1;
- }
- if ((uint32_t)sur->plug_page > max_page) {
- sur->plug_page = max_page;
- }
- uint32_t page_start = ((sur->plug_page - 1) * plug_size);
- page_end = sur->plug_page * plug_size;
+ uint32_t page_start = plug_page - 1;
+ uint32_t page_end = page_start + plug_size;
int pid = 1;
for ( uint32_t ppi = page_start; ppi < page_end; ++ppi, ++pid) {
continue;
}
- uint32_t controlid = pip->nth_parameter(sur->plug_params[ppi], ok);
+ uint32_t controlid = pip->nth_parameter(plug_params[ppi], ok);
if (!ok) {
continue;
}
}
}
-void
-OSCSelectObserver::send_end ()
-{
- send_connections.drop_connections ();
- for (uint32_t i = 1; i <= send_size; i++) {
- if (gainmode) {
- _osc.float_message_with_id ("/select/send_fader", i, 0, in_line, addr);
- } else {
- _osc.float_message_with_id ("/select/send_gain", i, -193, in_line, addr);
- }
- // next enable
- _osc.float_message_with_id ("/select/send_enable", i, 0, in_line, addr);
- // next name
- _osc.text_message_with_id ("/select/send_name", i, " ", in_line, addr);
- }
- // need to delete or clear send_timeout
- send_timeout.clear();
-}
-
void
OSCSelectObserver::plugin_parameter_changed (int pid, bool swtch, boost::shared_ptr<PBD::Controllable> controllable)
{
OSCSelectObserver::plugin_end ()
{
plugin_connections.drop_connections ();
+ _osc.float_message ("/select/plugin/activate", 0, addr);
_osc.text_message ("/select/plugin/name", " ", addr);
for (uint32_t i = 1; i <= plug_size; i++) {
_osc.float_message_with_id ("/select/plugin/parameter", i, 0, in_line, addr);
// next name
_osc.text_message_with_id ("/select/plugin/parameter/name", i, " ", in_line, addr);
}
+ plug_size = 0;
nplug_params = 0;
}
}
}
+void
+OSCSelectObserver::group_name ()
+{
+ boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (_strip);
+
+ RouteGroup *rg = rt->route_group();
+ if (rg) {
+ _osc.text_message ("/select/group/name", rg->name(), addr);
+ } else {
+ _osc.text_message ("/select/group/name", " ", addr);
+ }
+}
+
+void
+OSCSelectObserver::pi_changed (PBD::PropertyChange const& what_changed)
+{
+ _osc.float_message ("/select/hide", _strip->is_hidden (), addr);
+}
+
void
OSCSelectObserver::change_message (string path, boost::shared_ptr<Controllable> controllable)
{
}
+void
+OSCSelectObserver::plug_enable (string path, boost::shared_ptr<Processor> proc)
+{
+ // with no delay value is wrong
+ Glib::usleep(10);
+
+ _osc.float_message (path, proc->enabled(), addr);
+}
+
void
OSCSelectObserver::change_message_with_id (string path, uint32_t id, boost::shared_ptr<Controllable> controllable)
{
}
if (gainmode) {
- _osc.text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)), addr);
- gain_timeout = 8;
_osc.float_message ("/select/fader", _strip->gain_control()->internal_to_interface (value), addr);
- } else {
+ if (gainmode == 1) {
+ _osc.text_message ("/select/name", string_compose ("%1%2%3", std::fixed, std::setprecision(2), accurate_coefficient_to_dB (value)), addr);
+ gain_timeout = 8;
+ }
+ }
+ if (!gainmode || gainmode == 2) {
if (value < 1e-15) {
_osc.float_message ("/select/gain", -200, addr);
} else {
#endif
if (gainmode) {
- path = "/select/send_fader";
if (controllable) {
value = controllable->internal_to_interface (raw_value);
}
- _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) {
- send_timeout[id] = 8;
+ _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);
+ if (send_timeout.size() > id) {
+ 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