summaryrefslogtreecommitdiff
path: root/src/drumgizmo.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-03-20 19:44:13 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-03-20 19:44:13 +0100
commit75491ae08b645e784b260b2d28e246a441de7f32 (patch)
treea588477dd0b2d1b25c33712045223112446db8d1 /src/drumgizmo.cc
parent7c0d78d164cbce489cea672f110a4f3f96515ea1 (diff)
Added initial code for a GUI<->engine message system.
Diffstat (limited to 'src/drumgizmo.cc')
-rw-r--r--src/drumgizmo.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index ec03d76..93426de 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -56,6 +56,31 @@ DrumGizmo::~DrumGizmo()
*/
}
+/*
+ * Send a message to the engine. The engine takes over the memory.
+ */
+void DrumGizmo::sendMessage(Message *msg)
+{
+ message_mutex.lock();
+ message_queue.push_back(msg);
+ message_mutex.unlock();
+}
+
+/*
+ * Receive message from the engine. The caller takes over the memory.
+ */
+Message *DrumGizmo::receiveMessage()
+{
+ Message *msg = NULL;
+ message_mutex.lock();
+ if(message_queue.size()) {
+ msg = message_queue.front();
+ message_queue.pop_front();
+ }
+ message_mutex.unlock();
+ return msg;
+}
+
std::string DrumGizmo::drumkitfile()
{
return kitfile;