From be94297366c4a016a23f428613f65da0957df1b4 Mon Sep 17 00:00:00 2001 From: sanine Date: Mon, 5 Sep 2022 19:56:04 -0500 Subject: add mossrose_channel_stop --- src/channel.c | 6 ++++++ src/channel.h | 1 + src/mossrose.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/src/channel.c b/src/channel.c index a7a3643..23c3565 100644 --- a/src/channel.c +++ b/src/channel.c @@ -56,6 +56,12 @@ void channel_resume(struct channel_t *chan) } +void channel_stop(struct channel_t *chan) +{ + p_atomic_int_set(&(chan->shared.active), false); +} + + void channel_set_volume(struct channel_t *chan, float volume) { if (volume > 1.0f) volume = 1.0f; diff --git a/src/channel.h b/src/channel.h index 61a1c7d..b0c83a2 100644 --- a/src/channel.h +++ b/src/channel.h @@ -39,6 +39,7 @@ struct channel_t { void channel_init(struct channel_t *chan); void channel_reset(struct channel_t *chan); void channel_pause(struct channel_t *chan); +void channel_stop(struct channel_t *chan); void channel_resume(struct channel_t *chan); void channel_set_volume(struct channel_t *chan, float volume); void channel_set_pan(struct channel_t *chan, float pan_left, float pan_right); diff --git a/src/mossrose.c b/src/mossrose.c index 2e27c45..8a99770 100644 --- a/src/mossrose.c +++ b/src/mossrose.c @@ -132,6 +132,12 @@ void mossrose_channel_resume(int channel) { } +void mossrose_channel_stop(int channel) { + struct channel_t *chan = mossrose_global.channels + channel; + channel_stop(chan); +} + + void mossrose_channel_set_callback(int channel, channel_callback_t callback, void *userdata) { struct channel_t *chan = mossrose_global.channels + channel; -- cgit v1.2.1