diff options
Diffstat (limited to '')
-rw-r--r-- | src/pcm_utils.h | 10 |
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); |