0
0

Dear all,

Fisrt of all, thanks to the fmod team for the amazing work done with the studio API.

We are running into an issue about sound desynchronised.
The following trace gets printed :
-> FMOD: SoundSourceInstrumentInstance::startChannelIfReady : Loading delay exceeded, sound may play at incorrect time

Does anyone know if there a special flag to increase the allowed loading time or if this issue rings a bell ?

We are running the following code (extracted from the samples):
[code:2f6tuh3g]
FMOD::Studio::System system;
FMOD_RESULT result = FMOD::Studio::System::create(&system);
_ERRCHECK(result);

    void *extraDriverData = 0;
    result = system.initialize(32, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL, extraDriverData);
    _ERRCHECK(result);
    const char* bankPath = _mediaPath([localMusic.bank UTF8String]);

    FMOD::Studio::Bank masterBank;
    _ERRCHECK( system.loadBank(bankPath, &masterBank) );

    const char* eventGUID = [localMusic.mainEventGUID UTF8String];

    FMOD::Studio::ID eventID = {0};
    _ERRCHECK( FMOD::Studio::parseID(eventGUID, &eventID) );

    FMOD::Studio::EventDescription eventDescription;
    _ERRCHECK( system.getEvent(&eventID, FMOD_STUDIO_LOAD_BEGIN_NOW, &eventDescription) );

    FMOD::Studio::EventInstance eventInstance;
    _ERRCHECK( eventDescription.createInstance(&eventInstance) );
    _ERRCHECK( eventInstance.start() );

    result = system.update();

[/code:2f6tuh3g]

  • You must to post comments
0
0

We do plan to make the loading time configurable, but unfortunately this is not implemented yet. However, you can probably solve your problem by waiting for the samples to load before you start the event instance. Samples start loading when you first create an instance of an event, so you can wait for them to load with code like the following:

[code:1op09hfh]
FMOD::Studio::EventInstance eventInstance;
_ERRCHECK( eventDescription.createInstance(&eventInstance) );

FMOD_STUDIO_LOADING_STATE state = FMOD_STUDIO_LOADING_STATE_LOADING;
_ERRCHECK(eventInstance.getLoadingState(&state));

while (state == FMOD_STUDIO_LOADING_STATE_LOADING)
{
Sleep(1);
_ERRCHECK(eventInstance.getLoadingState(&state));
}

_ERRCHECK( eventInstance.start() );
[/code:1op09hfh]
This is just demonstration code – obviously you don’t want to block the main thread waiting for samples to load. However, you could add your event instances to a list and poll their loading state each frame. We are considering implementing this logic internally, so EventInstance::start() waits for samples to finish loading before actually starting the event.

If you want to load all the samples in a bank, you can use Bank::loadSampleData() and Bank::getSampleLoadingState() in a similar manner.

  • You must to post comments
0
0

Thanks a lot for the quick feedback, it works like a charm :)

  • You must to post comments
0
0

I’m glad to hear it! I’ll mark this topic as resolved.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.