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

Commented Issue: WaveFileChunkReader.ReadWaveHeader assumes that the stream supports position/seek [16354]

$
0
0
I am using this class to read a wave stream but the derived stream class that I am using that contains the wave does not support setting the Postion (CanSeek == false).
public void ReadWaveHeader(Stream stream)
{ ...
while (stream.Position <= stopPosition - 8)
{...
stream.Position += chunkLength; //This line throws an expection.
}
...
}
Is it posible to use another metholody to read the wave that is not based on Postion? or is there another alternative?
Comments: Thank you for your answer. I can add some code so you can see it. The wave files are in a zip file, what I am doing is reading each wav from the zip directly to a stream (this is my business requirement, no file should copied to the hard drive) using codeplex DOTNETZIP. This is all work good expect that the stream class used by DONEZIP does not support Position/Seek (CanSeek == false). The class name is CrcCalculatorStream. I tried to change the WaveFileChunkReader class to do a stream.Read(buffer, 0, chunkLength); instead of a stream.Position += chunkLength; but after a few reads I get this error ex.Message = "Specified argument was out of the range of valid values.\r\nParameter name: count". You said "(just does read), and stops before going past the data chunk" how do I do that?

Viewing all articles
Browse latest Browse all 738

Trending Articles



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