#include "pbd/gstdio_compat.h"
#include <glibmm.h>
+#include "pbd/control_math.h"
#include <pbd/convert.h>
#include <pbd/pthread_utils.h>
#include <pbd/file_utils.h>
#include "ardour/route.h"
#include "ardour/audio_track.h"
#include "ardour/midi_track.h"
+#include "ardour/vca.h"
#include "ardour/monitor_control.h"
#include "ardour/dB.h"
#include "ardour/filesystem_paths.h"
#include "ardour/plugin.h"
#include "ardour/plugin_insert.h"
#include "ardour/presentation_info.h"
+#include "ardour/profile.h"
#include "ardour/send.h"
#include "ardour/internal_send.h"
#include "ardour/phase_control.h"
, _osc_server (0)
, _osc_unix_server (0)
, _debugmode (Off)
- , address_only (false)
+ , address_only (true)
, remote_port ("8000")
, default_banksize (0)
, default_strip (159)
, default_feedback (0)
, default_gainmode (0)
+ , default_send_size (0)
+ , default_plugin_size (0)
, tick (true)
, bank_dirty (false)
, scrub_speed (0)
periodic_connection = periodic_timeout->connect (sigc::mem_fun (*this, &OSC::periodic));
periodic_timeout->attach (main_loop()->get_context());
- // catch changes to selection for GUI_select mode
- StripableSelectionChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&OSC::gui_selection_changed, this), this);
-
// catch track reordering
// receive routes added
session->RouteAdded.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&OSC::notify_routes_added, this, _1), this);
periodic_connection.disconnect ();
session_connections.drop_connections ();
cueobserver_connections.drop_connections ();
+ Glib::Threads::Mutex::Lock lm (surfaces_lock);
// Delete any active route observers
for (RouteObservers::iterator x = route_observers.begin(); x != route_observers.end();) {
// Some controls have optional "f" for feedback or touchosc
// http://hexler.net/docs/touchosc-controls-reference
- REGISTER_CALLBACK (serv, "/set_surface", "iiii", set_surface);
- REGISTER_CALLBACK (serv, "/set_surface/feedback", "i", set_surface_feedback);
- REGISTER_CALLBACK (serv, "/set_surface/bank_size", "i", set_surface_bank_size);
- REGISTER_CALLBACK (serv, "/set_surface/gainmode", "i", set_surface_gainmode);
- REGISTER_CALLBACK (serv, "/set_surface/strip_types", "i", set_surface_strip_types);
REGISTER_CALLBACK (serv, "/refresh", "", refresh_surface);
REGISTER_CALLBACK (serv, "/refresh", "f", refresh_surface);
REGISTER_CALLBACK (serv, "/strip/list", "", routes_list);
+ REGISTER_CALLBACK (serv, "/strip/list", "f", routes_list);
REGISTER_CALLBACK (serv, "/add_marker", "", add_marker);
REGISTER_CALLBACK (serv, "/add_marker", "f", add_marker);
REGISTER_CALLBACK (serv, "/access_action", "s", access_action);
REGISTER_CALLBACK (serv, "/scroll_dn_1_page", "f", scroll_dn_1_page);
REGISTER_CALLBACK (serv, "/scroll_dn_1_page", "", scroll_dn_1_page);
REGISTER_CALLBACK (serv, "/bank_up", "", bank_up);
- REGISTER_CALLBACK (serv, "/bank_up", "f", bank_up);
+ REGISTER_CALLBACK (serv, "/bank_up", "f", bank_delta);
REGISTER_CALLBACK (serv, "/bank_down", "", bank_down);
REGISTER_CALLBACK (serv, "/bank_down", "f", bank_down);
+ REGISTER_CALLBACK (serv, "/use_group", "f", use_group);
// controls for "special" strips
REGISTER_CALLBACK (serv, "/master/gain", "f", master_set_gain);
REGISTER_CALLBACK (serv, "/master/fader", "f", master_set_fader);
+ REGISTER_CALLBACK (serv, "/master/db_delta", "f", master_delta_gain);
REGISTER_CALLBACK (serv, "/master/mute", "i", master_set_mute);
REGISTER_CALLBACK (serv, "/master/trimdB", "f", master_set_trim);
REGISTER_CALLBACK (serv, "/master/pan_stereo_position", "f", master_set_pan_stereo_position);
+ REGISTER_CALLBACK (serv, "/master/select", "f", master_select);
REGISTER_CALLBACK (serv, "/monitor/gain", "f", monitor_set_gain);
REGISTER_CALLBACK (serv, "/monitor/fader", "f", monitor_set_fader);
+ REGISTER_CALLBACK (serv, "/monitor/db_delta", "f", monitor_delta_gain);
REGISTER_CALLBACK (serv, "/monitor/mute", "i", monitor_set_mute);
REGISTER_CALLBACK (serv, "/monitor/dim", "i", monitor_set_dim);
REGISTER_CALLBACK (serv, "/monitor/mono", "i", monitor_set_mono);
REGISTER_CALLBACK (serv, "/select/polarity", "i", sel_phase);
REGISTER_CALLBACK (serv, "/select/gain", "f", sel_gain);
REGISTER_CALLBACK (serv, "/select/fader", "f", sel_fader);
+ REGISTER_CALLBACK (serv, "/select/db_delta", "f", sel_dB_delta);
REGISTER_CALLBACK (serv, "/select/trimdB", "f", sel_trim);
REGISTER_CALLBACK (serv, "/select/pan_stereo_position", "f", sel_pan_position);
REGISTER_CALLBACK (serv, "/select/pan_stereo_width", "f", sel_pan_width);
REGISTER_CALLBACK (serv, "/select/send_gain", "if", sel_sendgain);
REGISTER_CALLBACK (serv, "/select/send_fader", "if", sel_sendfader);
REGISTER_CALLBACK (serv, "/select/send_enable", "if", sel_sendenable);
+ REGISTER_CALLBACK (serv, "/select/master_send_enable", "i", sel_master_send_enable);
+ REGISTER_CALLBACK (serv, "/select/send_page", "f", sel_send_page);
+ REGISTER_CALLBACK (serv, "/select/plug_page", "f", sel_plug_page);
+ REGISTER_CALLBACK (serv, "/select/plugin", "f", sel_plugin);
REGISTER_CALLBACK (serv, "/select/expand", "i", sel_expand);
REGISTER_CALLBACK (serv, "/select/pan_elevation_position", "f", sel_pan_elevation);
REGISTER_CALLBACK (serv, "/select/pan_frontback_position", "f", sel_pan_frontback);
REGISTER_CALLBACK (serv, "/select/comp_mode", "f", sel_comp_mode);
REGISTER_CALLBACK (serv, "/select/comp_makeup", "f", sel_comp_makeup);
REGISTER_CALLBACK (serv, "/select/eq_enable", "f", sel_eq_enable);
- REGISTER_CALLBACK (serv, "/select/eq_hpf", "f", sel_eq_hpf);
+ REGISTER_CALLBACK (serv, "/select/eq_hpf/freq", "f", sel_eq_hpf_freq);
+ REGISTER_CALLBACK (serv, "/select/eq_hpf/enable", "f", sel_eq_hpf_enable);
+ REGISTER_CALLBACK (serv, "/select/eq_hpf/slope", "f", sel_eq_hpf_slope);
+ REGISTER_CALLBACK (serv, "/select/eq_lpf/freq", "f", sel_eq_lpf_freq);
+ REGISTER_CALLBACK (serv, "/select/eq_lpf/enable", "f", sel_eq_lpf_enable);
+ REGISTER_CALLBACK (serv, "/select/eq_lpf/slope", "f", sel_eq_lpf_slope);
REGISTER_CALLBACK (serv, "/select/eq_gain", "if", sel_eq_gain);
REGISTER_CALLBACK (serv, "/select/eq_freq", "if", sel_eq_freq);
REGISTER_CALLBACK (serv, "/select/eq_q", "if", sel_eq_q);
REGISTER_CALLBACK (serv, "/select/eq_shape", "if", sel_eq_shape);
- /* These commands require the route index in addition to the arg; TouchOSC (et al) can't use these */
+ /* These commands require the route index in addition to the arg; TouchOSC (et al) can't use these */
REGISTER_CALLBACK (serv, "/strip/mute", "ii", route_mute);
REGISTER_CALLBACK (serv, "/strip/solo", "ii", route_solo);
REGISTER_CALLBACK (serv, "/strip/solo_iso", "ii", route_solo_iso);
REGISTER_CALLBACK (serv, "/strip/send/enable", "iif", route_set_send_enable);
REGISTER_CALLBACK(serv, "/strip/name", "is", route_rename);
REGISTER_CALLBACK(serv, "/strip/sends", "i", route_get_sends);
- REGISTER_CALLBACK(serv, "/strip/receives", "i", route_get_receives);
+ REGISTER_CALLBACK(serv, "/strip/receives", "i", route_get_receives);
REGISTER_CALLBACK(serv, "/strip/plugin/list", "i", route_plugin_list);
REGISTER_CALLBACK(serv, "/strip/plugin/descriptor", "ii", route_plugin_descriptor);
REGISTER_CALLBACK(serv, "/strip/plugin/reset", "ii", route_plugin_reset);
OSCSurface *s = get_surface(addr);
uint32_t ssid = get_sid (strip, addr);
- OSCRouteObserver* o = new OSCRouteObserver (strip, addr, ssid, s);
+ OSCRouteObserver* o = new OSCRouteObserver (strip, ssid, s);
route_observers.push_back (o);
strip->DropReferences.connect (*this, MISSING_INVALIDATOR, boost::bind (&OSC::route_lost, this, boost::weak_ptr<Stripable> (strip)), this);
}
}
}
+ OSCSurface *sur = get_surface(get_address (msg));
- lo_send_message (get_address (msg), "#reply", reply);
+ if (sur->feedback[14]) {
+ lo_send_message (get_address (msg), "/reply", reply);
+ } else {
+ lo_send_message (get_address (msg), "#reply", reply);
+ }
lo_message_free (reply);
}
/* 15 for /#current_value plus 2 for /<path> */
len = strlen (path);
+ OSCSurface *sur = get_surface(get_address (msg));
if (strstr (path, "/automation")) {
- ret = set_automation (path, len, argv, argc, msg);
+ ret = set_automation (path, types, argv, argc, msg);
+
+ } else
+ if (strstr (path, "/touch")) {
+ ret = touch_detect (path, types, argv, argc, msg);
} else
if (len >= 17 && !strcmp (&path[len-15], "/#current_value")) {
ret = cue_parse (path, types, argv, argc, msg);
+ } else
+ if (!strncmp (path, "/select/plugin/parameter", 24)) {
+
+ ret = select_plugin_parameter (path, types, argv, argc, msg);
+
} else
if (!strncmp (path, "/access_action/", 15)) {
+ check_surface (msg);
if (!(argc && !argv[0]->i)) {
std::string action_path = path;
ret = 0;
} else
if (strcmp (path, "/strip/listen") == 0) {
+ check_surface (msg);
cerr << "set up listener\n";
}
}
- lo_send_message (get_address (msg), "#reply", reply);
+ if (sur->feedback[14]) {
+ lo_send_message (get_address (msg), "/reply", reply);
+ } else {
+ lo_send_message (get_address (msg), "#reply", reply);
+ }
lo_message_free (reply);
ret = 0;
} else
if (strcmp (path, "/strip/ignore") == 0) {
+ check_surface (msg);
for (int n = 0; n < argc; ++n) {
ret = 0;
} else
+ if (strstr (path, "/strip") && (argc != 1)) {
+ // All of the strip commands below require 1 parameter
+ PBD::warning << "OSC: Wrong number of parameters." << endmsg;
+ } else
if (!strncmp (path, "/strip/gain/", 12) && strlen (path) > 12) {
// in dB
int ssid = atoi (&path[12]);
int ssid = atoi (&path[13]);
ret = route_set_gain_fader (ssid, argv[0]->f, msg);
}
+ else if (!strncmp (path, "/strip/db_delta", 15)) {
+ // in db delta
+ int ssid;
+ int ar_off = 0;
+ float delta;
+ if (strlen (path) > 15 && argc == 1) {
+ ssid = atoi (&path[16]);
+ } else if (argc == 2) {
+ if (types[0] == 'f') {
+ ssid = (int) argv[0]->f;
+ } else {
+ ssid = argv[0]->i;
+ }
+ ar_off = 1;
+ } else {
+ return -1;
+ }
+ if (types[ar_off] == 'f') {
+ delta = argv[ar_off]->f;
+ } else {
+ delta = (float) argv[ar_off]->i;
+ }
+ ret = strip_db_delta (ssid, delta, msg);
+ }
else if (!strncmp (path, "/strip/trimdB/", 14) && strlen (path) > 14) {
int ssid = atoi (&path[14]);
ret = route_set_trim_dB (ssid, argv[0]->f, msg);
else if (!strncmp (path, "/strip/select/", 14) && strlen (path) > 14) {
int ssid = atoi (&path[14]);
ret = strip_gui_select (ssid, argv[0]->i, msg);
+ } else
+ if (strstr (path, "/select") && (argc != 1)) {
+ // All of the select commands below require 1 parameter
+ PBD::warning << "OSC: Wrong number of parameters." << endmsg;
}
else if (!strncmp (path, "/select/send_gain/", 18) && strlen (path) > 18) {
int ssid = atoi (&path[18]);
int ssid = atoi (&path[17]);
ret = sel_eq_shape (ssid, argv[0]->f, msg);
}
+ else if (!strncmp (path, "/set_surface", 12)) {
+ ret = surface_parse (path, types, argv, argc, msg);
+ }
+ if (ret) {
+ check_surface (msg);
+ }
if ((ret && _debugmode != Off)) {
debugmsg (_("Unhandled OSC message"), path, types, argv, argc);
lo_message reply = lo_message_new ();
- if (s->presentation_info().flags() & PresentationInfo::AudioTrack) {
+ if (boost::dynamic_pointer_cast<AudioTrack>(s)) {
lo_message_add_string (reply, "AT");
- } else if (s->presentation_info().flags() & PresentationInfo::MidiTrack) {
+ } else if (boost::dynamic_pointer_cast<MidiTrack>(s)) {
lo_message_add_string (reply, "MT");
- } else if (s->presentation_info().flags() & PresentationInfo::AudioBus) {
- // r->feeds (session->master_out()) may make more sense
- if (r->direct_feeds_according_to_reality (session->master_out())) {
- // this is a bus
- lo_message_add_string (reply, "B");
+ } else if (boost::dynamic_pointer_cast<VCA>(s)) {
+ lo_message_add_string (reply, "V");
+ } else if (s->is_master()) {
+ lo_message_add_string (reply, "MA");
+ } else if (s->is_monitor()) {
+ lo_message_add_string (reply, "MO");
+ } else if (boost::dynamic_pointer_cast<Route>(s) && !boost::dynamic_pointer_cast<Track>(s)) {
+ if (!(s->presentation_info().flags() & PresentationInfo::MidiBus)) {
+ // r->feeds (session->master_out()) may make more sense
+ if (r->direct_feeds_according_to_reality (session->master_out())) {
+ // this is a bus
+ lo_message_add_string (reply, "B");
+ } else {
+ // this is an Aux out
+ lo_message_add_string (reply, "AX");
+ }
} else {
- // this is an Aux out
- lo_message_add_string (reply, "AX");
+ lo_message_add_string (reply, "MB");
}
- } else if (s->presentation_info().flags() & PresentationInfo::MidiBus) {
- lo_message_add_string (reply, "MB");
- } else if (s->presentation_info().flags() & PresentationInfo::VCA) {
- lo_message_add_string (reply, "V");
}
lo_message_add_string (reply, s->name().c_str());
//Automatically listen to stripables listed
listen_to_route(s, get_address (msg));
- lo_send_message (get_address (msg), "#reply", reply);
+ if (sur->feedback[14]) {
+ lo_send_message (get_address (msg), "/reply", reply);
+ } else {
+ lo_send_message (get_address (msg), "#reply", reply);
+ }
lo_message_free (reply);
}
}
lo_message_add_int32 (reply, 0);
}
- lo_send_message (get_address (msg), "#reply", reply);
+ if (sur->feedback[14]) {
+ lo_send_message (get_address (msg), "/reply", reply);
+ } else {
+ lo_send_message (get_address (msg), "#reply", reply);
+ }
lo_message_free (reply);
}
int
OSC::refresh_surface (lo_message msg)
{
- if (address_only) {
- // get rid of all surfaces and observers.
- // needs change to only clear those for this address on all ports
- clear_devices();
- }
OSCSurface *s = get_surface(get_address (msg));
// restart all observers
- set_surface (s->bank_size, (uint32_t) s->strip_types.to_ulong(), (uint32_t) s->feedback.to_ulong(), (uint32_t) s->gainmode, msg);
+ set_surface (s->bank_size, (uint32_t) s->strip_types.to_ulong(), (uint32_t) s->feedback.to_ulong(), \
+ (uint32_t) s->gainmode, (uint32_t) s->send_page_size, (uint32_t) s->plug_page_size, msg);
return 0;
}
void
OSC::clear_devices ()
{
+ tick = false;
+ Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (RouteObservers::iterator x = route_observers.begin(); x != route_observers.end();) {
OSCRouteObserver* rc;
// clear out surfaces
_surface.clear();
+ tick = true;
+}
+
+int
+OSC::surface_parse (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg)
+{
+ int ret = 1; /* unhandled */
+ OSCSurface *sur = get_surface(get_address (msg));
+ int pi_page = sur->plug_page_size;
+ int se_page = sur->send_page_size;
+ int fadermode = sur->gainmode;
+ int feedback = sur->feedback.to_ulong();
+ int strip_types = sur->strip_types.to_ulong();
+ int bank_size = sur->bank_size;
+
+
+ if (!strncmp (path, "/set_surface/feedback", 21)) {
+ if (types[0] == 'f') {
+ ret = set_surface_feedback ((int)argv[0]->f, msg);
+ } else {
+ ret = set_surface_feedback (argv[0]->i, msg);
+ }
+ }
+ else if (!strncmp (path, "/set_surface/bank_size", 22)) {
+ if (types[0] == 'f') {
+ ret = set_surface_bank_size ((int)argv[0]->f, msg);
+ } else {
+ ret = set_surface_bank_size (argv[0]->i, msg);
+ }
+ }
+ else if (!strncmp (path, "/set_surface/gainmode", 21)) {
+ if (types[0] == 'f') {
+ ret = set_surface_gainmode ((int)argv[0]->f, msg);
+ } else {
+ ret = set_surface_gainmode (argv[0]->i, msg);
+ }
+ }
+ else if (!strncmp (path, "/set_surface/strip_types", 24)) {
+ if (types[0] == 'f') {
+ ret = set_surface_strip_types ((int)argv[0]->f, msg);
+ } else {
+ ret = set_surface_strip_types (argv[0]->i, msg);
+ }
+ }
+ else if (!strncmp (path, "/set_surface/send_page_size", 27)) {
+ if (types[0] == 'f') {
+ ret = sel_send_pagesize ((int)argv[0]->f, msg);
+ } else {
+ ret = sel_send_pagesize (argv[0]->i, msg);
+ }
+ }
+ else if (!strncmp (path, "/set_surface/plugin_page_size", 29)) {
+ if (types[0] == 'f') {
+ ret = sel_plug_pagesize ((int)argv[0]->f, msg);
+ } else {
+ ret = sel_plug_pagesize (argv[0]->i, msg);
+ }
+ } else if (strlen(path) == 12) {
+
+ // command is in /set_surface iii form
+ switch (argc) {
+ case 6:
+ if (types[5] == 'f') {
+ pi_page = (int) argv[5]->f;
+ } else {
+ pi_page = argv[5]->i;
+ }
+ case 5:
+ if (types[4] == 'f') {
+ se_page = (int) argv[4]->f;
+ } else {
+ se_page = argv[4]->i;
+ }
+ case 4:
+ if (types[3] == 'f') {
+ fadermode = (int) argv[3]->f;
+ } else {
+ fadermode = argv[3]->i;
+ }
+ case 3:
+ if (types[2] == 'f') {
+ feedback = (int) argv[2]->f;
+ } else {
+ feedback = argv[2]->i;
+ }
+ case 2:
+ if (types[1] == 'f') {
+ strip_types = (int) argv[1]->f;
+ } else {
+ strip_types = argv[1]->i;
+ }
+ case 1:
+ if (types[0] == 'f') {
+ bank_size = (int) argv[0]->f;
+ } else {
+ bank_size = argv[0]->i;
+ }
+ ret = set_surface (bank_size, strip_types, feedback, fadermode, se_page, pi_page, msg);
+ break;
+ case 0:
+ // send current setup
+ {
+ lo_message reply = lo_message_new ();
+ lo_message_add_int32 (reply, bank_size);
+ lo_message_add_int32 (reply, strip_types);
+ lo_message_add_int32 (reply, feedback);
+ lo_message_add_int32 (reply, fadermode);
+ lo_message_add_int32 (reply, se_page);
+ lo_message_add_int32 (reply, pi_page);
+ lo_send_message (get_address (msg), "/set_surface", reply);
+ lo_message_free (reply);
+ return 0;
+ }
+ break;
+
+ default:
+ PBD::warning << "OSC: Too many parameters." << endmsg;
+ return 1;
+ break;
+ }
+ } else if (isdigit(path[13])) {
+ // some of our parameters must be "in-lined"
+ bank_size = atoi (&path[13]);
+ const char * par = strstr (&path[13], "/");
+ if (par) {
+ strip_types = atoi (&par[1]);
+ const char * fb = strstr (&par[1], "/");
+ if (fb) {
+ feedback = atoi (&fb[1]);
+ const char * fm = strstr (&fb[1], "/");
+ if (fm) {
+ fadermode = atoi (&fm[1]);
+ const char * sp = strstr (&fm[1], "/");
+ if (sp) {
+ se_page = atoi (&sp[1]);
+ const char * pp = strstr (&sp[1], "/");
+ if (pp) {
+ pi_page = atoi (&pp[1]);
+ } else {
+ if (types[0] == 'f') {
+ pi_page = (int) argv[0]->f;
+ } else if (types[0] == 'i') {
+ pi_page = argv[0]->i;
+ }
+ }
+ } else {
+ if (types[0] == 'f') {
+ se_page = (int) argv[0]->f;
+ } else if (types[0] == 'i') {
+ se_page = argv[0]->i;
+ }
+ }
+ } else {
+ if (types[0] == 'f') {
+ fadermode = (int) argv[0]->f;
+ } else if (types[0] == 'i') {
+ fadermode = argv[0]->i;
+ }
+ }
+ } else {
+ if (types[0] == 'f') {
+ feedback = (int) argv[0]->f;
+ } else if (types[0] == 'i') {
+ feedback = argv[0]->i;
+ }
+ }
+ } else {
+ if (types[0] == 'f') {
+ strip_types = (int) argv[0]->f;
+ } else if (types[0] == 'i') {
+ strip_types = argv[0]->i;
+ }
+ }
+ ret = set_surface (bank_size, strip_types, feedback, fadermode, se_page, pi_page, msg);
+ }
+ return ret;
}
int
-OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, lo_message msg)
+OSC::set_surface (uint32_t b_size, uint32_t strips, uint32_t fb, uint32_t gm, uint32_t se_size, uint32_t pi_size, lo_message msg)
{
OSCSurface *s = get_surface(get_address (msg));
s->bank_size = b_size;
s->strip_types = strips;
s->feedback = fb;
s->gainmode = gm;
+ if (s->strip_types[10]) {
+ s->usegroup = PBD::Controllable::UseGroup;
+ } else {
+ s->usegroup = PBD::Controllable::NoGroup;
+ }
+ s->send_page_size = se_size;
+ s->plug_page_size = pi_size;
// set bank and strip feedback
set_bank(s->bank, msg);
- global_feedback (s->feedback, get_address (msg), s->gainmode);
+ global_feedback (*s, get_address (msg));
+ sel_send_pagesize (se_size, msg);
+ sel_plug_pagesize (pi_size, msg);
return 0;
}
{
OSCSurface *s = get_surface(get_address (msg));
s->strip_types = st;
+ if (s->strip_types[10]) {
+ s->usegroup = PBD::Controllable::UseGroup;
+ } else {
+ s->usegroup = PBD::Controllable::NoGroup;
+ }
// set bank and strip feedback
set_bank(s->bank, msg);
set_bank(s->bank, msg);
// Set global/master feedback
- global_feedback (s->feedback, get_address (msg), s->gainmode);
+ global_feedback (*s, get_address (msg));
return 0;
}
-
int
OSC::set_surface_gainmode (uint32_t gm, lo_message msg)
{
set_bank(s->bank, msg);
// Set global/master feedback
- global_feedback (s->feedback, get_address (msg), s->gainmode);
+ global_feedback (*s, get_address (msg));
+ return 0;
+}
+
+int
+OSC::check_surface (lo_message msg)
+{
+ if (!session) {
+ return -1;
+ }
+ get_surface(get_address (msg));
return 0;
}
{
string r_url;
char * rurl;
+ if (address_only) {
+ string host = lo_address_get_hostname (addr);
+ int protocol = lo_address_get_protocol (addr);
+ addr = lo_address_new_with_proto (protocol, host.c_str(), remote_port.c_str());
+ }
+
rurl = lo_address_get_url (addr);
r_url = rurl;
free (rurl);
- for (uint32_t it = 0; it < _surface.size(); ++it) {
- //find setup for this server
- if (!_surface[it].remote_url.find(r_url)){
- return &_surface[it];
+ {
+ Glib::Threads::Mutex::Lock lm (surfaces_lock);
+ for (uint32_t it = 0; it < _surface.size(); ++it) {
+ //find setup for this server
+ if (!_surface[it].remote_url.find(r_url)){
+ return &_surface[it];
+ }
}
}
- // if we do this when OSC is started we get the wrong stripable
- // we don't need this until we actually have a surface to deal with
- if (!_select || (_select != ControlProtocol::first_selected_stripable())) {
- gui_selection_changed();
- }
// No surface create one with default values
OSCSurface s;
s.remote_url = r_url;
+ s.no_clear = false;
+ s.jogmode = JOG;
s.bank = 1;
- s.bank_size = default_banksize; // need to find out how many strips there are
- s.strip_types = default_strip; // 159 is tracks, busses, and VCAs (no master/monitor)
+ s.bank_size = default_banksize;
+ s.strip_types = default_strip;
s.feedback = default_feedback;
s.gainmode = default_gainmode;
+ s.usegroup = PBD::Controllable::NoGroup;
s.sel_obs = 0;
s.expand = 0;
s.expand_enable = false;
s.cue = false;
+ s.aux = 0;
s.strips = get_sorted_stripables(s.strip_types, s.cue);
+ s.send_page = 1;
+ s.send_page_size = default_send_size;
+ s.plug_page = 1;
+ s.plug_page_size = default_plugin_size;
+ s.plugin_id = 1;
s.nstrips = s.strips.size();
- _surface.push_back (s);
+ {
+ Glib::Threads::Mutex::Lock lm (surfaces_lock);
+ _surface.push_back (s);
+ }
+ // moved this down here as selection may need s.<anything to do with select> set
+ if (!_select || (_select != ControlProtocol::first_selected_stripable())) {
+ gui_selection_changed();
+ }
+
+ // set bank and strip feedback
+ _set_bank(s.bank, addr);
+
+ // Set global/master feedback
+ global_feedback (s, addr);
return &_surface[_surface.size() - 1];
}
// setup global feedback for a surface
void
-OSC::global_feedback (bitset<32> feedback, lo_address addr, uint32_t gainmode)
+OSC::global_feedback (OSCSurface sur, lo_address addr)
{
// first destroy global observer for this surface
GlobalObservers::iterator x;
for (x = global_observers.begin(); x != global_observers.end();) {
- OSCGlobalObserver* ro;
+ OSCGlobalObserver* go;
- if ((ro = dynamic_cast<OSCGlobalObserver*>(*x)) != 0) {
+ if ((go = dynamic_cast<OSCGlobalObserver*>(*x)) != 0) {
- int res = strcmp(lo_address_get_url(ro->address()), lo_address_get_url(addr));
+ int res = strcmp(lo_address_get_url(go->address()), lo_address_get_url(addr));
if (res == 0) {
delete *x;
++x;
}
}
+ std::bitset<32> feedback = sur.feedback;
if (feedback[4] || feedback[3] || feedback[5] || feedback[6]) {
// create a new Global Observer for this surface
- OSCGlobalObserver* o = new OSCGlobalObserver (*session, addr, gainmode, /*s->*/feedback);
+ OSCGlobalObserver* o = new OSCGlobalObserver (*session, &sur);
global_observers.push_back (o);
}
}
}
}
// slow devices need time to clear buffers
- usleep ((uint32_t) 10);
+ usleep ((uint32_t) 20);
}
}
// light bankup or bankdown buttons if it is possible to bank in that direction
return 0;
}
+int
+OSC::bank_delta (float delta, lo_message msg)
+{
+ if (!session) {
+ return -1;
+ }
+ OSCSurface *s = get_surface(get_address (msg));
+ uint32_t new_bank = s->bank + (s->bank_size * (int) delta);
+ if ((int)new_bank < 1) {
+ new_bank = 1;
+ }
+ if (new_bank != s->bank) {
+ set_bank (new_bank, msg);
+ }
+ return 0;
+}
+
int
OSC::bank_down (lo_message msg)
{
return 0;
}
+int
+OSC::use_group (float value, lo_message msg)
+{
+ if (!session) {
+ return -1;
+ }
+ OSCSurface *s = get_surface(get_address (msg));
+ if (value) {
+ s->usegroup = PBD::Controllable::UseGroup;
+ } else {
+ s->usegroup = PBD::Controllable::NoGroup;
+ }
+ return 0;
+}
+
uint32_t
OSC::get_sid (boost::shared_ptr<ARDOUR::Stripable> strip, lo_address addr)
{
return boost::shared_ptr<ARDOUR::Stripable>();
}
+// send and plugin paging commands
+int
+OSC::sel_send_pagesize (uint32_t size, lo_message msg)
+{
+ OSCSurface *s = get_surface(get_address (msg));
+ if (size != s->send_page_size) {
+ s->send_page_size = size;
+ s->sel_obs->renew_sends();
+ }
+ return 0;
+}
+
+int
+OSC::sel_send_page (int page, lo_message msg)
+{
+ OSCSurface *s = get_surface(get_address (msg));
+ s->send_page = s->send_page + page;
+ s->sel_obs->renew_sends();
+ return 0;
+}
+
+int
+OSC::sel_plug_pagesize (uint32_t size, lo_message msg)
+{
+ OSCSurface *s = get_surface(get_address (msg));
+ if (size != s->plug_page_size) {
+ s->plug_page_size = size;
+ s->sel_obs->renew_plugin();
+ }
+ return 0;
+}
+
+int
+OSC::sel_plug_page (int page, lo_message msg)
+{
+ OSCSurface *s = get_surface(get_address (msg));
+ s->plug_page = s->plug_page + page;
+ s->sel_obs->renew_plugin();
+ return 0;
+}
+
+int
+OSC::sel_plugin (int delta, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ return _sel_plugin (sur->plugin_id + delta, get_address (msg));
+}
+
+int
+OSC::_sel_plugin (int id, lo_address addr)
+{
+ OSCSurface *sur = get_surface(addr);
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, addr);
+ } else {
+ s = _select;
+ }
+ if (s) {
+ boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(s);
+ if (!r) {
+ return 1;
+ }
+
+ // find out how many plugins we have
+ bool plugs;
+ int nplugs = 0;
+ sur->plugins.clear();
+ do {
+ plugs = false;
+ if (r->nth_plugin (nplugs)) {
+ if (r->nth_plugin(nplugs)->display_to_user()) {
+#ifdef MIXBUS
+ // need to check for mixbus channel strips (and exclude them)
+ boost::shared_ptr<Processor> proc = r->nth_plugin (nplugs);
+ boost::shared_ptr<PluginInsert> pi;
+ if ((pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
+
+ if (!pi->is_channelstrip()) {
+#endif
+ sur->plugins.push_back (nplugs);
+#ifdef MIXBUS
+ }
+ }
+#endif
+ }
+ plugs = true;
+ nplugs++;
+ }
+ } while (plugs);
+
+ // limit plugin_id to actual plugins
+ if (!sur->plugins.size()) {
+ sur->plugin_id = 0;
+ return 0;
+ } else if (sur->plugins.size() < (uint32_t) id) {
+ sur->plugin_id = sur->plugins.size();
+ } else if (sur->plugins.size() && !id) {
+ sur->plugin_id = 1;
+ } else {
+ sur->plugin_id = id;
+ }
+
+ // 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<PluginInsert> pi;
+ if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
+ PBD::warning << "OSC: Plugin: " << sur->plugin_id << " does not seem to be a plugin" << endmsg;
+ return 1;
+ }
+ boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
+ bool ok = false;
+ // put only input controls into a vector
+ sur->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)) {
+ sur->plug_params.push_back (ppi);
+ }
+ }
+
+ sur->plug_page = 1;
+
+ if (sur->sel_obs) {
+ sur->sel_obs->renew_plugin();
+ }
+ return 0;
+ }
+ return 1;
+}
+
void
OSC::transport_frame (lo_message msg)
{
if (!session) {
return;
}
+ check_surface (msg);
framepos_t pos = session->transport_frame ();
lo_message reply = lo_message_new ();
if (!session) {
return;
}
+ check_surface (msg);
double ts = session->transport_speed ();
lo_message reply = lo_message_new ();
if (!session) {
return;
}
+ check_surface (msg);
int re = (int)session->get_record_enabled ();
lo_message reply = lo_message_new ();
OSC::scrub (float delta, lo_message msg)
{
if (!session) return -1;
+ check_surface (msg);
scrub_place = session->transport_frame ();
if (dB < -192) {
s->gain_control()->set_value (0.0, PBD::Controllable::NoGroup);
} else {
- s->gain_control()->set_value (dB_to_coefficient (dB), PBD::Controllable::NoGroup);
+ float abs = dB_to_coefficient (dB);
+ float top = s->gain_control()->upper();
+ if (abs > top) {
+ abs = top;
+ }
+ s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
+ }
+ }
+ return 0;
+}
+
+int
+OSC::master_delta_gain (float delta)
+{
+ if (!session) return -1;
+ boost::shared_ptr<Stripable> s = session->master_out();
+ if (s) {
+ float dB = accurate_coefficient_to_dB (s->gain_control()->get_value()) + delta;
+ if (dB < -192) {
+ s->gain_control()->set_value (0.0, PBD::Controllable::NoGroup);
+ } else {
+ float abs = dB_to_coefficient (dB);
+ float top = s->gain_control()->upper();
+ if (abs > top) {
+ abs = top;
+ }
+ s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
}
}
return 0;
if (!session) return -1;
boost::shared_ptr<Stripable> s = session->master_out();
if (s) {
- s->gain_control()->set_value (slider_position_to_gain_with_max (position, 2.0), PBD::Controllable::NoGroup);
+ s->gain_control()->set_value (s->gain_control()->interface_to_internal (position), PBD::Controllable::NoGroup);
}
return 0;
}
OSC::master_set_pan_stereo_position (float position, lo_message msg)
{
if (!session) return -1;
+ OSCSurface *sur = get_surface(get_address (msg));
float endposition = .5;
boost::shared_ptr<Stripable> s = session->master_out();
endposition = s->pan_azimuth_control()->internal_to_interface (s->pan_azimuth_control()->get_value ());
}
}
- OSCSurface *sur = get_surface(get_address (msg));
if (sur->feedback[4]) {
lo_message reply = lo_message_new ();
}
int
-OSC::monitor_set_gain (float dB)
+OSC::master_select (lo_message msg)
{
- if (!session) return -1;
- boost::shared_ptr<Stripable> s = session->monitor_out();
-
- if (s) {
- if (dB < -192) {
- s->gain_control()->set_value (0.0, PBD::Controllable::NoGroup);
- } else {
- s->gain_control()->set_value (dB_to_coefficient (dB), PBD::Controllable::NoGroup);
+ if (!session) {
+ return -1;
+ }
+ OSCSurface *sur = get_surface(get_address (msg));
+ sur->expand_enable = false;
+ boost::shared_ptr<Stripable> s = session->master_out();
+ if (s) {
+ SetStripableSelection (s);
+ }
+
+ return 0;
+}
+
+int
+OSC::monitor_set_gain (float dB)
+{
+ if (!session) return -1;
+ boost::shared_ptr<Stripable> s = session->monitor_out();
+
+ if (s) {
+ if (dB < -192) {
+ s->gain_control()->set_value (0.0, PBD::Controllable::NoGroup);
+ } else {
+ float abs = dB_to_coefficient (dB);
+ float top = s->gain_control()->upper();
+ if (abs > top) {
+ abs = top;
+ }
+ s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
+ }
+ }
+ return 0;
+}
+
+int
+OSC::monitor_delta_gain (float delta)
+{
+ if (!session) return -1;
+ boost::shared_ptr<Stripable> s = session->monitor_out();
+ if (s) {
+ float dB = accurate_coefficient_to_dB (s->gain_control()->get_value()) + delta;
+ if (dB < -192) {
+ s->gain_control()->set_value (0.0, PBD::Controllable::NoGroup);
+ } else {
+ float abs = dB_to_coefficient (dB);
+ float top = s->gain_control()->upper();
+ if (abs > top) {
+ abs = top;
+ }
+ s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
}
}
return 0;
if (!session) return -1;
boost::shared_ptr<Stripable> s = session->monitor_out();
if (s) {
- s->gain_control()->set_value (slider_position_to_gain_with_max (position, 2.0), PBD::Controllable::NoGroup);
+ s->gain_control()->set_value (s->gain_control()->interface_to_internal (position), PBD::Controllable::NoGroup);
}
return 0;
}
lo_message_add_string(reply, isend->name().c_str());
lo_message_add_int32(reply, i);
boost::shared_ptr<Amp> a = isend->amp();
- lo_message_add_float(reply, gain_to_slider_position(a->gain_control()->get_value()));
+ lo_message_add_float(reply, a->gain_control()->internal_to_interface (a->gain_control()->get_value()));
lo_message_add_int32(reply, p->active() ? 1 : 0);
}
}
lo_message_add_int32(reply, get_sid(tr, get_address(msg)));
lo_message_add_string(reply, tr->name().c_str());
lo_message_add_int32(reply, j);
- lo_message_add_float(reply, gain_to_slider_position(a->gain_control()->get_value()));
+ lo_message_add_float(reply, a->gain_control()->internal_to_interface (a->gain_control()->get_value()));
lo_message_add_int32(reply, p->active() ? 1 : 0);
}
}
// strip calls
int
-OSC::set_automation (const char *path, size_t len, lo_arg **argv, int argc, lo_message msg)
+OSC::set_automation (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg)
{
if (!session) return -1;
boost::shared_ptr<Stripable> strp = boost::shared_ptr<Stripable>();
uint32_t ctr = 0;
uint32_t aut = 0;
+ uint32_t ssid;
+
+ if (argc) {
+ if (types[argc - 1] == 'f') {
+ aut = (int)argv[argc - 1]->f;
+ } else {
+ aut = argv[argc - 1]->i;
+ }
+ }
//parse path first to find stripable
if (!strncmp (path, "/strip/", 7)) {
// find ssid and stripable
if (argc > 1) {
- strp = get_strip (argv[0]->i, get_address (msg));
- if (argv[1]->f) {
- aut = (int)argv[1]->f;
+ if (types[1] == 'f') {
+ ssid = (uint32_t)argv[0]->f;
} else {
- aut = argv[1]->i;
+ ssid = argv[0]->i;
}
+ strp = get_strip (ssid, get_address (msg));
} else {
- uint32_t ssid = atoi (&(strrchr (path, '/' ))[1]);
+ ssid = atoi (&(strrchr (path, '/' ))[1]);
strp = get_strip (ssid, get_address (msg));
- if (argv[0]->f) {
- aut = (int)argv[0]->f;
- } else {
- aut = argv[0]->i;
- }
}
ctr = 7;
} else if (!strncmp (path, "/select/", 8)) {
} else {
strp = ControlProtocol::first_selected_stripable();
}
- if (argv[0]->f) {
- aut = (int)argv[0]->f;
+ ctr = 8;
+ } else {
+ return ret;
+ }
+ if (strp) {
+ boost::shared_ptr<AutomationControl> control = boost::shared_ptr<AutomationControl>();
+ // other automatable controls can be added by repeating the next 6.5 lines
+ if ((!strncmp (&path[ctr], "fader", 5)) || (!strncmp (&path[ctr], "gain", 4))) {
+ if (strp->gain_control ()) {
+ control = strp->gain_control ();
+ } else {
+ PBD::warning << "No fader for this strip" << endmsg;
+ }
+ } else {
+ PBD::warning << "Automation not available for " << path << endmsg;
+ }
+
+ if (control) {
+
+ switch (aut) {
+ case 0:
+ control->set_automation_state (ARDOUR::Off);
+ ret = 0;
+ break;
+ case 1:
+ control->set_automation_state (ARDOUR::Play);
+ ret = 0;
+ break;
+ case 2:
+ control->set_automation_state (ARDOUR::Write);
+ ret = 0;
+ break;
+ case 3:
+ control->set_automation_state (ARDOUR::Touch);
+ ret = 0;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+int
+OSC::touch_detect (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg)
+{
+ if (!session) return -1;
+
+ int ret = 1;
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> strp = boost::shared_ptr<Stripable>();
+ uint32_t ctr = 0;
+ uint32_t touch = 0;
+ uint32_t ssid;
+
+ if (argc) {
+ if (types[argc - 1] == 'f') {
+ touch = (int)argv[argc - 1]->f;
} else {
- aut = argv[0]->i;
+ touch = argv[argc - 1]->i;
+ }
+ }
+
+ //parse path first to find stripable
+ if (!strncmp (path, "/strip/", 7)) {
+ // find ssid and stripable
+ if (argc > 1) {
+ if (types[0] == 'f') {
+ ssid = (uint32_t)argv[0]->f;
+ } else {
+ ssid = argv[0]->i;
+ }
+ strp = get_strip (ssid, get_address (msg));
+ } else {
+ ssid = atoi (&(strrchr (path, '/' ))[1]);
+ strp = get_strip (ssid, get_address (msg));
+ }
+ ctr = 7;
+ } else if (!strncmp (path, "/select/", 8)) {
+ if (sur->expand_enable && sur->expand) {
+ strp = get_strip (sur->expand, get_address (msg));
+ } else {
+ strp = ControlProtocol::first_selected_stripable();
}
ctr = 8;
} else {
return ret;
}
if (strp) {
+ boost::shared_ptr<AutomationControl> control = boost::shared_ptr<AutomationControl>();
+ // other automatable controls can be added by repeating the next 6.5 lines
if ((!strncmp (&path[ctr], "fader", 5)) || (!strncmp (&path[ctr], "gain", 4))) {
if (strp->gain_control ()) {
- switch (aut) {
- case 0:
- strp->gain_control()->set_automation_state (ARDOUR::AutoState::Off);
- ret = 0;
- break;
- case 'm':
- strp->gain_control()->set_automation_state (ARDOUR::AutoState::Off);
- ret = 0;
- break;
- case 1:
- strp->gain_control()->set_automation_state (ARDOUR::AutoState::Play);
- ret = 0;
- break;
- case 'p':
- strp->gain_control()->set_automation_state (ARDOUR::AutoState::Play);
- ret = 0;
- break;
- case 2:
- strp->gain_control()->set_automation_state (ARDOUR::AutoState::Write);
- ret = 0;
- break;
- case 'w':
- strp->gain_control()->set_automation_state (ARDOUR::AutoState::Write);
- ret = 0;
- break;
- case 3:
- strp->gain_control()->set_automation_state (ARDOUR::AutoState::Touch);
- ret = 0;
- break;
- case 't':
- strp->gain_control()->set_automation_state (ARDOUR::AutoState::Touch);
- ret = 0;
- break;
- default:
- break;
- }
+ control = strp->gain_control ();
+ } else {
+ PBD::warning << "No fader for this strip" << endmsg;
+ }
+ } else {
+ PBD::warning << "Automation not available for " << path << endmsg;
+ }
+
+ if (control) {
+ if (touch) {
+ //start touch
+ control->start_touch (control->session().transport_frame());
+ ret = 0;
+ } else {
+ // end touch
+ control->stop_touch (control->session().transport_frame());
+ ret = 0;
+ }
+ // just in case some crazy surface starts sending control values before touch
+ FakeTouchMap::iterator x = _touch_timeout.find(control);
+ if (x != _touch_timeout.end()) {
+ _touch_timeout.erase (x);
}
}
}
return ret;
}
+int
+OSC::fake_touch (boost::shared_ptr<ARDOUR::AutomationControl> ctrl)
+{
+ if (ctrl) {
+ //start touch
+ if (ctrl->automation_state() == Touch && !ctrl->touching ()) {
+ ctrl->start_touch (ctrl->session().transport_frame());
+ _touch_timeout[ctrl] = 10;
+ }
+ }
+
+ return 0;
+}
+
int
OSC::route_mute (int ssid, int yn, lo_message msg)
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->mute_control()) {
- s->mute_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
+ s->mute_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
return 0;
}
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->solo_control()) {
- s->solo_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
+ s->solo_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
}
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->solo_isolate_control()) {
- s->solo_isolate_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
+ s->solo_isolate_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
return 0;
}
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, lo_message_get_source (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->solo_safe_control()) {
- s->solo_safe_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
+ s->solo_safe_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
return 0;
}
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->rec_enable_control()) {
- s->rec_enable_control()->set_value (yn, PBD::Controllable::UseGroup);
+ s->rec_enable_control()->set_value (yn, sur->usegroup);
if (s->rec_enable_control()->get_value()) {
return 0;
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->rec_safe_control()) {
- s->rec_safe_control()->set_value (yn, PBD::Controllable::UseGroup);
+ s->rec_safe_control()->set_value (yn, sur->usegroup);
if (s->rec_safe_control()->get_value()) {
return 0;
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (s);
if (track) {
if (track->monitoring_control()) {
- track->monitoring_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
+ track->monitoring_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
return 0;
}
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (s);
if (track) {
if (track->monitoring_control()) {
- track->monitoring_control()->set_value (yn ? 2.0 : 0.0, PBD::Controllable::NoGroup);
+ track->monitoring_control()->set_value (yn ? 2.0 : 0.0, sur->usegroup);
return 0;
}
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->phase_control()) {
- s->phase_control()->set_value (yn ? 1.0 : 0.0, PBD::Controllable::NoGroup);
+ s->phase_control()->set_value (yn ? 1.0 : 0.0, sur->usegroup);
return 0;
}
}
delete sur->sel_obs;
sur->sel_obs = 0;
}
- bool feedback_on = sur->feedback.to_ulong();
+ bool feedback_on = sur->feedback[13];
if (s && feedback_on) {
- OSCSelectObserver* sel_fb = new OSCSelectObserver (s, addr, sur->gainmode, sur->feedback);
+ OSCSelectObserver* sel_fb = new OSCSelectObserver (s, addr, sur);
s->DropReferences.connect (*this, MISSING_INVALIDATOR, boost::bind (&OSC::recalcbanks, this), this);
sur->sel_obs = sel_fb;
} else if (sur->expand_enable) {
+ // expand doesn't point to a stripable, turn it off and use select
sur->expand = 0;
sur->expand_enable = false;
if (_select && feedback_on) {
- OSCSelectObserver* sel_fb = new OSCSelectObserver (_select, addr, sur->gainmode, sur->feedback);
- _select->DropReferences.connect (*this, MISSING_INVALIDATOR, boost::bind (&OSC::recalcbanks, this), this);
+ s = _select;
+ OSCSelectObserver* sel_fb = new OSCSelectObserver (s, addr, sur);
+ s->DropReferences.connect (*this, MISSING_INVALIDATOR, boost::bind (&OSC::recalcbanks, this), this);
sur->sel_obs = sel_fb;
}
} else if (feedback_on) {
route_send_fail ("select", sur->expand, 0 , addr);
}
+ // need to set monitor for processor changed signal
+ // detecting processor changes requires cast to route
+ boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(s);
+ if (r) {
+ r->processors_changed.connect (sur->proc_connection, MISSING_INVALIDATOR, boost::bind (&OSC::processor_changed, this, addr), this);
+ processor_changed (addr);
+ }
+
if (!feedback_on) {
return 0;
}
return 0;
}
+void
+OSC::processor_changed (lo_address addr)
+{
+ OSCSurface *sur = get_surface (addr);
+ sur->proc_connection.disconnect ();
+ _sel_plugin (sur->plugin_id, addr);
+ if (sur->sel_obs) {
+ sur->sel_obs->renew_sends ();
+ sur->sel_obs->eq_restart (-1);
+ }
+}
+
int
OSC::strip_gui_select (int ssid, int yn, lo_message msg)
{
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->gain_control()) {
- s->gain_control()->set_value (level, PBD::Controllable::NoGroup);
+ fake_touch (s->gain_control());
+ s->gain_control()->set_value (level, sur->usegroup);
} else {
return 1;
}
}
if (s) {
float abs;
- if (val < -192) {
- abs = 0;
- } else {
- abs = dB_to_coefficient (val);
+ if (s->gain_control()) {
+ if (val < -192) {
+ abs = 0;
+ } else {
+ abs = dB_to_coefficient (val);
+ float top = s->gain_control()->upper();
+ if (abs > top) {
+ abs = top;
+ }
+ }
+ fake_touch (s->gain_control());
+ s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
+ return 0;
}
+ }
+ return sel_fail ("gain", -193, get_address (msg));
+}
+
+int
+OSC::sel_dB_delta (float delta, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
if (s->gain_control()) {
+ float dB = accurate_coefficient_to_dB (s->gain_control()->get_value()) + delta;
+ float abs;
+ if (dB < -192) {
+ abs = 0;
+ } else {
+ abs = dB_to_coefficient (dB);
+ float top = s->gain_control()->upper();
+ if (abs > top) {
+ abs = top;
+ }
+ }
+ fake_touch (s->gain_control());
s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
return 0;
}
OSC::route_set_gain_fader (int ssid, float pos, lo_message msg)
{
if (!session) {
- route_send_fail ("fader", ssid, 0, get_address (msg));
return -1;
}
- int ret;
- ret = route_set_gain_abs (ssid, slider_position_to_gain_with_max (pos, 2.0), msg);
- if (ret != 0) {
+ boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
+
+ if (s) {
+ if (s->gain_control()) {
+ fake_touch (s->gain_control());
+ s->gain_control()->set_value (s->gain_control()->interface_to_internal (pos), sur->usegroup);
+ } else {
+ return route_send_fail ("fader", ssid, 0, get_address (msg));
+ }
+ } else {
return route_send_fail ("fader", ssid, 0, get_address (msg));
}
return 0;
}
+int
+OSC::strip_db_delta (int ssid, float delta, lo_message msg)
+{
+ if (!session) return -1;
+ boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
+ if (s) {
+ float db = accurate_coefficient_to_dB (s->gain_control()->get_value()) + delta;
+ float abs;
+ if (db < -192) {
+ abs = 0;
+ } else {
+ abs = dB_to_coefficient (db);
+ float top = s->gain_control()->upper();
+ if (abs > top) {
+ abs = top;
+ }
+ }
+ s->gain_control()->set_value (abs, sur->usegroup);
+ return 0;
+ }
+ return -1;
+}
+
int
OSC::sel_fader (float val, lo_message msg)
{
s = _select;
}
if (s) {
- float abs;
- abs = slider_position_to_gain_with_max (val, 2.0);
if (s->gain_control()) {
- s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
+ fake_touch (s->gain_control());
+ s->gain_control()->set_value (s->gain_control()->interface_to_internal (val), PBD::Controllable::NoGroup);
return 0;
}
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->trim_control()) {
- s->trim_control()->set_value (level, PBD::Controllable::NoGroup);
+ s->trim_control()->set_value (level, sur->usegroup);
return 0;
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if(s->pan_azimuth_control()) {
- s->pan_azimuth_control()->set_value (s->pan_azimuth_control()->interface_to_internal (pos), PBD::Controllable::NoGroup);
+ s->pan_azimuth_control()->set_value (s->pan_azimuth_control()->interface_to_internal (pos), sur->usegroup);
return 0;
}
}
{
if (!session) return -1;
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
if (s->pan_width_control()) {
- s->pan_width_control()->set_value (pos, PBD::Controllable::NoGroup);
+ s->pan_width_control()->set_value (pos, sur->usegroup);
return 0;
}
}
return -1;
}
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
float abs;
if (s) {
if (id > 0) {
}
#endif
if (s->send_level_controllable (id)) {
- s->send_level_controllable (id)->set_value (abs, PBD::Controllable::NoGroup);
+ s->send_level_controllable (id)->set_value (abs, sur->usegroup);
return 0;
}
}
return -1;
}
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
float abs;
if (s) {
}
if (s->send_level_controllable (id)) {
-#ifdef MIXBUS
abs = s->send_level_controllable(id)->interface_to_internal (val);
-#else
- abs = slider_position_to_gain_with_max (val, 2.0);
-#endif
- s->send_level_controllable (id)->set_value (abs, PBD::Controllable::NoGroup);
+ s->send_level_controllable (id)->set_value (abs, sur->usegroup);
return 0;
}
}
OSC::sel_sendgain (int id, float val, lo_message msg)
{
OSCSurface *sur = get_surface(get_address (msg));
+ if (sur->send_page_size && (id > (int)sur->send_page_size)) {
+ return sel_send_fail ("send_gain", id, -193, get_address (msg));
+ }
boost::shared_ptr<Stripable> s;
if (sur->expand_enable) {
s = get_strip (sur->expand, get_address (msg));
s = _select;
}
float abs;
+ int send_id = 0;
if (s) {
if (id > 0) {
- --id;
+ send_id = id - 1;
}
#ifdef MIXBUS
abs = val;
abs = dB_to_coefficient (val);
}
#endif
- if (s->send_level_controllable (id)) {
- s->send_level_controllable (id)->set_value (abs, PBD::Controllable::NoGroup);
+ if (sur->send_page_size) {
+ send_id = send_id + ((sur->send_page - 1) * sur->send_page_size);
+ }
+ if (s->send_level_controllable (send_id)) {
+ s->send_level_controllable (send_id)->set_value (abs, PBD::Controllable::NoGroup);
return 0;
}
}
- return sel_send_fail ("send_gain", id + 1, -193, get_address (msg));
+ return sel_send_fail ("send_gain", id, -193, get_address (msg));
}
int
OSC::sel_sendfader (int id, float val, lo_message msg)
{
OSCSurface *sur = get_surface(get_address (msg));
+ if (sur->send_page_size && (id > (int)sur->send_page_size)) {
+ return sel_send_fail ("send_fader", id, 0, get_address (msg));
+ }
boost::shared_ptr<Stripable> s;
if (sur->expand_enable) {
s = get_strip (sur->expand, get_address (msg));
s = _select;
}
float abs;
+ int send_id = 0;
if (s) {
if (id > 0) {
- --id;
+ send_id = id - 1;
+ }
+ if (sur->send_page_size) {
+ send_id = send_id + ((sur->send_page - 1) * sur->send_page_size);
}
- if (s->send_level_controllable (id)) {
-#ifdef MIXBUS
- abs = s->send_level_controllable(id)->interface_to_internal (val);
-#else
- abs = slider_position_to_gain_with_max (val, 2.0);
-#endif
- s->send_level_controllable (id)->set_value (abs, PBD::Controllable::NoGroup);
+ if (s->send_level_controllable (send_id)) {
+ abs = s->send_level_controllable(send_id)->interface_to_internal (val);
+ s->send_level_controllable (send_id)->set_value (abs, PBD::Controllable::NoGroup);
return 0;
}
}
return -1;
}
boost::shared_ptr<Stripable> s = get_strip (ssid, get_address (msg));
+ OSCSurface *sur = get_surface(get_address (msg));
if (s) {
}
if (s->send_enable_controllable (sid)) {
- s->send_enable_controllable (sid)->set_value (val, PBD::Controllable::NoGroup);
+ s->send_enable_controllable (sid)->set_value (val, sur->usegroup);
return 0;
}
OSC::sel_sendenable (int id, float val, lo_message msg)
{
OSCSurface *sur = get_surface(get_address (msg));
+ if (sur->send_page_size && (id > (int)sur->send_page_size)) {
+ return sel_send_fail ("send_enable", id, 0, get_address (msg));
+ }
boost::shared_ptr<Stripable> s;
if (sur->expand_enable) {
s = get_strip (sur->expand, get_address (msg));
} else {
s = _select;
}
+ int send_id = 0;
if (s) {
if (id > 0) {
- --id;
+ send_id = id - 1;
+ }
+ if (sur->send_page_size) {
+ send_id = send_id + ((sur->send_page - 1) * sur->send_page_size);
}
- if (s->send_enable_controllable (id)) {
- s->send_enable_controllable (id)->set_value (val, PBD::Controllable::NoGroup);
+ if (s->send_enable_controllable (send_id)) {
+ s->send_enable_controllable (send_id)->set_value (val, PBD::Controllable::NoGroup);
return 0;
}
- if (s->send_level_controllable (id)) {
+ if (s->send_level_controllable (send_id)) {
boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (s);
if (!r) {
// should never get here
- return sel_send_fail ("send_enable", id + 1, 0, get_address (msg));
+ return sel_send_fail ("send_enable", id, 0, get_address (msg));
}
- boost::shared_ptr<Send> snd = boost::dynamic_pointer_cast<Send> (r->nth_send(id));
+ boost::shared_ptr<Send> snd = boost::dynamic_pointer_cast<Send> (r->nth_send(send_id));
if (snd) {
if (val) {
snd->activate();
return 0;
}
}
- return sel_send_fail ("send_enable", id + 1, 0, get_address (msg));
+ return sel_send_fail ("send_enable", id, 0, get_address (msg));
+}
+
+int
+OSC::sel_master_send_enable (int state, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->master_send_enable_controllable ()) {
+ s->master_send_enable_controllable()->set_value (state, PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return cue_float_message ("/select/master_send_enable", 0, get_address(msg));
+}
+
+int
+OSC::select_plugin_parameter (const char *path, const char* types, lo_arg **argv, int argc, lo_message msg) {
+ OSCSurface *sur = get_surface(get_address (msg));
+ int paid;
+ int piid = sur->plugin_id;
+ float value = 0;
+ if (argc > 1) {
+ // no inline args
+ if (argc == 2) {
+ // change parameter in already selected plugin
+ if (types[0] == 'f') {
+ paid = (int) argv[0]->f;
+ } else {
+ paid = argv[0]->i;
+ }
+ value = argv[1]->f;
+ } else if (argc == 3) {
+ if (types[0] == 'f') {
+ piid = (int) argv[0]->f;
+ } else {
+ piid = argv[0]->i;
+ }
+ _sel_plugin (piid, get_address (msg));
+ if (types[1] == 'f') {
+ paid = (int) argv[1]->f;
+ } else {
+ paid = argv[1]->i;
+ }
+ value = argv[2]->f;
+ } else if (argc > 3) {
+ PBD::warning << "OSC: Too many parameters: " << argc << endmsg;
+ return -1;
+ }
+ } else if (argc) {
+ const char * par = strstr (&path[25], "/");
+ if (par) {
+ piid = atoi (&path[25]);
+ _sel_plugin (piid, msg);
+ paid = atoi (&par[1]);
+ value = argv[0]->f;
+ // we have plugin id too
+ } else {
+ // just parameter
+ paid = atoi (&path[25]);
+ value = argv[0]->f;
+ }
+ } else {
+ PBD::warning << "OSC: Must have parameters." << endmsg;
+ return -1;
+ }
+ if (piid != sur->plugin_id) {
+ // if the user is sending to a non-existant plugin, don't adjust one we do have
+ PBD::warning << "OSC: plugin: " << piid << " out of range" << endmsg;
+ return -1;
+ }
+ if (sur->plug_page_size && (paid > (int)sur->plug_page_size)) {
+ return sel_send_fail ("plugin/parameter", paid, 0, get_address (msg));
+ }
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(s);
+ if (!r) {
+ return 1;
+ }
+
+ boost::shared_ptr<Processor> proc = r->nth_plugin (sur->plugins[sur->plugin_id - 1]);
+ boost::shared_ptr<PluginInsert> pi;
+ if (!(pi = boost::dynamic_pointer_cast<PluginInsert>(proc))) {
+ return 1;
+ }
+ boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
+ // paid is paged parameter convert to absolute
+ int parid = paid + (int)(sur->plug_page_size * (sur->plug_page - 1));
+ if (parid > (int) sur->plug_params.size ()) {
+ if (sur->feedback[13]) {
+ sel_send_fail ("plugin/parameter", paid, 0, get_address (msg));
+ }
+ return 0;
+ }
+
+ bool ok = false;
+ uint32_t controlid = pip->nth_parameter(sur->plug_params[parid - 1], ok);
+ if (!ok) {
+ return 1;
+ }
+ ParameterDescriptor pd;
+ pip->get_parameter_descriptor(controlid, pd);
+ if ( pip->parameter_is_input(controlid) || pip->parameter_is_control(controlid) ) {
+ boost::shared_ptr<AutomationControl> c = pi->automation_control(Evoral::Parameter(PluginAutomation, 0, controlid));
+ if (c) {
+ if (pd.integer_step && pd.upper == 1) {
+ if (c->get_value () && value < 1.0) {
+ c->set_value (0, PBD::Controllable::NoGroup);
+ } else if (!c->get_value () && value) {
+ c->set_value (1, PBD::Controllable::NoGroup);
+ }
+ } else {
+ c->set_value (c->interface_to_internal (value), PBD::Controllable::NoGroup);
+ }
+ return 0;
+ }
+ }
+ return 1;
}
int
boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
lo_message_add_string (reply, pip->name());
+ lo_message_add_int32(reply, redi->enabled() ? 1 : 0);
piid++;
}
boost::shared_ptr<ARDOUR::Plugin> pip = pi->plugin();
bool ok = false;
- lo_message reply = lo_message_new();
- lo_message_add_int32 (reply, ssid);
- lo_message_add_int32 (reply, piid);
- lo_message_add_string (reply, pip->name());
for ( uint32_t ppi = 0; ppi < pip->parameter_count(); ppi++) {
uint32_t controlid = pip->nth_parameter(ppi, ok);
if (!ok) {
continue;
}
- if ( pip->parameter_is_input(controlid) || pip->parameter_is_control(controlid) ) {
- boost::shared_ptr<AutomationControl> c = pi->automation_control(Evoral::Parameter(PluginAutomation, 0, controlid));
-
- lo_message_add_int32 (reply, ppi + 1);
- ParameterDescriptor pd;
- pi->plugin()->get_parameter_descriptor(controlid, pd);
- lo_message_add_string (reply, pd.label.c_str());
-
- // I've combined those binary descriptor parts in a bit-field to reduce lilo message elements
- int flags = 0;
- flags |= pd.enumeration ? 1 : 0;
- flags |= pd.integer_step ? 2 : 0;
- flags |= pd.logarithmic ? 4 : 0;
- flags |= pd.max_unbound ? 8 : 0;
- flags |= pd.min_unbound ? 16 : 0;
- flags |= pd.sr_dependent ? 32 : 0;
- flags |= pd.toggled ? 64 : 0;
- flags |= c != NULL ? 128 : 0; // bit 7 indicates in input control
- lo_message_add_int32 (reply, flags);
-
- lo_message_add_int32 (reply, pd.datatype);
- lo_message_add_float (reply, pd.lower);
- lo_message_add_float (reply, pd.upper);
- lo_message_add_string (reply, pd.print_fmt.c_str());
- if ( pd.scale_points ) {
- lo_message_add_int32 (reply, pd.scale_points->size());
- for ( ARDOUR::ScalePoints::const_iterator i = pd.scale_points->begin(); i != pd.scale_points->end(); ++i) {
- lo_message_add_int32 (reply, i->second);
- lo_message_add_string (reply, ((std::string)i->first).c_str());
- }
- }
- else {
- lo_message_add_int32 (reply, 0);
- }
- if ( c ) {
- lo_message_add_double (reply, c->get_value());
- }
- else {
- lo_message_add_double (reply, 0);
+ boost::shared_ptr<AutomationControl> c = pi->automation_control(Evoral::Parameter(PluginAutomation, 0, controlid));
+
+ lo_message reply = lo_message_new();
+ lo_message_add_int32 (reply, ssid);
+ lo_message_add_int32 (reply, piid);
+
+ lo_message_add_int32 (reply, ppi + 1);
+ ParameterDescriptor pd;
+ pi->plugin()->get_parameter_descriptor(controlid, pd);
+ lo_message_add_string (reply, pd.label.c_str());
+
+ // I've combined those binary descriptor parts in a bit-field to reduce lilo message elements
+ int flags = 0;
+ flags |= pd.enumeration ? 1 : 0;
+ flags |= pd.integer_step ? 2 : 0;
+ flags |= pd.logarithmic ? 4 : 0;
+ flags |= pd.sr_dependent ? 32 : 0;
+ flags |= pd.toggled ? 64 : 0;
+ flags |= pip->parameter_is_input(controlid) ? 0x80 : 0;
+
+ std::string param_desc = pi->plugin()->describe_parameter(Evoral::Parameter(PluginAutomation, 0, controlid));
+ flags |= (param_desc == X_("hidden")) ? 0x100 : 0;
+ lo_message_add_int32 (reply, flags);
+
+ switch(pd.datatype) {
+ case ARDOUR::Variant::BEATS:
+ lo_message_add_string(reply, _("BEATS"));
+ break;
+ case ARDOUR::Variant::BOOL:
+ lo_message_add_string(reply, _("BOOL"));
+ break;
+ case ARDOUR::Variant::DOUBLE:
+ lo_message_add_string(reply, _("DOUBLE"));
+ break;
+ case ARDOUR::Variant::FLOAT:
+ lo_message_add_string(reply, _("FLOAT"));
+ break;
+ case ARDOUR::Variant::INT:
+ lo_message_add_string(reply, _("INT"));
+ break;
+ case ARDOUR::Variant::LONG:
+ lo_message_add_string(reply, _("LONG"));
+ break;
+ case ARDOUR::Variant::NOTHING:
+ lo_message_add_string(reply, _("NOTHING"));
+ break;
+ case ARDOUR::Variant::PATH:
+ lo_message_add_string(reply, _("PATH"));
+ break;
+ case ARDOUR::Variant::STRING:
+ lo_message_add_string(reply, _("STRING"));
+ break;
+ case ARDOUR::Variant::URI:
+ lo_message_add_string(reply, _("URI"));
+ break;
+ default:
+ lo_message_add_string(reply, _("UNKNOWN"));
+ break;
+ }
+ lo_message_add_float (reply, pd.lower);
+ lo_message_add_float (reply, pd.upper);
+ lo_message_add_string (reply, pd.print_fmt.c_str());
+ if ( pd.scale_points ) {
+ lo_message_add_int32 (reply, pd.scale_points->size());
+ for ( ARDOUR::ScalePoints::const_iterator i = pd.scale_points->begin(); i != pd.scale_points->end(); ++i) {
+ lo_message_add_float (reply, i->second);
+ lo_message_add_string (reply, ((std::string)i->first).c_str());
}
}
+ else {
+ lo_message_add_int32 (reply, 0);
+ }
+ if ( c ) {
+ lo_message_add_double (reply, c->get_value());
+ }
+ else {
+ lo_message_add_double (reply, 0);
+ }
+
+ lo_send_message (get_address (msg), "/strip/plugin/descriptor", reply);
+ lo_message_free (reply);
}
- lo_send_message (get_address (msg), "/strip/plugin/descriptor", reply);
+ lo_message reply = lo_message_new ();
+ lo_message_add_int32 (reply, ssid);
+ lo_message_add_int32 (reply, piid);
+ lo_send_message (get_address (msg), "/strip/plugin/descriptor_end", reply);
lo_message_free (reply);
return 0;
}
int
-OSC::sel_eq_hpf (float val, lo_message msg)
+OSC::sel_eq_hpf_freq (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->filter_freq_controllable(true)) {
+ s->filter_freq_controllable(true)->set_value (s->filter_freq_controllable(true)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("eq_hpf/freq", 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_lpf_freq (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->filter_freq_controllable(false)) {
+ s->filter_freq_controllable(false)->set_value (s->filter_freq_controllable(false)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("eq_lpf/freq", 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_hpf_enable (float val, lo_message msg)
{
OSCSurface *sur = get_surface(get_address (msg));
boost::shared_ptr<Stripable> s;
s = _select;
}
if (s) {
- if (s->eq_hpf_controllable()) {
- s->eq_hpf_controllable()->set_value (s->eq_hpf_controllable()->interface_to_internal (val), PBD::Controllable::NoGroup);
+ if (s->filter_enable_controllable(true)) {
+ s->filter_enable_controllable(true)->set_value (s->filter_enable_controllable(true)->interface_to_internal (val), PBD::Controllable::NoGroup);
return 0;
}
}
- return sel_fail ("eq_hpf", 0, get_address (msg));
+ return sel_fail ("eq_hpf/enable", 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_lpf_enable (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->filter_enable_controllable(false)) {
+ s->filter_enable_controllable(false)->set_value (s->filter_enable_controllable(false)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("eq_lpf/enable", 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_hpf_slope (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->filter_slope_controllable(true)) {
+ s->filter_slope_controllable(true)->set_value (s->filter_slope_controllable(true)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("eq_hpf/slope", 0, get_address (msg));
+}
+
+int
+OSC::sel_eq_lpf_slope (float val, lo_message msg)
+{
+ OSCSurface *sur = get_surface(get_address (msg));
+ boost::shared_ptr<Stripable> s;
+ if (sur->expand_enable) {
+ s = get_strip (sur->expand, get_address (msg));
+ } else {
+ s = _select;
+ }
+ if (s) {
+ if (s->filter_slope_controllable(false)) {
+ s->filter_slope_controllable(false)->set_value (s->filter_slope_controllable(false)->interface_to_internal (val), PBD::Controllable::NoGroup);
+ return 0;
+ }
+ }
+ return sel_fail ("eq_lpf/slope", 0, get_address (msg));
}
int
if (!tick) {
Glib::usleep(100); // let flurry of signals subside
if (global_init) {
+ Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (uint32_t it = 0; it < _surface.size(); it++) {
OSCSurface* sur = &_surface[it];
lo_address addr = lo_address_new_from_url (sur->remote_url.c_str());
- global_feedback (sur->feedback, addr, sur->gainmode);
+ global_feedback (*sur, addr);
}
global_init = false;
tick = true;
co->tick();
}
}
+ for (FakeTouchMap::iterator x = _touch_timeout.begin(); x != _touch_timeout.end();) {
+ _touch_timeout[(*x).first] = (*x).second - 1;
+ if (!(*x).second) {
+ boost::shared_ptr<ARDOUR::AutomationControl> ctrl = (*x).first;
+ // turn touch off
+ ctrl->stop_touch (ctrl->session().transport_frame());
+ _touch_timeout.erase (x++);
+ } else {
+ x++;
+ }
+ }
return true;
}
node.set_property ("striptypes", default_strip);
node.set_property ("feedback", default_feedback);
node.set_property ("gainmode", default_gainmode);
- if (_surface.size()) {
- XMLNode* config = new XMLNode (X_("Configurations"));
- for (uint32_t it = 0; it < _surface.size(); ++it) {
- OSCSurface* sur = &_surface[it];
- XMLNode* devnode = new XMLNode (X_("Configuration"));
- devnode->set_property (X_("url"), sur->remote_url);
- devnode->set_property (X_("bank-size"), sur->bank_size);
- devnode->set_property (X_("strip-types"), (uint64_t)sur->strip_types.to_ulong());
- devnode->set_property (X_("feedback"), (uint64_t)sur->feedback.to_ulong());
- devnode->set_property (X_("gainmode"), sur->gainmode);
- config->add_child_nocopy (*devnode);
- }
- node.add_child_nocopy (*config);
- }
+ node.set_property ("send-page-size", default_send_size);
+ node.set_property ("plug-page-size", default_plugin_size);
return node;
}
node.get_property (X_("striptypes"), default_strip);
node.get_property (X_("feedback"), default_feedback);
node.get_property (X_("gainmode"), default_gainmode);
+ node.get_property (X_("send-page-size"), default_send_size);
+ node.get_property (X_("plugin-page-size"), default_plugin_size);
- XMLNode* cnode = node.child (X_("Configurations"));
-
- if (cnode) {
- XMLNodeList const& devices = cnode->children();
- for (XMLNodeList::const_iterator d = devices.begin(); d != devices.end(); ++d) {
- OSCSurface s;
- if (!(*d)->get_property (X_("url"), s.remote_url)) {
- continue;
- }
-
- bank_dirty = true;
-
- (*d)->get_property (X_("bank-size"), s.bank_size);
-
- uint64_t bits;
- if ((*d)->get_property (X_ ("strip-types"), bits)) {
- s.strip_types = bits;
- }
- if ((*d)->get_property (X_("feedback"), bits)) {
- s.feedback = bits;
- }
- (*d)->get_property (X_("gainmode"), s.gainmode);
-
- s.bank = 1;
- s.sel_obs = 0;
- s.expand = 0;
- s.expand_enable = false;
- s.strips = get_sorted_stripables (s.strip_types, s.cue);
- s.nstrips = s.strips.size ();
- _surface.push_back (s);
- }
- }
global_init = true;
tick = false;
OSC::get_sorted_stripables(std::bitset<32> types, bool cue)
{
Sorted sorted;
-
- // fetch all stripables
StripableList stripables;
+ // fetch all stripables
session->get_stripables (stripables);
// Look for stripables that match bit in sur->strip_types
boost::shared_ptr<Stripable> s = *it;
if ((!cue) && (!types[9]) && (s->presentation_info().flags() & PresentationInfo::Hidden)) {
// do nothing... skip it
+ } else if (types[8] && (s->is_selected())) {
+ sorted.push_back (s);
+ } else if (types[9] && (s->presentation_info().flags() & PresentationInfo::Hidden)) {
+ sorted.push_back (s);
+ } else if (s->is_master() || s->is_monitor() || s->is_auditioner()) {
+ // do nothing for these either (we add them later)
} else {
-
- if (types[0] && (s->presentation_info().flags() & PresentationInfo::AudioTrack)) {
+ if (types[0] && boost::dynamic_pointer_cast<AudioTrack>(s)) {
+ sorted.push_back (s);
+ } else if (types[1] && boost::dynamic_pointer_cast<MidiTrack>(s)) {
+ sorted.push_back (s);
+ } else if (types[4] && boost::dynamic_pointer_cast<VCA>(s)) {
sorted.push_back (s);
} else
- if (types[1] && (s->presentation_info().flags() & PresentationInfo::MidiTrack)) {
+#ifdef MIXBUS
+ if (types[2] && Profile->get_mixbus() && s->mixbus()) {
sorted.push_back (s);
} else
- if ((s->presentation_info().flags() & PresentationInfo::AudioBus)) {
- boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route> (s);
- // r->feeds (session->master_out()) may make more sense
- if (r->direct_feeds_according_to_reality (session->master_out())) {
- // this is a bus
- if (types[2]) {
- sorted.push_back (s);
+ if (types[7] && boost::dynamic_pointer_cast<Route>(s) && !boost::dynamic_pointer_cast<Track>(s)) {
+ if (Profile->get_mixbus() && !s->mixbus()) {
+ sorted.push_back (s);
+ }
+ } else
+#endif
+ if ((types[2] || types[3] || types[7]) && boost::dynamic_pointer_cast<Route>(s) && !boost::dynamic_pointer_cast<Track>(s)) {
+ boost::shared_ptr<Route> r = boost::dynamic_pointer_cast<Route>(s);
+ if (!(s->presentation_info().flags() & PresentationInfo::MidiBus)) {
+ // note some older sessions will show midibuses as busses
+ if (r->direct_feeds_according_to_reality (session->master_out())) {
+ // this is a bus
+ if (types[2]) {
+ sorted.push_back (s);
+ }
+ } else {
+ // this is an Aux out
+ if (types[7]) {
+ sorted.push_back (s);
+ }
}
- } else {
- // this is an Aux out
- if (types[7]) {
+ } else if (types[3]) {
sorted.push_back (s);
- }
}
- } else if (types[3] && (s->presentation_info().flags() & PresentationInfo::MidiBus)) {
- sorted.push_back (s);
- } else if (types[4] && (s->presentation_info().flags() & PresentationInfo::VCA)) {
- sorted.push_back (s);
- } else if (types[8] && (s->is_selected())) {
- sorted.push_back (s);
- } else if (types[9] && (s->presentation_info().flags() & PresentationInfo::Hidden)) {
- sorted.push_back (s);
}
}
}
sorted.push_back (session->master_out());
}
if (types[6]) {
- sorted.push_back (session->monitor_out());
+ if (session->monitor_out()) {
+ sorted.push_back (session->monitor_out());
+ }
}
return sorted;
}
if (!strncmp (path, "/cue/aux", 8)) {
// set our Aux bus
- ret = cue_set (argv[0]->i, msg);
+ if (argv[0]->f) {
+ ret = cue_set (argv[0]->f, msg);
+ } else {
+ ret = 0;
+ }
}
else if (!strncmp (path, "/cue/connect", 12)) {
// Connect to default Aux bus
- if ((!argc) || argv[0]->i) {
+ if ((!argc) || argv[0]->f) {
ret = cue_set (1, msg);
+ } else {
+ ret = 0;
}
}
else if (!strncmp (path, "/cue/next_aux", 13)) {
// switch to next Aux bus
- if ((!argc) || argv[0]->i) {
+ if ((!argc) || argv[0]->f) {
ret = cue_next (msg);
+ } else {
+ ret = 0;
}
}
else if (!strncmp (path, "/cue/previous_aux", 17)) {
// switch to previous Aux bus
- if ((!argc) || argv[0]->i) {
+ if ((!argc) || argv[0]->f) {
ret = cue_previous (msg);
+ } else {
+ ret = 0;
}
}
else if (!strncmp (path, "/cue/send/fader/", 16) && strlen (path) > 16) {
boost::shared_ptr<Stripable> s = get_strip (sur->aux, get_address (msg));
if (s) {
- float abs;
- abs = slider_position_to_gain_with_max (position, 2.0);
if (s->gain_control()) {
- s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
+ s->gain_control()->set_value (s->gain_control()->interface_to_internal (position), PBD::Controllable::NoGroup);
return 0;
}
}
return -1;
}
boost::shared_ptr<Send> s = cue_get_send (id, get_address (msg));
- float abs;
if (s) {
if (s->gain_control()) {
- abs = slider_position_to_gain_with_max (val, 2.0);
- s->gain_control()->set_value (abs, PBD::Controllable::NoGroup);
+ s->gain_control()->set_value (s->gain_control()->interface_to_internal(val), PBD::Controllable::NoGroup);
return 0;
}
}