diff options
Diffstat (limited to 'src/sounds.c')
| -rw-r--r-- | src/sounds.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/sounds.c b/src/sounds.c index 5445df6..0086f4f 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1,51 +1,5 @@ #include "sounds.h" -int mqueue_get(message_queue *q, synth_message *msg) { - pthread_mutex_lock(&(q)->lock); - if ((q)->tail == (q)->head) { - pthread_mutex_unlock(&(q)->lock); - return 1; - } - - *(msg) = (q)->buffer[(q)->tail]; - (q)->tail = ((q)->tail + 1) % MESSAGE_QUEUE_SIZE; - - pthread_mutex_unlock(&(q)->lock); - return 0; -} - -int mqueue__push_no_lock(message_queue *q, synth_message msg) { - size_t next = ((q)->head + 1) % MESSAGE_QUEUE_SIZE; - - if ((q)->tail == next) { - return 1; - } - - (q)->buffer[(q)->head] = msg; - (q)->head = next; - return 0; -} - -int mqueue_push(message_queue *q, synth_message msg) { - pthread_mutex_lock(&(q)->lock); - int ret = mqueue__push_no_lock(q, msg); - pthread_mutex_unlock(&(q)->lock); - return ret; -} - -int mqueue_push_many(message_queue *q, synth_message *msg, size_t count) { - pthread_mutex_lock(&(q)->lock); - int ret = 0; - for (size_t i = 0; i < count; i++) { - ret = mqueue__push_no_lock(q, msg[i]); - if (ret != 0) { - break; - } - } - pthread_mutex_unlock(&(q)->lock); - return ret; -} - float envelope_next(envelope *env) { float value; bool next_state = false; |
