audio_format: added audio_format_frame_size()

A frame contains one sample per channel, thus it is sample_size *
channels.  This patch includes some cleanup for various locations
where the sample size for 24 bit audio was still 3 bytes (instead of
4).
This commit is contained in:
Max Kellermann
2008-10-10 14:41:37 +02:00
parent de2cb3f375
commit 96155a3376
5 changed files with 12 additions and 7 deletions

View File

@@ -40,7 +40,7 @@ Timer *timer_new(const struct audio_format *af)
timer = xmalloc(sizeof(Timer));
timer->time = 0;
timer->started = 0;
timer->rate = af->sample_rate * (af->bits / CHAR_BIT) * af->channels;
timer->rate = af->sample_rate * audio_format_frame_size(af);
return timer;
}