Manual

Soundy Controller

Code examples to perform various interactions with the Soundy Controller

Kill

Stop playing and destroy the GameObject this SoundyController is attached to

using Doozy.Engine.Soundy;
using UnityEngine;

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

Mute

Mute the target AudioSource

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;

    private void Start()
    {
        MyController.Mute();
    }
}

Pause

Pause the target AudioSource

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;

    private void Start()
    {
        MyController.Pause();
    }
}

Play

Start Play on the target AudioSource

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;

    private void Start()
    {
        MyController.Play();
    }
}

Set Follow Target

Set a follow target Transform that this SoundyController needs to follow while playing

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;
    public Transform FollowTarget;

    private void Start()
    {
        MyController.SetFollowTarget(FollowTarget);
    }
}

Set Output AudioMixerGroup

Set an output AudioMixerGroup to the target AudioSource of this SoundyController

using Doozy.Engine.Soundy;
using UnityEngine;
using UnityEngine.Audio;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;
    public AudioMixerGroup OutputAudioMixerGroup;

    private void Start()
    {
        MyController.SetOutputAudioMixerGroup(OutputAudioMixerGroup);
    }
}

Set Position

Set the position in world space from where this SoundyController will be playing from

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;
    public Vector3 WorldPosition;

    private void Start()
    {
        MyController.SetPosition(WorldPosition);
    }
}

Set Source Properties

Set the given settings to the target AudioSource

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;

    //The AudioClip to play
    public AudioClip Clip;
    
    //The volume of the audio source (0.0 to 1.0)
    public float Volume;
    
    //The pitch of the audio source
    public float Pitch;
    
    //Is the audio clip looping?
    public bool Loop;
    
    //Sets how much this AudioSource is affected by 3D spatialisation calculations (attenuation, doppler etc). 0.0 makes the sound full 2D, 1.0 makes it full 3D
    public float SpatialBlend;

    private void Start()
    {
        MyController.SetSourceProperties(Clip, Volume, Pitch, Loop, SpatialBlend);
    }
}

Stop

Stop the target AudioSource from playing

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;

    private void Start()
    {
        MyController.Stop();
    }
}

Unmute

Unmute the target AudioSource if it was previously muted

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;

    private void Start()
    {
        MyController.Unmute();
    }
}

Unpause

Unpause the target AudioSource if it was previously paused

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SoundyController MyController;

    private void Start()
    {
        MyController.Unpause();
    }
}

GLOBAL – Get Controller

Create a new SoundyController in the current scene and get a reference to it

using Doozy.Engine.Soundy;
using UnityEngine;

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

GLOBAL – Kill All

Stop all SoundyControllers from playing and destroy the GameObjects they are attached to

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
       SoundyController.KillAll();
    }
}

GLOBAL – Mute All

Mute all the SoundyControllers

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
       SoundyController.MuteAll();
    }
}

GLOBAL – Pause All

Pause all the SoundyControllers that are currently playing

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
       SoundyController.PauseAll();
    }
}

GLOBAL – Remove Null Controllers From Database

Remove any null SoundyController references from the database

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
       SoundyController.RemoveNullControllersFromDatabase();
    }
}

GLOBAL – Stop All

Stop all the SoundyControllers that are currently playing

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
       SoundyController.StopAll();
    }
}

GLOBAL – Unmute All

Unmute all the SoundyControllers that were previously muted

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
       SoundyController.UnmuteAll();
    }
}

GLOBAL – Unpause All

Unpause all the SoundyControllers that were previously paused

using Doozy.Engine.Soundy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
       SoundyController.UnpauseAll();
    }
}