Jump to content
  • Advertisement
Sign in to follow this  
munawar

[SLIMDX] EndOfStreamException when writing to DirectSound.SoundBuffer

This topic is 3320 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Occasionally when I write to the SoundBuffer object using the overloaded method that takes in five parameters--the data array, the start position of the array, the total number of bytes I want to write, the position at which to start writing in the SoundBuffer, and the lock flag, I get an EndOfStreamException: Tried to read beyond the end of the stream error. I've checked all my values by having the program display the data stream length, current position, number of bytes to write, etc, and it doesn't appear as if I'm going beyond the bounds of data[]. Could this be a SlimDX issue? I don't want to post my code here since it's pretty long but if a SlimDX developer wants to take a look at it, let me know and i'll send it to you. I found an issue in the SlimDX tracker that talked about datastreams returning wrong values on occasion, so could this bug be effecting DirectSound as well? Thanks much for your assistance! Munawar

Share this post


Link to post
Share on other sites
Advertisement
Hi,
As a follow up, here is the stack trace and additional information:
Attempted to read past the end of the stream.

at SlimDX.DataStream.WriteRange[T](T[] data, Int32 offset, Int32 count) in d:\promit\documents\slimdx\main\trunk\source\datastream.cpp:line 246
at SlimDX.DirectSound.SoundBuffer.Write[T](T[] data, Int32 startIndex, Int32 count, Int32 bufferOffset, LockFlags flags) in
d:\promit\documents\slimdx\main\trunk\source\directsound\soundbuffer.cpp:line 118

Here are the values I supplied to the .Write() method:
Start position = 105600.
and the total stream length is 2257920

Number of bytes to write = 286.
Start writing at the SoundBuffer position 52680

Sound buffer size = 52920

A quick note, because the number of bytes to write is 280 something, the method may write "off the buffer's end" but since buffers are circular this shouldn't be a problem (please correct me if I'm wrong on this). The sound buffer is looping as well--I'm streaming a sound that is too big to load all at once. Hope this helps.
Munawar

Share this post


Link to post
Share on other sites
DataStream can't handle circular buffers. Maybe it should? I'm not too familiar offhand with this part of DSound. In any case, you'll have to break your write manually for the time being.

Share this post


Link to post
Share on other sites
Hi,
One more thing to add to this thread: when I write data to a buffer all at once--in the case of a small sound--everything works fine. So I'm getting more convinced that this error is being thrown when SlimDX tries to write past the end of the Sound Buffer object.

Anyway, I'm using the Ogg Player from Tray Games (sorry if I spelled that wrong) to stream the Ogg file in the program. If anyone knows of an open source .NET based ogg decoder than can do all of the following (or can with little modification) please let me know:
Play a sound, change volume on a sound while it is playing, loop the sound, and stop the sound. Again I doubt it's the library that's the issue (according to the output I provided above) but I'm willing to try other options if anyone knows of any.
Thanks all for your tons of hlep you've given me in the past and now, I really appreciate it!
Munawar

Share this post


Link to post
Share on other sites
We're looking into this. Forum threads are difficult to keep track of, so I've filed an issue on our issue tracker here. You can subscribe to that issue to receive updates whenever we make progress.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!