Commit 316a25de authored by Max Kellermann's avatar Max Kellermann

pcm/Volume: add constant PCM_VOLUME_BITS

parent bfe020e0
......@@ -37,7 +37,7 @@ pcm_volume_change(typename Traits::pointer_type buffer,
sample = (sample * volume + pcm_volume_dither() +
PCM_VOLUME_1S / 2)
/ PCM_VOLUME_1S;
>> PCM_VOLUME_BITS;
*buffer++ = PcmClamp<F, Traits>(sample);
}
......
......@@ -27,6 +27,11 @@
#include <stddef.h>
/**
* Number of fractional bits for a fixed-point volume value.
*/
static constexpr unsigned PCM_VOLUME_BITS = 10;
/**
* This value means "100% volume".
*/
static constexpr unsigned PCM_VOLUME_1 = 1024;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment