#include <fcntl.h>
#include <glibmm/miscutils.h>
-#include <boost/signals2.hpp>
#include <pbd/pthread_utils.h>
#include <pbd/file_utils.h>
-#include <pbd/filesystem.h>
#include <pbd/failed_constructor.h>
#include "ardour/session.h"
#include "pbd/abstract_ui.cc" // instantiate template
-#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
-
OSC* OSC::_instance = 0;
#ifdef DEBUG
#endif
OSC::OSC (Session& s, uint32_t port)
- : ControlProtocol (s, "OSC", this)
+ : ControlProtocol (s, "OSC")
, AbstractUI<OSCUIRequest> ("osc")
, _port(port)
{
// "Application Hooks"
session_loaded (s);
- session->Exported.connect (*this, MISSING_INVALIDATOR, ui_bind (&OSC::session_exported, this, _1, _2), this);
+ session->Exported.connect (*this, MISSING_INVALIDATOR, boost::bind (&OSC::session_exported, this, _1, _2), this);
}
OSC::~OSC()
}
#endif
- cerr << "OSC @ " << get_server_url () << endl;
+ PBD::info << "OSC @ " << get_server_url () << endmsg;
- PBD::sys::path url_file;
+ std::string url_file;
- if (find_file_in_search_path (ardour_search_path() + system_config_search_path(),
- "osc_url", url_file)) {
+ if (find_file_in_search_path (ardour_config_search_path(), "osc_url", url_file)) {
- _osc_url_file = url_file.to_string();
+ _osc_url_file = url_file;
ofstream urlfile;
urlfile.open(_osc_url_file.c_str(), ios::trunc);
REGISTER_CALLBACK (serv, "/ardour/routes/pan_stereo_width", "if", route_set_pan_stereo_width);
REGISTER_CALLBACK (serv, "/ardour/routes/plugin/parameter", "iiif", route_plugin_parameter);
REGISTER_CALLBACK (serv, "/ardour/routes/plugin/parameter/print", "iii", route_plugin_parameter_print);
-
-
+ REGISTER_CALLBACK (serv, "/ardour/routes/send/gainabs", "iif", route_set_send_gain_abs);
+ REGISTER_CALLBACK (serv, "/ardour/routes/send/gaindB", "iif", route_set_send_gain_dB);
/* still not-really-standardized query interface */
//REGISTER_CALLBACK (serv, "/ardour/*/#current_value", "", current_value);
}
int
-OSC::catchall (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg)
+OSC::catchall (const char *path, const char* /*types*/, lo_arg **argv, int argc, lo_message msg)
{
size_t len;
int ret = 1; /* unhandled */
if (r) {
boost::shared_ptr<Panner> panner = r->panner();
if (panner) {
- panner->set_stereo_position (pos);
+ panner->set_position (pos);
}
}
if (r) {
boost::shared_ptr<Panner> panner = r->panner();
if (panner) {
- panner->set_stereo_width (pos);
+ panner->set_width (pos);
}
}
}
+int
+OSC::route_set_send_gain_abs (int rid, int sid, float val)
+{
+ if (!session) {
+ return -1;
+ }
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+
+ if (!r) {
+ return -1;
+ }
+
+ /* revert to zero-based counting */
+
+ if (sid > 0) {
+ --sid;
+ }
+
+ boost::shared_ptr<Processor> p = r->nth_send (send);
+
+ if (p) {
+ boost::shared_ptr<Send> s = boost::dynamic_pointer_cast<Send>(p);
+ boost::shared_ptr<Amp> a = s->amp();
+
+ if (a) {
+ a->set_gain (val, this);
+ }
+ }
+}
+
+int
+OSC::route_set_send_gain_dB (int rid, int sid, float val)
+{
+ if (!session) {
+ return -1;
+ }
+
+ boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
+
+ if (!r) {
+ return -1;
+ }
+
+ /* revert to zero-based counting */
+
+ if (sid > 0) {
+ --sid;
+ }
+
+ boost::shared_ptr<Processor> p = r->nth_send (send);
+
+ if (p) {
+ boost::shared_ptr<Send> s = boost::dynamic_pointer_cast<Send>(p);
+ boost::shared_ptr<Amp> a = s->amp();
+
+ if (a) {
+ a->set_gain (dB_to_coefficient (val), this);
+ }
+ }
+}
+
int
OSC::route_plugin_parameter (int rid, int piid, int par, float val)
{
XMLNode&
OSC::get_state ()
{
- return *(new XMLNode ("OSC"));
+ XMLNode* node = new XMLNode ("Protocol");
+
+ node->add_property (X_("name"), "Open Sound Control (OSC)");
+ node->add_property (X_("feedback"), _send_route_changes ? "1" : "0");
+
+ return *node;
}
int