aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_utils.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-11 16:29:02 +0100
committerMax Kellermann <max@duempel.org>2008-11-11 16:29:02 +0100
commitad77a3e0ace2bb082bc619de1c6d8732715e8977 (patch)
tree7068492d1cc15419a613acb00953760fee64f99c /src/pcm_utils.h
parent5ddde0aac790c57b75f20ce71e100f4379f1c653 (diff)
downloadmpd-ad77a3e0ace2bb082bc619de1c6d8732715e8977.tar.gz
mpd-ad77a3e0ace2bb082bc619de1c6d8732715e8977.tar.xz
mpd-ad77a3e0ace2bb082bc619de1c6d8732715e8977.zip
pcm_utils: added inline function pcm_float_to_volume()
Diffstat (limited to '')
-rw-r--r--src/pcm_utils.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pcm_utils.h b/src/pcm_utils.h
index 1668bbf0c..069fb9f53 100644
--- a/src/pcm_utils.h
+++ b/src/pcm_utils.h
@@ -36,6 +36,16 @@ struct pcm_convert_state {
int error;
};
+/**
+ * Converts a float value (0.0 = silence, 1.0 = 100% volume) to an
+ * integer volume value (1000 = 100%).
+ */
+static inline int
+pcm_float_to_volume(float volume)
+{
+ return volume * 1000.0 + 0.5;
+}
+
void pcm_volume(char *buffer, int bufferSize,
const struct audio_format *format,
int volume);