Skip to content

Pooling

Axwabo edited this page Aug 20, 2025 · 1 revision

Pooling

Pooling (in general programming terms) is the process of reusing an already existing instance, thus saving the time that would be spent on instantiating a new object.

Use the SpeakerToyPool and AudioPlayerPool classes to pool speakers (and audio players)

Rent a SpeakerToy and return it to the pool after you're done using it. If you don't specify a controller ID or SpeakerSetting, they may be arbitrary. Make sure to specify them or set them after creation.

The NextAvailableId property returns the next free controller ID.

Tip

If playing a clip/stream once, you can use the PoolOnEnd on the AudioPlayer to automatically return it once playback finishes.

Clone this wiki locally