pcm/Volume: add constant PCM_VOLUME_BITS
This commit is contained in:
parent
bfe020e06c
commit
316a25dead
|
@ -37,7 +37,7 @@ pcm_volume_change(typename Traits::pointer_type buffer,
|
||||||
|
|
||||||
sample = (sample * volume + pcm_volume_dither() +
|
sample = (sample * volume + pcm_volume_dither() +
|
||||||
PCM_VOLUME_1S / 2)
|
PCM_VOLUME_1S / 2)
|
||||||
/ PCM_VOLUME_1S;
|
>> PCM_VOLUME_BITS;
|
||||||
|
|
||||||
*buffer++ = PcmClamp<F, Traits>(sample);
|
*buffer++ = PcmClamp<F, Traits>(sample);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.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".
|
* This value means "100% volume".
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue