How to calculate the right input buffer size

3 views
Skip to first unread message

Barzo

unread,
Sep 30, 2010, 4:10:10 AM9/30/10
to
Hi,

I'm using DSound to record and manipulate audio data. I need to
calculate the right size of my input buffer since I think I'm using a
too large buffer.

Now I'm using the following:

LONG AvgBytePerSec = (sample_rate_ * ((audio_params_.nChannels *
bits_per_sample_) / 8));
buffer_frames_ = static_cast<UINT16>(buffer_time_size_ *
AvgBytePerSec);
buffer_frames_ += (buffer_frames_ % 2);
buffer_frames_ /= audio_params_.nChannels;

For a 2ch 8Khz 32bit (I use float) with a time_size of 0,04 I have a
buffer of 1280 byte.
Now, can I use a smaller one? There are some constraints?

Regards,
Daniele.

Reply all
Reply to author
Forward
0 new messages