0
0

I have implemented the getlength callback in a codec like so:

[code:24cwnrzm]
FMOD_RESULT F_CALLBACK getlength(FMOD_CODEC_STATE codec, unsigned int *length, FMOD_TIMEUNIT lengthtype)
{
gameplugin
gp = (gameplugin*)codec->plugindata;

printf("lengthtype: %i ",lengthtype);

if(lengthtype==FMOD_TIMEUNIT_MS)
{
    //this is never executed
    return FMOD_OK;
}
else if(lengthtype==FMOD_TIMEUNIT_SUBSONG)
{
    //this works fine
    return FMOD_OK;
}
else
{
    return FMOD_ERR_UNSUPPORTED;
}

}
[/code:24cwnrzm]

I defined FMOD_TIMEUNIT_SUBSONG myself. If I however call getLength with FMOD_TIMEUNIT_MS my getlength function is never executed. What’s up with that? I mean it won’t even do the printf.

  • You must to post comments
0
0

did you specify that your codec can take ALL of the nescessary timeunits in
FMOD_CODEC_DESCRIPTION::timeunits ?

If not it will filter them out. You may have just done timeunits = FMOD_TIMEUNIT_SUBSONG and not or’ed in the others.

  • You must to post comments
0
0

Yes, I have FMOD_TIMEUNIT_MS|FMOD_TIMEUNIT_SUBSONG in the codec description.

  • You must to post comments
0
0

The time unit FMOD_TIMEUNIT_MS is handled internally, it will base the result on on the length and frequency of the sound. If you need a millisecond time unit that will flow to your codec you should use a custom name like you have done with "subsong".

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.