summaryrefslogtreecommitdiff
path: root/src/drumgizmo.cc
diff options
context:
space:
mode:
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;