aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_volume.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-10-20 02:33:51 +0200
committerMax Kellermann <max@duempel.org>2011-10-20 02:33:51 +0200
commitbfef0fbff34e80a86d7b740eace597efe52136e1 (patch)
treee962439504e4bd9874be40b243aab859066c960f /src/pcm_volume.h
parent545685bc3209d9cfdf6c4b9aeee4715edd453dc1 (diff)
downloadmpd-bfef0fbff34e80a86d7b740eace597efe52136e1.tar.gz
mpd-bfef0fbff34e80a86d7b740eace597efe52136e1.tar.xz
mpd-bfef0fbff34e80a86d7b740eace597efe52136e1.zip
pcm_volume: implement float samples
Diffstat (limited to 'src/pcm_volume.h')
-rw-r--r--src/pcm_volume.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pcm_volume.h b/src/pcm_volume.h
index 741c4db40..64e3c7641 100644
--- a/src/pcm_volume.h
+++ b/src/pcm_volume.h
@@ -43,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().