Answered
0
0

Sometimes,the function returns 0,but obviously the event timeline length is not 0.

ERRCHECK( explosionDescription->loadSampleData() );
ERRCHECK(system->flushCommands());
ERRCHECK(explosionDescription->isStream(&ss));
FMOD_STUDIO_LOADING_STATE s;
ERRCHECK(explosionDescription->getSampleLoadingState(&s));
int dd = -1;
ERRCHECK(explosionDescription->getLength(&dd));

ss is false and s is loaded,but dd is still 0.

==========================

And below is my fmod init code:

void *extraDriverData = NULL;
Common_Init(&extraDriverData);

FMOD::Studio::System* system = NULL;
ERRCHECK( FMOD::Studio::System::create(&system) );

// The example Studio project is authored for 5.1 sound, so set up the system output mode to match
FMOD::System* lowLevelSystem = NULL;
ERRCHECK( system->getLowLevelSystem(&lowLevelSystem) );
ERRCHECK( lowLevelSystem->setSoftwareFormat(0, FMOD_SPEAKERMODE_5POINT1, 0) );

ERRCHECK( system->initialize(32, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL, extraDriverData) );
  • You must to post comments
Good Answer
1
0

Have you checked the return value from Studio::EventDescription::getLength? Perhaps there was an error.

  • Danny

    I checked it,but no error happened.I have posted my code above.

  • Graeme Webb

    In your code, is explosionDescription referring to the “Single Explosion” event in the Studio examples project? If so, then its timeline is empty, and thus Studio::EventDescription::getLength should return 0.

    Note that Studio::EventDescription::getLength returning 0 doesn’t necessarily mean that the event won’t play anything. It just means there are no sounds on the timeline. In the explosion example, it has sounds on the “Size” parameter and these will play according to the parameter’s value.

    So Studio::EventDescription::getLength is just an informational function, telling you how long the timeline will tick before it runs out. The actual length of time that an event plays can vary according to the parameter values, transitions, loops, sustain points, pitch, AHDSR, etc.

  • Li Senlin

    Hi Graeme,

    Is there a way to get the actual length of time from the Size parameter?
    I also have this problem, we put the sound source to an extra parameter, but we must get the actual length of the time.

    Thanks.

  • Cameron Baron

    Unfortunately there are too many factors to take into account to determine the length of an event when it comes to instruments on parameters. We can only provide the length of the timeline.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.