code cleanup based on speex

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6194 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty
2004-01-20 09:55:07 +00:00
parent e248c06496
commit 8000f68ada
@@ -17,9 +17,10 @@
#define DECODE_BUFFER_SIZE (32 * 1024)
inline size_t
AudioBufferSize(int32 channel_count, uint32 sample_format, float frame_rate, bigtime_t buffer_duration = 50000 /* 50 ms */)
AudioBufferSize(media_raw_audio_format * raf, bigtime_t buffer_duration = 50000 /* 50 ms */)
{
return (sample_format & 0xf) * channel_count * (size_t)((frame_rate * buffer_duration) / 1000000.0);
return (raf->format & 0xf) * (raf->channel_count)
* (size_t)((raf->frame_rate * buffer_duration) / 1000000.0);
}
vorbisDecoder::vorbisDecoder()
@@ -106,10 +107,10 @@ void vorbisDecoder::CopyInfoToDecodedFormat(media_raw_audio_format * raf) {
raf->byte_order = B_MEDIA_HOST_ENDIAN; // XXX should support other endain, too
if (raf->buffer_size < 512 || raf->buffer_size > 65536) {
raf->buffer_size = AudioBufferSize(raf->channel_count,raf->format,raf->frame_rate);
raf->buffer_size = AudioBufferSize(raf);
}
// setup output variables
fFrameSize = (raf->format & 0xf) * fInfo.channels;
fFrameSize = (raf->format & 0xf) * raf->channel_count;
fOutputBufferSize = raf->buffer_size;
}