SFML community forums

Help => Audio => Topic started by: zill on October 14, 2008, 04:27:42 am

Title: OpenFromMemory
Post 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?
Title: OpenFromMemory
Post by: Laurent on October 14, 2008, 08:22:41 am
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.
Title: OpenFromMemory
Post by: zill on October 18, 2008, 03:57:00 am
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.