SFML community forums
General => General discussions => Topic started by: nietaki on March 13, 2012, 11:38:23 pm
-
Just a quick question: is the fact, that Music's loading functions begin with "open" and all the other classes (Image, Font, SoundBuffer) have their corresponding functions beginning with "load" deliberate? Why the inconsistency? Is there a reason behind it I failed to grasp?
By the way: if all the Image, Font, Music... classes inherited the same abstract interface class like "Loadable" it could sometimes save people from writing the repetitive cod for each of them individually - but it might be another thing Laurent thought through and decided against :)
-
I'm pretty sure it's due to the fact that musics are opened and loaded chunk by chunk, not fully loaded when the function is used like for other resources :)
-
But I still can free the memory (data) after I call Music::openFromMemory(const void * data, std::size_t sizeInBytes ), right?
-
But I still can free the memory (data) after I call Music::openFromMemory(const void * data, std::size_t sizeInBytes ), right?
Hmm, sorry I don't know about that, I never load from memory.
Either wait for Laurent (he's so fast that he'll probably answer before you read this line so you won't wait for long :P), or try it out yourself by loading from memory and then overwriting the data?
-
Either wait for Laurent (he's so fast that he'll probably answer before you read this line so you won't wait for long :P), or try it out yourself by loading from memory and then overwriting the data?
If he doesn't respond by tommorow I'll try it out myself, I've just finished a big chunk of code and gave myself the rest of the day off ;)
Damn, the project I'm writing with SFML is the first one that ever gave me so much insight and fulfillment and we haven't even reached the fun part yet ;)
-
I'm pretty sure it's due to the fact that musics are opened and loaded chunk by chunk, not fully loaded when the function is used like for other resources
Correct.
But I still can free the memory (data) after I call Music::openFromMemory(const void * data, std::size_t sizeInBytes ), right?
No. Isn't it written in the doc?
-
But I still can free the memory (data) after I call Music::openFromMemory(const void * data, std::size_t sizeInBytes ), right?
No. Isn't it written in the doc?
It isn't, at least not explicitly - I read it once again and I still wouldn't be sure if not for your answer.
-
It isn't, at least not explicitly - I read it once again and I still wouldn't be sure if not for your answer.
I agree, I had checked the doc before answering and wasn't 100% sure about the behavior of music opening.
I also think the special status of sf::Music::openFrom* deserves a small mention in the doc of these methods.
-
Sorry, shame on me :(