diff options
Diffstat (limited to '')
-rw-r--r-- | src/pcm_volume.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/pcm_volume.h b/src/pcm_volume.h index eb61e9526..64e3c7641 100644 --- a/src/pcm_volume.h +++ b/src/pcm_volume.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2010 The Music Player Daemon Project + * Copyright (C) 2003-2011 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -21,6 +21,7 @@ #define PCM_VOLUME_H #include "pcm_prng.h" +#include "audio_format.h" #include <stdint.h> #include <stdbool.h> @@ -42,6 +43,12 @@ pcm_float_to_volume(float volume) return volume * PCM_VOLUME_1 + 0.5; } +static inline float +pcm_volume_to_float(int volume) +{ + return (float)volume / (float)PCM_VOLUME_1; +} + /** * Returns the next volume dithering number, between -511 and +511. * This number is taken from a global PRNG, see pcm_prng(). @@ -62,13 +69,13 @@ pcm_volume_dither(void) * * @param buffer the PCM buffer * @param length the length of the PCM buffer - * @param format the audio format of the PCM buffer + * @param format the sample format of the PCM buffer * @param volume the volume between 0 and #PCM_VOLUME_1 * @return true on success, false if the audio format is not supported */ bool -pcm_volume(void *buffer, int length, - const struct audio_format *format, +pcm_volume(void *buffer, size_t length, + enum sample_format format, int volume); #endif |