Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

Commented Issue: WaveOutBuffer.OnDone - set header.bufferLength = bytes? [16340]

$
0
0
I ran into a problem using WaveOut to play a WaveFormatConversionStream. It appears that WaveFormatConversionStream.Read is consistently reading only 4072 bytes into a 4800 byte buffer, but that discrepancy is not getting passed on to the WaveInterop.waveOutWrite call. I modified the WaveOutBuffer.OnDone method as follows

header.bufferLength = bytes; // fix
WriteToWaveOut();

Not sure of any negative side effects, but it seems to work so far.
Comments: if the wavestream given to the IWaveOut implementer is unable to provide the full number of bytes requested in Read, then effectively your latency is changed. I did it this way to ensure that badly behaving input streams don't cause hundreds of really small buffers to be sent to waveOutWrite. You could use BlockAlignReductionStream which has some built-in buffering.

Viewing all articles
Browse latest Browse all 5831

Trending Articles



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