pcm/Volume: add constant PCM_VOLUME_BITS

This commit is contained in:
Max Kellermann 2013-12-22 17:37:36 +01:00
parent bfe020e06c
commit 316a25dead
2 changed files with 6 additions and 1 deletions

View File

@ -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);
}

View File

@ -26,6 +26,11 @@
#include <stdint.h>
#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".
*/