I gave writing a plugin to read Opus files with the FMOD Low Level API another go (with a failed attempt earlier) and I’ve finally succeeded. The issue, now: it’s extremely slow!
It seems that FMOD gets all of the PCM data during the
system->createSound call. That means opusfile needs to decode all of the data, which takes up a considerable amount of cycles, and therefore a lot of time.
Re-encoded Thai Opus 64kbps time: 1.934518s
Re-encoded Thai Opus 96kbps time: 2.088251s
Original source Thai MP3 time: 0.960078s
So, basically, my test files (a random funny Thai song
from a totally legitimate source) show that using my plugin causes a 2-3.5x increase in time to load. Yikes!
So, my question is as follows: is there a way to make FMOD decode audio on-the-fly?
I’m not quite sure how I can use the stream from FMOD either, so I’m copying the entire file into another buffer inside my
open callback. To me, memory usage is negligible as long as it’s sane. I’m not sure this is really part of the slowness.
I’d be happy to share my plugin code if it helps.