From 91726809f9e97d8d4fb7b6c0642234ff96535bdd Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 28 Aug 2022 12:41:53 -0500 Subject: add channel_init() and channel_reset() --- src/channel.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/channel.c') 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); +} -- cgit v1.2.1