X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fosc%2Fosc.cc;h=6a771d9b48a7e14af86225409edea9b984917043;hb=9c64d63ebbab335d72285cd2514496d5092ee3ca;hp=61d79698195092709306b901f3cc794d00e4de44;hpb=2a9d7286f9058f3baa730078254fbe552d2296c4;p=ardour.git diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 61d7969819..6a771d9b48 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -17,8 +17,6 @@ * */ -#include -#include #include #include #include @@ -27,7 +25,7 @@ #include #include -#include +#include "pbd/gstdio_compat.h" #include #include @@ -55,6 +53,7 @@ using namespace ARDOUR; using namespace std; using namespace Glib; +using namespace ArdourSurface; #include "pbd/abstract_ui.cc" // instantiate template @@ -207,15 +206,8 @@ OSC::start () std::string url_file; if (find_file (ardour_config_search_path(), "osc_url", url_file)) { - _osc_url_file = url_file; - ofstream urlfile; - urlfile.open(_osc_url_file.c_str(), ios::trunc); - - if (urlfile) { - urlfile << get_server_url () << endl; - urlfile.close(); - } else { + if (g_file_set_contents (_osc_url_file.c_str(), get_server_url().c_str(), -1, NULL)) { cerr << "Couldn't write '" << _osc_url_file << "'" <=0) { - close(fd); - } lo_server_free (_osc_server); _osc_server = 0; } if (_osc_unix_server) { - int fd = lo_server_get_socket_fd(_osc_unix_server); - if (fd >=0) { - close(fd); - } lo_server_free (_osc_unix_server); _osc_unix_server = 0; } @@ -344,6 +328,7 @@ OSC::register_callbacks() REGISTER_CALLBACK (serv, "/ardour/add_marker", "", add_marker); REGISTER_CALLBACK (serv, "/ardour/access_action", "s", access_action); REGISTER_CALLBACK (serv, "/ardour/loop_toggle", "", loop_toggle); + REGISTER_CALLBACK (serv, "/ardour/loop_location", "ii", loop_location); REGISTER_CALLBACK (serv, "/ardour/goto_start", "", goto_start); REGISTER_CALLBACK (serv, "/ardour/goto_end", "", goto_end); REGISTER_CALLBACK (serv, "/ardour/rewind", "", rewind); @@ -368,6 +353,8 @@ OSC::register_callbacks() 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); + REGISTER_CALLBACK (serv, "/ardour/routes/trimabs", "if", route_set_trim_abs); + REGISTER_CALLBACK (serv, "/ardour/routes/trimdB", "if", route_set_trim_dB); REGISTER_CALLBACK (serv, "/ardour/routes/pan_stereo_position", "if", route_set_pan_stereo_position); 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); @@ -823,7 +810,9 @@ OSC::route_solo (int rid, int yn) boost::shared_ptr r = session->route_by_remote_id (rid); if (r) { - r->set_solo (yn, this); + boost::shared_ptr rl (new RouteList); + rl->push_back (r); + session->set_solo (rl, yn); } return 0; @@ -859,18 +848,32 @@ OSC::route_set_gain_abs (int rid, float level) int OSC::route_set_gain_dB (int rid, float dB) +{ + return route_set_gain_abs (rid, dB_to_coefficient (dB)); +} + + +int +OSC::route_set_trim_abs (int rid, float level) { if (!session) return -1; boost::shared_ptr r = session->route_by_remote_id (rid); if (r) { - r->set_gain (dB_to_coefficient (dB), this); + r->set_trim (level, this); } return 0; } +int +OSC::route_set_trim_dB (int rid, float dB) +{ + return route_set_trim_abs(rid, dB_to_coefficient (dB)); +} + + int OSC::route_set_pan_stereo_position (int rid, float pos) { @@ -1008,7 +1011,7 @@ OSC::route_plugin_parameter (int rid, int piid, int par, float val) return -1; } - if (!pip->parameter_is_input(par)) { + if (!pip->parameter_is_input(controlid)) { PBD::error << "OSC: Parameter # " << par << " for plugin # " << piid << " on RID '" << rid << "' is not a control input" << endmsg; return -1; } @@ -1080,25 +1083,14 @@ OSC::route_plugin_parameter_print (int rid, int piid, int par) XMLNode& OSC::get_state () { - XMLNode& node (ControlProtocol::get_state()); - - node.add_property (X_("feedback"), _send_route_changes ? "1" : "0"); - return node; + return ControlProtocol::get_state(); } int -OSC::set_state (const XMLNode& node, int /*version*/) +OSC::set_state (const XMLNode& node, int version) { - const XMLProperty* prop = node.property (X_("feedback")); - - if (prop) { - if (PBD::string_is_affirmative (prop->value())) { - _send_route_changes = true; - } else { - _send_route_changes = false; - } - } else { - /* leave it alone */ + if (ControlProtocol::set_state (node, version)) { + return -1; } return 0;