1
Audio / [SOLVED]Trouble loading audio from memory.
« on: March 05, 2014, 09:31:28 am »
Hello all, I've been using sfml for the development of a game, and I've been loving it so far (API Design, Documentation, ease of use, everything).
But now I've ran into the first big problem which I really can't find out how to solve, and I really hope somebody can help me with this. So let me start explaining:
On this point of the development we've decide to design our own binary file format to store resources - sounds and images used to just lay around - and make the game read and load resources from our files.
It works perfectly with images, but with sounds - music specifically - I get this error:
What I do is, I find the ogg music inside the file, load it to a buffer - as I understand, a soundstream needs it's source to be kept in memory for access - and tell sf::Music to load it with openFromMemory(), and that's where I get the error.
Important notes:
- The original ogg music files did play inside the game, when we were using openFromFile()
- I do not believe the music data can be messed up inside our file. I use the same process for Images - which works inside the game - and I even extracted a music file back -by the same means I use to load it into the game- to test. I can load and play this extracted file inside the game with openFromFile(), just like the original file. I even did a checksum on it with the original file, and they did match. So I really don't get why openFromMemory() can't load and play it.
-I haven't tested with non-stream sounds yet, don't know if I'd get a different result. I'll update this when I test.
I'm really sorry if my english is monstrously bad, and thanks in advance
But now I've ran into the first big problem which I really can't find out how to solve, and I really hope somebody can help me with this. So let me start explaining:
On this point of the development we've decide to design our own binary file format to store resources - sounds and images used to just lay around - and make the game read and load resources from our files.
It works perfectly with images, but with sounds - music specifically - I get this error:
Quote
Failed to open sound file from memory (Supported file format but file is malformed.)
What I do is, I find the ogg music inside the file, load it to a buffer - as I understand, a soundstream needs it's source to be kept in memory for access - and tell sf::Music to load it with openFromMemory(), and that's where I get the error.
Important notes:
- The original ogg music files did play inside the game, when we were using openFromFile()
- I do not believe the music data can be messed up inside our file. I use the same process for Images - which works inside the game - and I even extracted a music file back -by the same means I use to load it into the game- to test. I can load and play this extracted file inside the game with openFromFile(), just like the original file. I even did a checksum on it with the original file, and they did match. So I really don't get why openFromMemory() can't load and play it.
-I haven't tested with non-stream sounds yet, don't know if I'd get a different result. I'll update this when I test.
I'm really sorry if my english is monstrously bad, and thanks in advance