0
0

In reviewing the sample code for playsound and loadfrommemory, it seems like the principle difference is being able to use different arguments (that I admittedly don’t fully understand) when calling createSound()

loadfrommemory example:
[code:21ybpylv]result = system->createSound((const char *)filebuff, FMOD_SOFTWARE | FMOD_OPENMEMORY, &exinfo, &sound1);[/code:21ybpylv]

vs.

playsound example:
[code:21ybpylv]result = system->createSound(buffer, FMOD_SOFTWARE, NULL, &sound1);[/code:21ybpylv]

otherwise the functionality seems to be the same: holding a reference to a sound in your resource library such that you can play it whenever you want using the playSound method. can someone break down when one might use the loadfrommemory example and when one might use the playsound example. thanks in advance :)

  • You must to post comments
0
0

cool! thanks for the detailed answer.

  • You must to post comments
0
0

[quote:1g8kmxki]can someone break down when one might use the loadfrommemory example and when one might use the playsound example.[/quote:1g8kmxki]
The only difference is that one is loaded from disk and the other is loaded from memory. An example: Say you have an engine which takes care of all the disk access through some prioritized loading system. In that case you don’t want FMOD to jump in and start reading directly from the disc, instead you load the file yourself into memory and tell FMOD "here is your data, load it from memory". Another example is if you have a pack format were all the game data is zipped up to save space, you can unzip the file into memory and let FMOD load it from there. The way the OPEN_MEMORY flag works is FMOD will copy that block of memory before it starts using it, if you would rather it just used that memory directly you can use OPEN_MEMORY_POINT.

[quote:1g8kmxki]otherwise the functionality seems to be the same: holding a reference to a sound in your resource library such that you can play it whenever you want using the playSound method.[/quote:1g8kmxki]
Yes that is the goal, the interface similar to make it user friendly.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.