GetLength from Event with Parameter

Hello,

I have easy task: GetLength.

voiceNew = RuntimeManager.CreateInstance ("event:/Voiceovers/voice1");
voiceNew.start ();
voiceNew.setParameterByName ("Language", voiceID);
voiceNew.getDescription(out EventDescription ed);
ed.getLength(out int len);
//len=0 everytime

This code works fine for simple event, but event with Parameter return 0.

I have one event with few languages and switch after start.
Parameter type = labeled.

Hi,

Thank you for sharing the information and screenshot.

Studio::EventDescription::getLength only returns the length of the timeline. If your event doesn’t have any content placed directly on the timeline (e.g., it uses parameter sheets or instruments triggered by parameters), then this function will return 0.

There’s a similar discussion here: EventDescription length always zero - #2 by Leah_FMOD

If restructuring your event to use the timeline isn’t feasible, you might consider using the SOUND_PLAYED callback. This allows you to access the underlying FMOD::Sound object and retrieve its length during playback.

You can find more details and sample code in this thread:: How to retrieve a sound total time/length/duration? - #4 by jeff_fmod

Hope this helps, let me know if you have questions.