I’m using an app that uses fmod.dll (prod version 1.8.15). This app does not handle opus codec, but as far as I know fmod supports opus through a plugin. Where can I find that opus plugin, would this work without recompiling the app (e.g. by dropping whatever dll beside fmod.dll)?

Thank you

  • You must to post comments

Hi Pablo,
There’s no opus support or opus plugin that i’m aware of, unless a 3rd party has written one.
Its entirely possible to have a plugin that supports ogg? opus.. opus is a name for the combination of the low level silk/celt codecs , but its not a file format itself.

  • You must to post comments

it took me entire day to hard guessing how to write an opus module for fmod. It shouldn’t be overloaded with guesswork, for somebody not very familiar with how media works this would probably be impossible to do.

I deleted my rant comments, as these aren’t relevant to my original topic.
I strongly suggest to delete codec_raw example and rewrite it with codec_wav that would read a wave a file instead of raw pcm. This way, that sample would probably cover most of the basics. It should also make it clear that fmod codec is a format parser and/or decoder at the same time.

Another point… I always wasn’t too happy when some company uses 80 char limit per line or something like that. After working, with fmod I can definitely tell that important docs should never be endless lines that require horizontal scrolling.

  • Brett Paterson

    Hi Pablo
    Sorry you had trouble writing the codec, I had a look at fmod_codec_raw and yes it is ‘brief’, it from the look of it is also 13 years old, yikes! The codec plugin side of things aren’t used that often, so it doesnt get the same love as some of the other areas, like DSP plugins (that was just updated recently).

    Sounds like a good idea to put a more ‘complete’ codec in there, we could just take our current wav codec and strip it down a bit (because ours supports ACM and riff wrapped mp3, and all sorts of weird stuff).

    I’m not sure what you mean about the docs, if you work in markdown or html for example, its not the document’s job to word wrap for the user, its the viewer that is supposed to do that (so it is resolution independent), like our online docs at http://www.fmod.org/documentation or the .chm version with that viewer.

    We’d love to hear how we can improve the codec side of things, i’ll look at doing something for the next release, if you’d like please contact me at brett@fmod.com and we can try and make it better for the next release.

  • Pablo

    Hi Brett,

    sorry for delay, I’m working on my personal project and fmod plugin is a tiny piece of it and has no relationship to the core of what I do, so when i got it working I moved on to my next task :)

    So, as somebody who just recently suffered pain to get it working, I’ll share my thoughts. If fmod had a sample codec plugin that implements playback of some fairly simple stereo format it would make it simple to understand all the assumptions and details that fmod expects from a well behaved codec.
    Even a fmod “codec” plugin for a stereo wav file with a “null” decoder would be helpful. Perhaps, people are familiar with mp3, a sample mp3 codec plugin that uses lame or any other mp3 decoder could be added to samples.

    Some of the things that got me confused originally: mixing audio codec and format parser in one interface. wav “codec” would made it clear that fmod codec plugin is expected to do both of these tasks. Then along the way I had to guess stuff like what [FMOD_CODEC_READ_CALLBACK](https://www.fmod.org/docs/content/generated/FMOD_CODEC_READ_CALLBACK.html) expects. It passes `samples_in` and expects in return `samples_out`, however, looks like samples_in is raw count of samples (e.g. shorts for pcm16 output) and output should indicate how many samples of stereo data was read (e.g. I need to divide by channel count). Nothing in the docs indicates about that… did I even get it right? Without it sounds would be all electric and choppy.
    Then, when playback reaches EOF, it’s not clear what should be returned. Originally I returned samples_out=0 and FMOD_OK, but doesn’t seem like FMOD expects that. In fact, this way it easily deadlocks when I try to release a sound: I get deadlock from this call and it’s stuck on Sleep() loop, while in another fmod thread keeps reading my file that constantly returns 0 and FMOD_OK. Why I didn’t return FMOD_ERR_FILE_EOF or FMOD_ERR_FILE_ENDOFDATA? Because docs make it clear that these aren’t really for a properly ended file, but for a truncated/damaged input. In any case, fmod sound release should handle that condition, and break that endless loop that reads nothing if sound is being released. (And by the way, does codec need to return EOF or ENDOFDATA or FMOD_OK?)

    Also, I found something really interesting. Seems like fmod destroys my sound system. I don’t know how it does it, but sound stops working completely on my PC! I have RX-A2050 attached using hdmi, and at first I couldn’t figure out what was wrong, and then I noticed that these problems are related to fmod. When I left VS attached with debugger while fmod was stuck in that deadlock reading finished file and trying to release a sound my sound would eventually stop working completely. I was going nuts at first, only reboot would help, even if I disabled sound device and re-enabled it it would still stay completely mute. Only now I actually noticed that it was fmod related: when I break debugger there are some changes with the sound device.
    When I noticed these issues with sound I wasn’t sure what it was related to, usually this would happen after I left my PC for some time and when I would come back it was totally silent. Eventually I found out that there was only one way to fix sound without rebooting: I had to change default format in device properties:

    One other point, it would be very helpful if fmod.pdb was publicly available. Would be very helpful for anybody who needs to debug fmod related code.

    > I’m not sure what you mean about the docs …

    For me docs, are the headers. That’s where I prefer to read docs, not in a browser, and it seems some parts of fmod docs aren’t in headers, but are available online. Maybe my fmod headers are outdated?.. I see this in headers: #define FMOD_VERSION 0x00010815

  • You must to post comments

in my case opus is inside ogg, yes. I’d like to write my own plugin and after some google-fu I found that fmod_codec_raw.cpp example.
How does fmod know to use this codec_raw?.. where do I put generated dll? does fmod need to be updated? There is absolutely no code that in any way could tell that, “yes, this codec_raw should be used for this file format/codec.”

In other word, this sample is nonsense and IMO it should be redone by somebody who does not know internals of fmod, as this code is full of some assumptions that only known to the person familiar with internals of fmod.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.