summaryrefslogtreecommitdiff
path: root/libs/surfaces/osc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-12-21 18:23:07 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-12-21 18:23:07 +0000
commitf450df300c9c057141a4caf79ff6dbfbf58492d9 (patch)
tree409f9c56056a337cade83d45ccff47ccdb06dd0c /libs/surfaces/osc
parent738387f9a417537e768d56d3fc4afcb9dc82d66b (diff)
fully implement and deploy explicit x-thread signal connection syntax (testing comes next)
git-svn-id: svn://localhost/ardour2/branches/3.0@6379 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces/osc')
-rw-r--r--libs/surfaces/osc/osc.cc13
-rw-r--r--libs/surfaces/osc/osc.h6
-rw-r--r--libs/surfaces/osc/osc_controllable.cc3
-rw-r--r--libs/surfaces/osc/osc_controllable.h4
4 files changed, 17 insertions, 9 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc
index a076b161e7..6054d01334 100644
--- a/libs/surfaces/osc/osc.cc
+++ b/libs/surfaces/osc/osc.cc
@@ -51,9 +51,12 @@ using namespace ARDOUR;
using namespace std;
using namespace Glib;
-
#include "pbd/abstract_ui.cc" // instantiate template
+#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
+
+OSC* OSC::_instance = 0;
+
#ifdef DEBUG
static void error_callback(int num, const char *m, const char *path)
{
@@ -67,10 +70,11 @@ static void error_callback(int, const char *, const char *)
#endif
OSC::OSC (Session& s, uint32_t port)
- : ControlProtocol (s, "OSC")
+ : ControlProtocol (s, "OSC", this)
, AbstractUI<OSCUIRequest> ("osc")
, _port(port)
{
+ _instance = this;
_shutdown = false;
_osc_server = 0;
_osc_unix_server = 0;
@@ -83,12 +87,13 @@ OSC::OSC (Session& s, uint32_t port)
// "Application Hooks"
session_loaded (s);
- session->Exported.connect (*this, boost::bind (&OSC::session_exported, this, _1, _2));
+ session->Exported.connect (*this, ui_bind (&OSC::session_exported, this, _1, _2), this);
}
OSC::~OSC()
{
stop ();
+ _instance = 0;
}
void
@@ -573,7 +578,7 @@ OSC::listen_to_route (boost::shared_ptr<Route> route, lo_address addr)
*/
if (!route_exists) {
- route->GoingAway.connect (*this, boost::bind (&OSC::drop_route, this, boost::weak_ptr<Route> (route)));
+ route->GoingAway.connect (*this, boost::bind (&OSC::drop_route, this, boost::weak_ptr<Route> (route)), this);
}
}
diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h
index 15914bfbbd..0c72671ae9 100644
--- a/libs/surfaces/osc/osc.h
+++ b/libs/surfaces/osc/osc.h
@@ -60,6 +60,8 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
OSC (ARDOUR::Session&, uint32_t port);
virtual ~OSC();
+ static OSC* instance() { return _instance; }
+
XMLNode& get_state ();
int set_state (const XMLNode&, int version);
@@ -182,8 +184,10 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
void drop_route (boost::weak_ptr<ARDOUR::Route>);
typedef std::list<OSCControllable*> Controllables;
-
+
Controllables controllables;
+
+ static OSC* _instance;
};
#endif // ardour_osc_h
diff --git a/libs/surfaces/osc/osc_controllable.cc b/libs/surfaces/osc/osc_controllable.cc
index f5deadd41d..baf888667e 100644
--- a/libs/surfaces/osc/osc_controllable.cc
+++ b/libs/surfaces/osc/osc_controllable.cc
@@ -24,6 +24,7 @@
#include "ardour/route.h"
+#include "osc.h"
#include "osc_controllable.h"
using namespace sigc;
@@ -35,7 +36,7 @@ OSCControllable::OSCControllable (lo_address a, const std::string& p, boost::sha
, addr (a)
, path (p)
{
- c->Changed.connect (changed_connection, mem_fun (*this, &OSCControllable::send_change));
+ c->Changed.connect (changed_connection, boost::bind (&OSCControllable::send_change, this), OSC::instance());
}
OSCControllable::~OSCControllable ()
diff --git a/libs/surfaces/osc/osc_controllable.h b/libs/surfaces/osc/osc_controllable.h
index 67b8284460..55e2815d35 100644
--- a/libs/surfaces/osc/osc_controllable.h
+++ b/libs/surfaces/osc/osc_controllable.h
@@ -30,9 +30,7 @@
#include "ardour/types.h"
namespace ARDOUR {
-
-class Route;
-
+ class Route;
}
class OSCControllable : public PBD::Stateful