2.02.01 - bug in registerCodec?

I appear to have run into a bug while experimenting with custom codecs earlier today: calling registerCodec always seems to return FMOD_ERR_PLUGIN_VERSION, regardless of whether the apiversion field of the given FMOD_CODEC_DESCRIPTION struct is set to FMOD_CODEC_PLUGIN_VERSION or not. Interestingly though, custom codecs seem to work fine when loaded as a separate DLL via loadPlugin.
I’ve managed to reproduce this with both my own codec plugin and the included fmod_codec_raw.cpp example (completely unmodified), with both MSYS2 MinGW and VS 2019.

Is this a bug or have I managed to miss something here?

Thanks for flagging this, it looks like the registerCodec call hasn’t been updated to copy the apiversion field which was added to FMOD_CODEC_DESCRIPTION fairly recently.
I’ll make a task for the dev team to fix that for a later release, in the meantime loadPlugin is working fine with dlls (as you’ve noticed) so hopefully that doesn’t get too inconvenient until we’ve got a fix.

1 Like

Fortunately the inconvenience isn’t much more than writing a few more lines of CMake so I can deal with this workaround for now :smiley:
Thanks for confirming and raising this, greatly appreciated!

A much belated thank you for fixing the bug - and an apology for bumping this somewhat old thread… however I have noticed another minor mistake with codec stuff (present in the latest release, 2.02.04):

In fmod_codec.h,

#define FMOD_CODEC_METADATA(_state, _tagtype, _name, _data, _datalen, _datatype, _unique) \
    (_state)->functions->metadata(_size, _tagtype, _name, _data, _datalen, _datatype, _unique)
//                                ^^^^^ here

The first parameter passed to the function in the definition should be _state, not _size. Fortunately this one is easily worked around by just re-#defineing it correctly.

Cheers… and thanks for the great audio library!

Thanks for flagging, I have passed this along to the Dev team to fix up!

1 Like