SFML community forums
Help => Audio => Topic started by: zill on October 14, 2008, 04:27:42 am
-
I don't know what I'm doing wrong with OpenFromMemory, but it won't work.
I read out the entire .ogg from memory into a char buffer and call OpenFromMemory with that buffer and the number of bytes read from memory. When I try to play the sound it freezes my computer.
However, when I make an .ogg file out of what I have read and then play it, it works fine.
What am I doing wrong?
-
Are you keeping the contents of your ogg file in memory while the music is playing ? sf::Music uses streaming, which means the source data is not copied but rather directly accessed several times while the music is playing.
-
I wasn't at the time, but I figured out shortly after that that was probably what was happening.
I just made a struct to store the ogg contents and the music pointer.
Thank you.