aboutsummaryrefslogtreecommitdiff
path: root/src/pcm_utils.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-11 16:32:32 +0100
committerMax Kellermann <max@duempel.org>2008-11-11 16:32:32 +0100
commitedcd45df94bf69b78342943cd319d8ceb43ed6d1 (patch)
treed70e37392d8f51131563e16bf33668ba56f28d3e /src/pcm_utils.h
parentad77a3e0ace2bb082bc619de1c6d8732715e8977 (diff)
pcm_volume: added constant PCM_VOLUME_1
It may be desirable to change the range of integer volume levels (e.g. to 1024, which may utilize shifts instead of expensive integer divisions). Introduce the constant PCM_VOLUME_1 which describes the integer value for "100% volume". This is currently 1000.
Diffstat (limited to 'src/pcm_utils.h')
-rw-r--r--src/pcm_utils.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pcm_utils.h b/src/pcm_utils.h
index 069fb9f5..71398c01 100644
--- a/src/pcm_utils.h
+++ b/src/pcm_utils.h
@@ -27,6 +27,11 @@
struct audio_format;
+enum {
+ /** this value means "100% volume" */
+ PCM_VOLUME_1 = 1000,
+};
+
struct pcm_convert_state {
struct pcm_resample_state resample;
@@ -43,7 +48,7 @@ struct pcm_convert_state {
static inline int
pcm_float_to_volume(float volume)
{
- return volume * 1000.0 + 0.5;
+ return volume * PCM_VOLUME_1 + 0.5;
}
void pcm_volume(char *buffer, int bufferSize,