summaryrefslogtreecommitdiff
path: root/src/channel.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-28 12:41:53 -0500
committersanine <sanine.not@pm.me>2022-08-28 12:41:53 -0500
commit91726809f9e97d8d4fb7b6c0642234ff96535bdd (patch)
tree850fd9cc1f391744b48021b83e29e4bd961eda32 /src/channel.c
parent0d6ece00397ebb9215ccf1af06cce22c3a94197e (diff)
add channel_init() and channel_reset()
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/channel.c b/src/channel.c
index fd6741b..e6e6c3f 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -4,5 +4,25 @@
#include "channel.h"
-struct channel_t {
-};
+void channel_init(struct channel_t *chan)
+{
+ chan->active = false;
+ chan->paused = false;
+ chan->volume = 255;
+ chan->pan = 0;
+
+ chan->sound_mutex = p_mutex_new();
+ chan->sound.left = NULL;
+ chan->sound.right = NULL;
+ chan->pos = 0;
+}
+
+
+void channel_reset(struct channel_t *chan)
+{
+ p_atomic_int_set(&(chan->paused), false);
+ p_atomic_int_set(&(chan->volume), 255);
+ p_atomic_int_set(&(chan->pan), 0);
+ chan->pos = 0;
+ p_atomic_int_set(&(chan->active), false);
+}