0
0

Good morning,

i want to know the length of a audio file (.wav) BEFORE i am trying to play it. I need the information and don’t want to introduce all the overhead with creating a sound and then getting the length from that (i guess i need to really create/play it muted and then call on the fmod-sound getlength.. but maybe that is what one needs to do nonetheless, so for that i need to know how costly it is to create/check the sound instead of compiling a list of all sound-lengths in advance)

so what would be the best/fastest way to get the length for them?

:) thanks a lot for your answers!

regards,
black-l

  • You must to post comments
0
0

You could just read the header in yourself and process it. It’s about 30ish bytes long, and well documented on the interweb.

  • You must to post comments
0
0

Would this change though if we pass in flags to use simple headers, or survive future fmod version updates? (what i mean is FSBs)

  • You must to post comments
0
0

I would prefer this, it’s fast and works for all supported file formats:

system->createStream("filename.wav", FMOD_OPENONLY, 0, &sound);
sound->getLength(&lengthms, FMOD_TIMEUNIT_MS);
sound->release();

if it needs to be very very fast then I would check the wav header myself as a1psx recommended

  • You must to post comments
0
0

thank you very much :)

cheers!

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.