FMOD_OPENUSER read callback only called once

Hello,

I am reading PCM16 samples from a hardware device and am trying to play back the sound with FMOD.

My current method is to use FMOD_OPENUSER | FMOD_LOOP_NORMAL, and to use lock()/unlock() to write directly into the buffer. While this works you are now faced with the problem of synchronizing the cursors so the read cursor from FMOD doesn’t overtake the write. This results in complicated logic and unstable systems.

What I would like to do is for FMOD itself to wait until there is input data, by overriding the pcm read callback (FMOD_CREATESOUNDEXINFO.pcmreadcallback).
I expected it to be doing this but the callback is only called once on load and never afterwards, the sound will loop.

Is there a way for me to move the device capturing code into FMOD callbacks in a way that will make the read cursor wait for the written data to be available ?

What am I missing?
Thanks in advance.

What you want to achieve is shown by the infinite stream option in the user_created_sound example.

Very interesting, I feed bad for missing this, but I will try this out.

Thanks!