I’m trying to write a plugin that allows a source of audio to be positioned in 3D space around the listener. I’m trying to use OpenAL for my purposes at the moment. The gist of my confusion comes with how to ‘wrap’ my OpenAL source inside the AudioProcessor (or ‘connect’ the two), because OpenAL sources have their own play/stop functions, whereas in my AudioProcessor’s processBlock, I’m continuously receiving and outputting audio sample buffers of data.
Right now, in processBlock I copy the AudioSampleBuffer data to the OpenAL buffer (that I bind my OpenAL source to), then zero out the AudioSampleBuffer, and play the OpenAL Source instead. This obviously feels incredibly weird and convoluted (not to mention that it doesn’t even work). What’s the right way to go about this? I would appreciate any pointers in the right direction. This is my first time working with 3D audio in general. Thanks!