Soundy Pooler

Code examples to perform various interactions with the Soundy Pooler

Get Controller From Pool

Gets a SoundyController from the Pool, or creates a new one if all the available controllers are in use

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
        SoundyController controller = SoundyPooler.GetControllerFromPool();
    }
}

Put Controller In Pool

Put a SoundyController back in the Pool

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;
    
    private void Start()
    {
        SoundyPooler.PutControllerInPool(MyController);
    }
}

Populate Pool

Create a set number of SoundyControllers and add them to the Pool

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public int NumberOfControllers = 3;
    
    private void Start()
    {
        SoundyPooler.PopulatePool(NumberOfControllers);
    }
}

Clear Pool

Stops all SoundyControllers from playing, destroys the GameObjects they are attached to and clears the Pool

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public bool KeepMinimumNumberOfControllers = false;
    
    private void Start()
    {
        SoundyPooler.ClearPool(KeepMinimumNumberOfControllers);
    }
}