Runner's High
Static Public Member Functions | Static Public Attributes | List of all members
AudioCenter Class Reference

Singleton class that provides audio playback behavior such as oneshot, loop, reverse. DO NOT INSTANCIATE! More...

Inheritance diagram for AudioCenter:

Static Public Member Functions

static AudioSource CreateBinaural (string pathToSoundfile, Dictionary< string, float > options)
 Creates a binaural audio source using Google Resonance Audio Plugin. More...
 
static AudioSource Create (string pathToSoundfile)
 Creates an audio source. More...
 
static void Loop (AudioSource audioSource, float loopStart=-1, float loopEnd=-1, int times=-1)
 Plays a source as a loop. More...
 
static void OneShot (AudioSource audioSource)
 Play a source as one-shot. If called on a looped AudioSource, it is equivalent to ExitLoop(). More...
 
static void StopImmediately (AudioSource s)
 Atops an audiosource immediately, no matter if it is looping or not. More...
 
static void ExitLoop (AudioSource s)
 Plays until the loop end point, then exits the loop, plays until the end of the file and stops. More...
 
static void ExitLoopImmediately (AudioSource s)
 Jumps to the end point of the loop immediately, then plays to the end of the clip, then stops. More...
 
static void RestartLoop (AudioSource s)
 Immediately jumps to the start of the loop. this overrides preiously defined looping behavior. More...
 
static void Reverse (AudioSource s)
 Plays an audio source in reverse. More...
 

Static Public Attributes

static Dictionary< AudioSource, float > loopStartList = new Dictionary<AudioSource, float>()
 
static Dictionary< AudioSource, float > loopEndList = new Dictionary<AudioSource, float>()
 
static Dictionary< AudioSource, float > iterList = new Dictionary<AudioSource, float>()
 

Detailed Description

Singleton class that provides audio playback behavior such as oneshot, loop, reverse. DO NOT INSTANCIATE!

Member Function Documentation

◆ Create()

static AudioSource AudioCenter.Create ( string  pathToSoundfile)
static

Creates an audio source.

Parameters
pathToSoundfileThe path to the soundfile relative to the project's Resources folder, without file extension.
optionsProvide options such as movement speed of the source.
Returns
An AudioSource instance or null if the audio file could not be found.

◆ CreateBinaural()

static AudioSource AudioCenter.CreateBinaural ( string  pathToSoundfile,
Dictionary< string, float >  options 
)
static

Creates a binaural audio source using Google Resonance Audio Plugin.

Parameters
pathToSoundfileThe path to the soundfile relative to the project's Resources folder, without file extension.
optionsProvide options such as movement speed of the source.
Returns
An AudioSource instance or null if the audio file could not be found.

◆ ExitLoop()

static void AudioCenter.ExitLoop ( AudioSource  s)
static

Plays until the loop end point, then exits the loop, plays until the end of the file and stops.

Parameters
sThe AudioSource to stop.

◆ ExitLoopImmediately()

static void AudioCenter.ExitLoopImmediately ( AudioSource  s)
static

Jumps to the end point of the loop immediately, then plays to the end of the clip, then stops.

Parameters
sThe AudioSource to stop.

◆ Loop()

static void AudioCenter.Loop ( AudioSource  audioSource,
float  loopStart = -1,
float  loopEnd = -1,
int  times = -1 
)
static

Plays a source as a loop.

Parameters
audioSourceThe AudioSource that should be looped.
loopStartThe start point of the loop. If not specified, loops from beginning of file.
loopEndThe end point of the loop. If not specified, loops to end of file.
timesThe number of iterations. If not specified, loops endlessly.

◆ OneShot()

static void AudioCenter.OneShot ( AudioSource  audioSource)
static

Play a source as one-shot. If called on a looped AudioSource, it is equivalent to ExitLoop().

Parameters
audioSourceThe AudioSource to play.

◆ RestartLoop()

static void AudioCenter.RestartLoop ( AudioSource  s)
static

Immediately jumps to the start of the loop. this overrides preiously defined looping behavior.

Parameters
sThe AudioSource to restart.

◆ Reverse()

static void AudioCenter.Reverse ( AudioSource  s)
static

Plays an audio source in reverse.

Parameters
sThe AudioSource to reverse.

◆ StopImmediately()

static void AudioCenter.StopImmediately ( AudioSource  s)
static

Atops an audiosource immediately, no matter if it is looping or not.

Parameters
sThe AudioSource to stop.

The documentation for this class was generated from the following file: