summaryrefslogtreecommitdiff
path: root/synth/communication.h
diff options
context:
space:
mode:
Diffstat (limited to 'synth/communication.h')
-rw-r--r--synth/communication.h35
1 files changed, 25 insertions, 10 deletions
diff --git a/synth/communication.h b/synth/communication.h
index 27f7186..8d11cd4 100644
--- a/synth/communication.h
+++ b/synth/communication.h
@@ -2,21 +2,36 @@
#define __COMMUNICATION_H__
#include <pthread.h>
+#include <jack/ringbuffer.h>
-struct suspend_request_t
+struct request_t
{
- int prog; //if negative, all programs are affected
- bool suspend; //true->suspend, false->use them again
- bool done; //must be set to false by the requester,
- //must be set to true after processing by the requestee
+ enum request_type_t { NONE, SUSPEND_PROGRAM, RESUME_PROGRAM, PANIC, RELEASE_ALL };
+ request_type_t type;
+ int prog_or_chan; //if negative, all programs/channels are affected
+
+ request_t()
+ {
+ type=NONE;
+ }
+
+ request_t(request_type_t type_, int poc)
+ {
+ type=type_;
+ prog_or_chan=poc;
+ }
};
+// init/uninit
+void init_communication();
+void uninit_communication();
-extern pthread_mutex_t suspend_request_mutex;
-extern suspend_request_t suspend_request;
-
+// for non-audio-threads. mutex-protected
+int do_request(request_t request);
+// for the audio-thread. NOT mutex-protected
+bool request_available();
+request_t get_request();
+void request_finished(int);
-void init_communication();
-void uninit_communication();
#endif