summaryrefslogtreecommitdiff
path: root/src/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/channel.c b/src/channel.c
index 0141569..603a980 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -40,6 +40,24 @@ void channel_resume(struct channel_t *chan)
}
+void channel_set_volume(struct channel_t *chan, float volume)
+{
+ if (volume > 1.0f) volume = 1.0f;
+ if (volume < 0.0f) volume = 0.0f;
+
+ p_atomic_int_set(&(chan->volume), 255*volume);
+}
+
+
+void channel_set_pan(struct channel_t *chan, float pan)
+{
+ if (pan > 1.0f) pan = 1.0f;
+ if (pan < -1.0f) pan = -1.0f;
+
+ p_atomic_int_set(&(chan->pan), 128*pan);
+}
+
+
void channel_get_next_sample(float *left, float *right, struct channel_t *chan)
{
bool active = p_atomic_int_get(&(chan->active));