Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Created Issue: WaveIn.CreateBuffers() Calculating bufferSize returns odd length for 16 bit samples [16352]

$
0
0
The default "BufferMilliseconds" is 100ms.

int bufferSize = BufferMilliseconds * WaveFormat.AverageBytesPerSecond / 1000;

For a 11,025 sample rate, 16 bit format, bufferSize = 2205, which is incorrect.

Suggested Fix:
int bufferSize = BufferMilliseconds * WaveFormat.AverageBytesPerSecond / 1000;

if (bufferSize % WaveFormat.BlockAlign != 0)
{
bufferSize -= bufferSize % WaveFormat.BlockAlign;
}

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>