XPLMPlayPCMOnBus

XPLM_API FMOD_CHANNEL* XPLMPlayPCMOnBus(
                         void *               audioBuffer,
                         uint32_t             bufferSize,
                         FMOD_SOUND_FORMAT    soundFormat,
                         int                  freqHz,
                         int                  numChannels,
                         int                  loop,
                         XPLMAudioBus         audioType,
                         XPLMPCMComplete_f    inCallback,
                         void *               inRefcon);    /* Can be NULL */

Play an in-memory audio buffer on a given audio bus. The resulting FMOD channel is returned. PAY ATTENTION TO THE CALLBACK - when the sample completes or is stopped by X-Plane, the channel will go away. It’s up to you to listen for the callback and invalidate any copy of the channel pointer you have lying around. The callback is optional because if you have no intention of interacting with the sound after it’s launched, then you don’t need to keep the channel pointer at all. The sound is not started instantly. Instead, it will be started the next time X-Plane refreshes the sound system, typically at the start of the next frame. This allows you to set the initial position for the sound, if required. The callback will be called on the same thread as the sound is created from, and will be called only once per sound. If the call fails and you provide a callback function, you will get a callback with an FMOD status code.