From 2650b9eb318a9eec0c45757624debf363aa156f9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:09 +0200 Subject: 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. --- src/audio_format.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/audio_format.h') diff --git a/src/audio_format.h b/src/audio_format.h index ba22b3bf..a6e97e04 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; -- cgit v1.2.3