pcmreadcallback being called just after createStream


I’m creating a sound stream like this:

exinfo.pcmreadcallback = pcmreadcallback; /* User callback for reading. /
exinfo.pcmsetposcallback = pcmsetposcallback; /
User callback for seeking. /
exinfo.userdata = new FMODSoundData(bufferSize
4); // =32KB for 4608-byte packets
info(“before creating stream”);
result = system->createStream(0, mode, &exinfo, &sound);
info(“after creating stream”);

and in my pcmreadcallback method
I have a printout whenever it is called:
FMOD_RESULT F_CALLBACK pcmreadcallback(FMOD_SOUND* sound,
void *data,
u32 datalen)
// some code
println (“pcmreadcallback called”);

In my console, I’m getting 8 invocations of pcmreadcallback when createStream is called.
eg in console:
before creating stream
pcmreadback called x 8
after creating stream

Why is this so?
Is there something I’m overlooking? Is it normal for pcmreadcallback to be called during createStream?
I’ve tested with fmod 1.6.10 and 1.5.09 and both exhibit the same behaviour.

Figured it out, it was because I didn’t open the stream with FMOD_OPENONLY

As soon as you open a stream, it prebuffers , ready for instant playback. You can use FMOD_NONBLOCKING if you dont want it to stall the main thread. FMOD_OPENONLY is not a good idea as it will mean a large delay before the sound starts, because you didnt prebuffer anything.

I see.
I am trying to debug an issue where the first 8 invocations of my dsp’s read callback return silence. So I thought it might be this issue.
Doesn’t seem to be though.