summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-11-19 07:38:45 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-11-19 07:38:45 +0000
commita4b461f207552c0f91a364eccacd1044947c6fdf (patch)
treebc539667c6ad41a8a54e85056ab1318130563a11
parent3e89ba31b57a6858ea0f2f87c482d51ba7bd9a32 (diff)
per-route OSC control of solo/mute/recenable/gain
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4214 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/ardour/osc.h23
-rw-r--r--libs/ardour/globals.cc1
-rw-r--r--libs/ardour/osc.cc84
3 files changed, 103 insertions, 5 deletions
diff --git a/libs/ardour/ardour/osc.h b/libs/ardour/ardour/osc.h
index d7c2f4bd85..33759feb91 100644
--- a/libs/ardour/ardour/osc.h
+++ b/libs/ardour/ardour/osc.h
@@ -120,6 +120,29 @@ class OSC : public BasicUI, public sigc::trackable
PATH_CALLBACK1(set_transport_speed,f,);
PATH_CALLBACK1(access_action,s,&);
+
+#define PATH_CALLBACK2(name,arg1type,arg2type) \
+ static int _ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { \
+ return static_cast<OSC*>(user_data)->cb_ ## name (path, types, argv, argc, data); \
+ } \
+ int cb_ ## name (const char *path, const char *types, lo_arg **argv, int argc, void *data) { \
+ if (argc > 1) { \
+ name (argv[0]->arg1type, argv[1]->arg2type); \
+ } \
+ return 0; \
+ }
+
+ PATH_CALLBACK2(route_mute,i,i);
+ PATH_CALLBACK2(route_solo,i,i);
+ PATH_CALLBACK2(route_recenable,i,i);
+ PATH_CALLBACK2(route_set_gain_abs,i,f);
+ PATH_CALLBACK2(route_set_gain_dB,i,f);
+
+ int route_mute (int rid, int yn);
+ int route_solo (int rid, int yn);
+ int route_recenable (int rid, int yn);
+ int route_set_gain_abs (int rid, float level);
+ int route_set_gain_dB (int rid, float dB);
};
}
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 08b87bdd36..8e6b53095b 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -119,6 +119,7 @@ setup_osc ()
return 0;
}
}
+
#endif
int
diff --git a/libs/ardour/osc.cc b/libs/ardour/osc.cc
index 04090d35a1..384e77aa3d 100644
--- a/libs/ardour/osc.cc
+++ b/libs/ardour/osc.cc
@@ -36,6 +36,7 @@
#include <ardour/session.h>
#include <ardour/route.h>
#include <ardour/audio_track.h>
+#include <ardour/dB.h>
#include "i18n.h"
@@ -146,9 +147,9 @@ OSC::stop ()
unlink(_osc_unix_socket_path.c_str());
}
- if (! _osc_url_file.empty() ) {
- unlink(_osc_url_file.c_str() );
- }
+ if (! _osc_url_file.empty() ) {
+ unlink(_osc_url_file.c_str() );
+ }
return 0;
}
@@ -196,6 +197,12 @@ OSC::register_callbacks()
REGISTER_CALLBACK (serv, "/ardour/rec_enable_toggle", "", rec_enable_toggle);
REGISTER_CALLBACK (serv, "/ardour/toggle_all_rec_enables", "", toggle_all_rec_enables);
+ REGISTER_CALLBACK (serv, "/ardour/routes/mute", "ii", route_mute);
+ REGISTER_CALLBACK (serv, "/ardour/routes/solo", "ii", route_solo);
+ REGISTER_CALLBACK (serv, "/ardour/routes/recenable", "ii", route_recenable);
+ REGISTER_CALLBACK (serv, "/ardour/routes/gainabs", "if", route_set_gain_abs);
+ REGISTER_CALLBACK (serv, "/ardour/routes/gaindB", "if", route_set_gain_dB);
+
#if 0
REGISTER_CALLBACK (serv, "/ardour/*/#current_value", "", current_value);
REGISTER_CALLBACK (serv, "/ardour/set", "", set);
@@ -369,7 +376,7 @@ OSC::osc_receiver()
if (pfd[i].revents & POLLIN)
{
// this invokes callbacks
- //cerr << "invoking recv on " << pfd[i].fd << endl;
+ // cerr << "invoking recv on " << pfd[i].fd << endl;
lo_server_recv(srvs[i]);
}
}
@@ -381,7 +388,7 @@ OSC::osc_receiver()
if (_osc_server) {
int fd = lo_server_get_socket_fd(_osc_server);
if (fd >=0) {
- // hack around
+ // hack around
close(fd);
}
lo_server_free (_osc_server);
@@ -491,3 +498,70 @@ OSC::current_value (const char *path, const char *types, lo_arg **argv, int argc
#endif
return 0;
}
+
+int
+OSC::route_mute (int rid, int yn)
+{
+ if (!session) return -1;
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+
+ if (r) {
+ r->set_mute (yn, this);
+ }
+ return 0;
+}
+
+int
+OSC::route_solo (int rid, int yn)
+{
+ if (!session) return -1;
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+
+ if (r) {
+ r->set_solo (yn, this);
+ }
+ return 0;
+}
+
+int
+OSC::route_recenable (int rid, int yn)
+{
+ if (!session) return -1;
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+
+ if (r) {
+ r->set_record_enable (yn, this);
+ }
+ return 0;
+}
+
+int
+OSC::route_set_gain_abs (int rid, float level)
+{
+ if (!session) return -1;
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+
+ if (r) {
+ r->set_gain (level, this);
+ }
+
+ return 0;
+}
+
+int
+OSC::route_set_gain_dB (int rid, float dB)
+{
+ if (!session) return -1;
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+
+ if (r) {
+ r->set_gain (dB_to_coefficient (dB), this);
+ }
+
+ return 0;
+}