setMaxActiveVoiceCount method

void setMaxActiveVoiceCount(
  1. int maxVoiceCount
)

Sets the current maximum active voice count.

If voice count is higher than the maximum active voice count, SoLoud will pick the ones with the highest volume to actually play.

NOTE: The number of concurrent voices is limited, as having unlimited voices would cause performance issues, and could lead unnecessary clipping. The default number of maximum concurrent voices is 16, but this can be adjusted at runtime using setMaxActiveVoiceCount.

The hard maximum count is 4095, but if more are required, SoLoud can be modified to support more. But seriously, if you need more than 4095 sounds playing at once, you're probably going to need some serious changes anyway.

See also:

Implementation

void setMaxActiveVoiceCount(int maxVoiceCount) {
  if (!isInitialized) {
    throw const SoLoudNotInitializedException();
  }
  _controller.soLoudFFI.setMaxActiveVoiceCount(maxVoiceCount);
}