aboutsummaryrefslogtreecommitdiff
path: root/src/sounds.c
diff options
context:
space:
mode:
authorspl3g <spleefer6@yandex.ru>2025-10-10 17:56:48 +0300
committerspl3g <spleefer6@yandex.ru>2025-10-10 21:56:51 +0300
commit6e79fee0171f41a06389cfed19e050785fd33b93 (patch)
tree3b15ae776e02cb5061a1604738c0d4b3db3687e1 /src/sounds.c
parent75427da62eb579374d4b139084cc48e042830f21 (diff)
Move out the message queue
Diffstat (limited to 'src/sounds.c')
-rw-r--r--src/sounds.c46
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;