Search code examples
openalxaudio2

Does XAudio2 have a maximum number of voices?


We began migrating our sound-engine to XAudio2 some time back, but are not complete yet. At present we're stilling using OpenAL and have hit an issue where the maximum number of 'sources' (what I believe are termed 'voices' in XAudio2) varies depending on your hardware.

We could upgrade our OpenAL stuff to recycle sources, but if XAudio2 solves this for us then I'd rather focus on completing the migration.

I have not been able to track down any info on this and don't see any posts from people struggling with this issue with XAudio2... so I'm guessing there is no limit?


Solution

  • There are no hard voice limit on XAudio2 as it's all software mixing, but there are practical limits based on your target hardware that typically result in glitching as the mixer is unable to keep up.

    XNA Game Studio enforced a limit of 300 voices on Xbox 360, so that's probably a practical upper-limit for 'modern PCs' that are trying to run full 3D games at the same time. Number of 3D positional voices, number of effects/DSPs running, and other factors will also lower that number a fair amount.

    Generally having more than 64 playing sounds is likely to be hard to pick out, so most voice-management systems reuse a reasonable subset of voices and assigns them dynamically. For example, DirectX Tool Kit for Audio voice management defaults to "unlimited" voices, but supports a mechanism for setting the maximum number of voices to allocate for 'one-shots' and 'instances', reclaiming a voice pool, etc.