summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/control_protocol.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/ardour/control_protocol.h')
-rw-r--r--libs/ardour/ardour/control_protocol.h38
1 files changed, 37 insertions, 1 deletions
diff --git a/libs/ardour/ardour/control_protocol.h b/libs/ardour/ardour/control_protocol.h
index c0869fad9a..4088e2dd09 100644
--- a/libs/ardour/ardour/control_protocol.h
+++ b/libs/ardour/ardour/control_protocol.h
@@ -16,7 +16,8 @@ class ControlProtocol : sigc::trackable {
virtual ~ControlProtocol();
virtual int init () { return 0; }
- virtual bool active() const = 0;
+
+ sigc::signal<void> ActiveChanged;
enum SendWhat {
SendRoute,
@@ -26,6 +27,9 @@ class ControlProtocol : sigc::trackable {
std::string name() const { return _name; }
void set_send (SendWhat);
+ void set_active (bool yn);
+ bool get_active() const { return active_thread > 0; }
+
bool send() const { return _send != 0; }
bool send_route_feedback () const { return _send & SendRoute; }
@@ -35,11 +39,43 @@ class ControlProtocol : sigc::trackable {
virtual void send_global_feedback () {}
protected:
+
ARDOUR::Session& session;
SendWhat _send;
std::string _name;
+ int active_thread;
+ int thread_request_pipe[2];
+ pthread_t _thread;
+
+ static void* _thread_work (void *);
+ void* thread_work ();
+
+ struct ThreadRequest {
+ enum Type {
+ Start,
+ Stop,
+ Quit
+ };
+ };
+
+ int init_thread();
+ int start_thread ();
+ int stop_thread ();
+ void terminate_thread ();
+ int poke_thread (ThreadRequest::Type);
};
+extern "C" {
+ struct ControlProtocolDescriptor {
+ const char* name;
+ void* ptr;
+ void* module;
+ ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*);
+ void (*destroy)(ControlProtocolDescriptor*,ControlProtocol*);
+
+ };
+}
+
}
#endif // ardour_control_protocols_h