SFML community forums

Help => Audio => Topic started by: kr3nshaw on April 29, 2019, 12:43:15 pm

Title: Exception thrown: read access violation. stream-> was nullptr.
Post by: kr3nshaw on April 29, 2019, 12:43:15 pm
I'm writing a class that inherits from InputStream so that I can read from custom archive formats. When I try and play a music file from the archive, the program crashes with the message shown in the subject. The source is ThreadFunc in Thread.inl. I know that the file loads successfully, because if I put a breakpoint in read, I can see the audio library moving around in the file. However, it always crashes after a few calls to read.
Title: Re: Exception thrown: read access violation. stream-> was nullptr.
Post by: Laurent on April 29, 2019, 12:55:44 pm
Probably related to this:

Quote from: documentation
Warning

Since the music is not loaded at once but rather streamed continuously, the stream must remain accessible until the sf::Music object loads a new music or is destroyed.