The current Sound API creates one OpenAL source and one buffer on load.
This becomes an issue when a game tries to preload all of its sounds, as there is a hardcoded limit of 256 sources in OpenAL-Soft: https://github.com/kcat/openal-soft/blob/23259b48dd36ea91f3a2bddd32122b35b1469e4c/alc/alc.cpp#L3496
A possible solution would be to create the source on AudioController::play() and to destroy it on AudioController::stop() or at the end of the playback. Another would be to change the API to have a Sound and a SoundWithSource or whatever, with Into implemented, and only the latter would implement AudioController.
I can’t modify the game’s behaviour, and I think it’s actually valid to preload all of them in order to achieve the lowest latency possible at runtime.
The current
SoundAPI creates one OpenAL source and one buffer on load.This becomes an issue when a game tries to preload all of its sounds, as there is a hardcoded limit of 256 sources in OpenAL-Soft: https://github.com/kcat/openal-soft/blob/23259b48dd36ea91f3a2bddd32122b35b1469e4c/alc/alc.cpp#L3496
A possible solution would be to create the source on
AudioController::play()and to destroy it onAudioController::stop()or at the end of the playback. Another would be to change the API to have aSoundand aSoundWithSourceor whatever, withIntoimplemented, and only the latter would implement AudioController.I can’t modify the game’s behaviour, and I think it’s actually valid to preload all of them in order to achieve the lowest latency possible at runtime.