# When does the Studio::EventDescription::getLength return 0?

**URL:** <https://qa.fmod.com/t/when-does-the-studio-getlength-return-0/12277>\
**Category:** FMOD Studio\
**Created:** [January 27, 2016, 7:13am UTC](https://qa.fmod.com/t/when-does-the-studio-getlength-return-0/12277 "2016-01-27T07:13:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wubugui](https://avatars.discourse-cdn.com/v4/letter/w/dc4da7/32.png) [@wubugui](https://qa.fmod.com/u/wubugui)\
**Post date:** [January 27, 2016, 7:13am UTC](https://qa.fmod.com/t/when-does-the-studio-getlength-return-0/12277/1 "2016-01-27T07:13:26Z")

</div>

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) );
```

---

<div class="post-metadata">

**Author:** ![graeme](https://avatars.discourse-cdn.com/v4/letter/g/50afbb/32.png) [@graeme](https://qa.fmod.com/u/graeme)\
**Post date:** [January 28, 2016, 2:28am UTC](https://qa.fmod.com/t/when-does-the-studio-getlength-return-0/12277/2 "2016-01-28T02:28:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wubugui](https://avatars.discourse-cdn.com/v4/letter/w/dc4da7/32.png) [@wubugui](https://qa.fmod.com/u/wubugui)\
**Post date:** [February 1, 2016, 1:37am UTC](https://qa.fmod.com/t/when-does-the-studio-getlength-return-0/12277/3 "2016-02-01T01:37:46Z")

</div>

> [@](#):
>
> Have you checked the return value from Studio::EventDescription::getLength? Perhaps there was an error.

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

---

<div class="post-metadata">

**Author:** ![graeme](https://avatars.discourse-cdn.com/v4/letter/g/50afbb/32.png) [@graeme](https://qa.fmod.com/u/graeme)\
**Post date:** [February 1, 2016, 6:39am UTC](https://qa.fmod.com/t/when-does-the-studio-getlength-return-0/12277/4 "2016-02-01T06:39:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lisenlin](https://avatars.discourse-cdn.com/v4/letter/l/a88e4f/32.png) [@lisenlin](https://qa.fmod.com/u/lisenlin)\
**Post date:** [January 29, 2018, 3:29am UTC](https://qa.fmod.com/t/when-does-the-studio-getlength-return-0/12277/5 "2018-01-29T03:29:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [February 2, 2018, 5:46am UTC](https://qa.fmod.com/t/when-does-the-studio-getlength-return-0/12277/6 "2018-02-02T05:46:01Z")

</div>

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.
