Streaming custom (encoded) data for create/playSound

I would like to feed FMOD continuosly with encoded (i.e.non PCM) data in streaming fashion - with unknown length, and not via a file - and have been testing creating a sound with setFileSystem callbacks set; - but since the callbacks are file oriented and there’s e.g. no file handle - without much success (data is encoded via common codec such as mp3 which FMOD normally accepts).

I’m roughly following asyncio sample in unity c# wrapper, using CREATESTREAM opening flag, empty CREATESOUNDEXINFO; after setting at least some dummy filesize in open callback, FMOD seems to freeze after 1st call to async read callback.

:: the reason I’m trying to do this is to enhance, or rather replace in fact, FMOD networking which is very bare bones esp. wrt secure connections and/or other features such as authentication/redirects/…

Is this viable approach and can this be eventually done this way ?
If not, is there currently a potential way of doing this with FMOD ?

Thank you !

Are you setting the cbsize of the FMOD_CREATESOUNDEXINFO?


Size of this structure. Must be set to sizeof(FMOD_CREATESOUNDEXINFO) before calling System::createSound or System::createStream.

yeah, the gist of it is here:

system is created before, is being updated via Update
callbacks are just empty (with some logging, removing it/everything didn’t make a difference), except I’m trying to set at least ref parameters and members marked as [w] in ASYNCREADINFO in async/read callbacks

prints these (and only these) 3 lines before it stops:
=================================== FileOpenCallback decoder ˊo_oˋ 10000 0 0
=================================== FileAsyncReadCallback 1075647096 0
=================================== FileAsyncReadCallback asyncReadInfo 0 8192 2048 0 0 1166073824 1 FMOD.FILE_ASYNCDONE_FUNC

was not sure how to proceed / if it makes sense for FMOD to be used like this

it looks like you aren’t calling done() on your FMOD_ASYNCREADINFO anywhere, this is required to signal the async operation is complete. See how asyncio example does this.

I couldn’t make it run in 1.10.14 - was getting null in info parameter in asyncread callback ( so a new read request couldn’t be recorded no matter what )
Upgrade to latest 2.00 seems to solve this for now ( that callback definition changed in 2.00, too )

[it’s not done yet, but at least it looks like it’s willing to run]

compared to asyncio example it needed bigger stream buffer size for an ogg file, and different mp3 than the one used in the example didn’t work with IGNORETAGS flag as well

but it seems to be running correctly now all things considered

Thank you for the assistance !

1 Like