diff options
Diffstat (limited to 'src/channel.c')
-rw-r--r-- | src/channel.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/channel.c b/src/channel.c index a29e7f7..d039701 100644 --- a/src/channel.c +++ b/src/channel.c @@ -106,8 +106,15 @@ void channel_get_next_sample(float *left, float *right, struct channel_t *chan) float l, r; l = chan->sound.left[chan->pos]; r = chan->sound.right[chan->pos]; - *left = volume * l; - *right = volume * r; + + float pan_l = ((float)p_atomic_int_get(&(chan->pan_left)))/128; + float pan_r = ((float)p_atomic_int_get(&(chan->pan_right)))/128; + float gain_ll, gain_lr, gain_rl, gain_rr; + pan_gain(&gain_ll, &gain_lr, pan_l); + pan_gain(&gain_rl, &gain_rr, pan_r); + + *left = volume * ((gain_ll * l) + (gain_rl * r)); + *right = volume * ((gain_lr * l) + (gain_rr * r)); } chan->pos += 1; |