mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
fix up OSC support to conform to new CP API and pay attention to feedback setting, even though feedback does nothing right now
This commit is contained in:
parent
e9c47051f7
commit
2065a2a2ac
1 changed files with 40 additions and 21 deletions
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include <glibmm/miscutils.h>
|
#include <glibmm/miscutils.h>
|
||||||
|
|
||||||
|
#include <pbd/convert.h>
|
||||||
#include <pbd/pthread_utils.h>
|
#include <pbd/pthread_utils.h>
|
||||||
#include <pbd/file_utils.h>
|
#include <pbd/file_utils.h>
|
||||||
#include <pbd/failed_constructor.h>
|
#include <pbd/failed_constructor.h>
|
||||||
|
|
@ -71,22 +72,20 @@ static void error_callback(int, const char *, const char *)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OSC::OSC (Session& s, uint32_t port)
|
OSC::OSC (Session& s, uint32_t port)
|
||||||
: ControlProtocol (s, "OSC")
|
: ControlProtocol (s, X_("Open Sound Control (OSC)"))
|
||||||
, AbstractUI<OSCUIRequest> ("osc")
|
, AbstractUI<OSCUIRequest> ("osc")
|
||||||
|
, local_server (0)
|
||||||
|
, remote_server (0)
|
||||||
, _port(port)
|
, _port(port)
|
||||||
|
, _ok (true)
|
||||||
|
, _shutdown (false)
|
||||||
|
, _osc_server (0)
|
||||||
|
, _osc_unix_server (0)
|
||||||
|
, _namespace_root ("/ardour")
|
||||||
|
, _send_route_changes (true)
|
||||||
{
|
{
|
||||||
_instance = this;
|
_instance = this;
|
||||||
_shutdown = false;
|
|
||||||
_osc_server = 0;
|
|
||||||
_osc_unix_server = 0;
|
|
||||||
_namespace_root = "/ardour";
|
|
||||||
_send_route_changes = true;
|
|
||||||
|
|
||||||
/* glibmm hack */
|
|
||||||
local_server = 0;
|
|
||||||
remote_server = 0;
|
|
||||||
|
|
||||||
// "Application Hooks"
|
|
||||||
session_loaded (s);
|
session_loaded (s);
|
||||||
session->Exported.connect (*this, MISSING_INVALIDATOR, boost::bind (&OSC::session_exported, this, _1, _2), this);
|
session->Exported.connect (*this, MISSING_INVALIDATOR, boost::bind (&OSC::session_exported, this, _1, _2), this);
|
||||||
}
|
}
|
||||||
|
|
@ -113,11 +112,21 @@ OSC::do_request (OSCUIRequest* req)
|
||||||
int
|
int
|
||||||
OSC::set_active (bool yn)
|
OSC::set_active (bool yn)
|
||||||
{
|
{
|
||||||
if (yn) {
|
if (yn != active()) {
|
||||||
return start ();
|
|
||||||
} else {
|
if (yn) {
|
||||||
return stop ();
|
if (start ()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (stop ()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ControlProtocol::set_active (yn);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -1059,16 +1068,26 @@ OSC::route_plugin_parameter_print (int rid, int piid, int par)
|
||||||
XMLNode&
|
XMLNode&
|
||||||
OSC::get_state ()
|
OSC::get_state ()
|
||||||
{
|
{
|
||||||
XMLNode* node = new XMLNode ("Protocol");
|
XMLNode& node (ControlProtocol::get_state());
|
||||||
|
|
||||||
node->add_property (X_("name"), "Open Sound Control (OSC)");
|
node.add_property (X_("feedback"), _send_route_changes ? "1" : "0");
|
||||||
node->add_property (X_("feedback"), _send_route_changes ? "1" : "0");
|
return node;
|
||||||
|
|
||||||
return *node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
OSC::set_state (const XMLNode&, 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 */
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue