diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:09 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:09 +0200 |
commit | 2650b9eb318a9eec0c45757624debf363aa156f9 (patch) | |
tree | 244afbf2e28d80a1f33e27e49bb3173ba448d8db /src/audio_format.h | |
parent | 0aedf7dd5a3f72a1c541085c513d2b85bc3bff58 (diff) | |
download | mpd-2650b9eb318a9eec0c45757624debf363aa156f9.tar.gz mpd-2650b9eb318a9eec0c45757624debf363aa156f9.tar.xz mpd-2650b9eb318a9eec0c45757624debf363aa156f9.zip |
added inline function audio_format_time_to_size()
Make the code more readable by hiding big formulas in an inline
function with a nice name.
Diffstat (limited to 'src/audio_format.h')
-rw-r--r-- | src/audio_format.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/audio_format.h b/src/audio_format.h index ba22b3bf6..a6e97e046 100644 --- a/src/audio_format.h +++ b/src/audio_format.h @@ -27,6 +27,11 @@ typedef struct _AudioFormat { volatile mpd_sint8 bits; } AudioFormat; +static inline double audio_format_time_to_size(const AudioFormat * af) +{ + return af->sampleRate * af->bits * af->channels / 8.0; +} + static inline double audioFormatSizeToTime(const AudioFormat * af) { return 8.0 / af->bits / af->channels / af->sampleRate; |