I do not mean play a sound is cost a lot.
I mean the first time I play a sound, I read the sound file into memory by my IO and register the sound resource. Then call createSound to create a FMOD::Sound. This process is a little slow.
Such as the first time triggering a effect animation, we load a lot of stuff like particle,testure, mesh except sound.So I want as far as possilbe to shorten the loading time.
That’s I mean Is there a settings or parameters something can make it faster?
I think about using FMOD_FILE_ASYNCREADCALLBACK once,just want to have a try.But I don’t find the asyncio example.
That is not what the asyncio example is for, that is for deferred file read callbacks which are a different topic all together. It should probably be called job_based_io or deferred_io or something to avoid confusion.
Simply add FMOD_NONBLOCKING to your createStream/Sound call, to make the loading operation happen in the background.
Sound::getState can be used to determine when it is ready, or you can just keep calling System::playSound until it succeeds with FMOD_OK (instead of FMOD_ERR_NOTREADY).
Next, to reduce load time you can do 2 things.
Turn off file seeking to the end of the file, with FMOD_IGNORETAGS flag.
Turn off formats you don’t want to query, and just tell fmod what file format you are using, use FMOD_CREATESOUNDEXINFO::suggestedsoundtype for that, this will be your biggest speedup.
There will always be a delay between calling createSound/Stream and hearing it with playsound, but if you preload your sounds or streams, you won’t get a delay.
In fact I do not have any experience,I just hope to discuss it with others.
For 3D sound I just use a list to manage the FMOD::Sound*, put the most common one in front.
How to decide the size of the list? I mean a appropriate number.
But I still feel it’s a little slow when loading a new sound.I just use the default configuration such as FMOD_INIT_NORMAL and my file callbacks.Is there a settings or parameters something can make it faster?
What do you mean by ‘slow’? FMOD is used in many commercial games because it is low overhead, playing 1 sound is basically negligible. Are you doing something like accidently loading the same sound every single frame?
What metrics are you using to test performance? Playing 1 sound would execute about 3 DSP nodes which would add up to less than 0.05% of a current cpu including base overhead.
Please login first to submit.