I’m new to FMOD Ex, trying to individually spatialize the channels in an multi-channel Ogg stream (8 channels in this case) without having to open the stream separately for each channel (doing so would be a waste of bandwidth but more importantly would mess up synchronization between the channels due to to independent stream buffering).
Short of writing a whole lot of code to extract each channel from the stream and copy data to new buffers, my hope was that I could run multiple playSound() functions on the single 3-d stream object (FMOD_3D | FMOD_CREATESTREAM) and mute all the other channels for each instance of playSound(). That seems to work on sound objects as long as they’re not streaming (i.e. I can playSound() multiple times on a single non-streaming sound object), but things fail silently when I try that on the stream. I hear about half a second of audio before things go quiet (no crash though).
I was hopeful when I saw I could set individual levels on the channels and specify the angular spread! But the more I look it seems the 3-d operations can only be applied to the stream as a whole. Am I taking the right approach? Is this something I won’t be able to do without rolling my own synchronized stream buffers, or is there some other way to get the channels out of the stream and into individual 3-d positions?
- gershon asked 3 years ago
I solved this using a custom DSP callback that copies individual channel data to a global buffer and plays the buffers individually using pcmreadcallback (basically combining the dsp_custom example and the usercreatedsound example, with a little bit extra to dynamically instantiate sounds for each channel in the multichannel netstream). The mono channels can then be 3d positioned (or otherwise manipulated) individually while remaining synchronized to within n*1024 samples. Happy to share code if anyone’s interested. FMOD rocks!
- gershon answered 3 years ago
sorry for not replying sooner. You could also do it yourself with Channel::setSpeakerLevels as you get full matrix control over what input channels get sent to what output speaker, but then you’d have to do the 3d dot product/calcs yourself, so splitting it out like you’ve done is another way to do it.
Please login first to submit.