We are installing a custom rolloff callback with FMOD_System_Set3DRolloffCallback
We are seeing that if we call FMOD_System_PlaySound more than once for the same FMOD_SOUND object (i.e. to play multiple instances of the same sound at once) we only get the custom rolloff callback called for the channel object that was most recently created. The other instances do not pass through the custom callback at all.
What we see in our audio log is a call to FMOD_System_PlaySound for the first instance (which in the test run returns a channel value of 0FF60025) then we see a call to FMOD_Channel_Set3DAttributes, then FMOD_Channel_Set3DMinMaxDistance then FMOD_Channel_SetPaused to start the sound playing.
Then another call to FMOD_Channel_Set3DAttributes to update the position followed by a call to our callback (which returns 0 as is correct for the way our custom falloff algorithm works).
Then after that we see another call to FMOD_System_PlaySound for the same FMOD_SOUND object (which in the test run returns a channel value of 0FF60029). Then for that channel we see a call to FMOD_Channel_Set3DAttributes, then FMOD_Channel_Set3DMinMaxDistance then FMOD_Channel_SetPaused to start the sound playing. Then another call to FMOD_Channel_Set3DAttributes to update the position followed by a call to our callback (which also returns 0 as is correct for the way our custom falloff algorithm works).
Then we see repeated calls to FMOD_Channel_Set3DAttributes for the first channel then FMOD_Channel_Set3DAttributes for the second channel (the sound in question is the engine sound for a vehicle object and hence its moving all the time, also it is set to loop infinitely) followed by a call to our callback for the second channel only.
Is there something special we have to do to get it to call our callback for all playing instances of a given FMOD_SOUND?
We are using version 1.04.05 of FMOD Studio Programmers API on Windows.
I have been reading the documentation including that for set3DRolloffCallback and FMOD_3D_ROLLOFF_CALLBACK (such little as exists for that) and cant find anything that would indicate we are doing anything wrong.
Even if you call Channel_Set3DAttributes, the rolloff callback won’t be called unless the channel or listener position actually changes between System_Update calls, .
You could also verify the channel is still playing using the Channel_IsPlaying function.
I rigged up a simple test where all the “create sound” calls in our engine are switched off except for 2 copies of the 1 test sound.
http://pastebin.com/NYE4EbXz is a log of all the fmod calls our audio system makes when running the test.
What I am seeing is that when our callback is called later (e.g. line 553 in the log) FMOD_Channel_IsPlaying for the second channel (0x0FFE0009) returns 1 but FMOD_Channel_IsPlaying for the first channel (0x0FFE0005) return 0.
We are not calling any pause or stop commands that would cause the first channel to stop, nor do we see any errors from FMOD (errors would be caught with our logging)
Is there something we are doing that is causing the first channel to stop playing?
Do we need to create separate FMOD_SOUND objects for each instance of the sound that is playing at once? (and if so is there an easy way to tell if a given FMOD_SOUND object is playing and therefore we need to create a new one?) Is there something else we need to do?
Please login first to submit.