Programmer Sounds length is always 0

Hi,

I’m trying to programmatically get an async programmer sound length by doing:
RuntimeManager.StudioSystem.getSoundInfo(key, out var dialogueSoundInfo);
RuntimeManager.CoreSystem.createSound(dialogueSoundInfo.name_or_data, dialogueSoundInfo.mode, ref dialogueSoundInfo.exinfo, out var dialogueSound);
dialogueSound.getLength(out var length, TIMEUNIT.MS);

but I always get a value of 0.

My code is based on this example: https://www.fmod.com/resources/documentation-unity?version=2.1&page=examples-programmer-sounds.html

Any help would be much appreciated! Thanks

Hi, can you try getting the target subsound and measuring that? I think the parent sound represents the bank itself if I’m not mistaken.

dialogueSound.getSubSound(dialogueSoundInfo.subsoundindex, out var subSound);
subSound.getLength(out var length, TIMEUNIT.MS);
1 Like

That worked! Thank you so much @aishi

1 Like

You’re welcome! It’s great timing because I also just solved a related issue in my project.

1 Like