PowerQuest 0.17.3
Audio Class Reference

Inherits SystemAudio.

Additional Inherited Members

- Properties inherited from SystemAudio
static AudioHandle MusicHandle [get]
 
static float FalloffDistanceMultiplier [get, set]
 A multiplier on the falloff distance for volume/panning. Useful when you want to bring it in close, or expand it outwards temporarily. More...
 
static bool ShouldRestartMusicIfAlreadyPlaying [get]
 Flag to set whether playing the same music cue again will restart it, or leave the old one playing. More...
 
AudioMixerGroup NarratorMixerGroup [get]
 
- Static Public Member Functions inherited from SystemAudio
static void SetVolume (AudioCue.eAudioType type, float volume)
 Sets the volume (from 0.0 to 1.0) for audio of a particular type (eg: Sound effects, Music, Dialog) More...
 
static float GetVolume (AudioCue.eAudioType type)
 Retrieves the volume for audio of a particular type (eg: Sound effects, Music, Dialog) More...
 
static AudioCue GetCue (string cueName)
 Retrieves a sound cue by name. More...
 
static bool IsPlaying (string cueName)
 Returns true if the cue is currently playing, otherwise false. More...
 
static AudioHandle Play (string cueName, Transform emmitter=null)
 Play a cue by name. This is the main way to play sounds. If emmitter is set, the sound will falloff/pan as it goes off camera. More...
 
static AudioHandle Play (AudioCue cue, Transform emitter=null, float volumeMult=1, float pitchMult=1, float fromTime=0, float withStartDelay=0)
 Play the specified cue with extended options. If emmitter is set, the sound will falloff/pan as it goes off camera. Can also set volume and pitch overrides, and override the start time of the cue. More...
 
static AudioHandle Play (AudioCue cue, ref List< AudioHandle > handles, Transform emmitter=null, float volumeMult=1, float pitchMult=1, float fromTime=0, float withStartDelay=0)
 Advanced Play function with extended options, and returning a list of all handles started (for when multiple are started). If emmitter is set, the sound will falloff/pan as it goes off camera. Can also set volume and pitch overrides, and override the start time of the cue. More...
 
static AudioHandle Play (AudioClip clip, int type=(int) AudioCue.eAudioType.Sound, Transform emmitter=null, float volume=1, float pitch=1, bool loop=false, AudioMixerGroup mixerGroup=null)
 Plays a specific audio clip rather than an audio cue. More...
 
static void Pause (AudioHandle handle)
 Pauses the specified sound by it's handle. More...
 
static void UnPause (AudioHandle handle)
 Resumes the specified sound by it's handle. More...
 
static void Pause (string cueName)
 Pauses the specified sound by it's cue name. More...
 
static void UnPause (string cueName)
 Resumes the specified sound by it's cue name. More...
 
static AudioHandle GetHandle (string cueName)
 Gets a playing AudioHandle by its cue name. More...
 
static AudioHandle[] GetHandles (string cueName)
 Gets any currently playing AudioHandles by their cue name. More...
 
static void Stop (string cueName, float overTime=0)
 Stops the specified sound by it's cue name. More...
 
static void Stop (AudioHandle handle, float overTime=0, float afterDelay=0)
 Stops the specified sound by it's handle. More...
 
static AudioHandle PlayMusic (string cueName, float fadeTime=0)
 Play a music track using the cue name, with optional crossfade time. More...
 
static AudioHandle PlayMusic (string cueName, float fadeOutTime, float fadeInTime)
 Play a music track using the cue name, with seperate fade out and fade in times. More...
 
static AudioHandle PlayMusic (AudioCue cue, float fadeTime=0)
 Play a music cue, with optional crossfade time. More...
 
static AudioHandle PlayMusic (AudioCue cue, float fadeOutTime, float fadeInTime)
 Play a music cue, with seperate fade out and fade in times. More...
 
static AudioSource PlayMusicSynced (string name, float fadeTime, float volumeOverride=0)
 Play a music track using the cue name, Crossfades beteween two music tracks, attempting to keep them synced (assumes identical length/tempo/etc). Optional volume multiplier. More...
 
static AudioSource PlayMusicSynced (AudioCue cue, float fadeTime, float volumeOverride=0)
 Crossfades beteween two music tracks, attempting to keep them synced (assumes identical length/tempo/etc). Optional volume multiplier. More...
 
static void StopMusic (float fadeTime=0, float afterDelay=0)
 Stops the currently playing music, with optional fade out time. More...
 
static void PlayAmbientSound (string name, float fadeTime=0.4f)
 Plays an ambient sound by it's cue name, with optional fade time. Sound cue is assumed to be looping. More...
 
static void PlayAmbientSound (string name, float fadeoutTime, float fadeInTime)
 Plays an ambient sound by it's cue name, with seperate fade out and fade in times. Sound cue is assumed to be looping. More...
 
static void StopAmbientSound (float overTime=0.4f)
 Stops the current ambient sound cue, with optional fade time. More...
 
static void UpdateCustomFalloff (string cueName, Vector2 soundPos, Vector2 listenerPos, float closeDist, float farDist, float farVol=0, float closeVol=1, float farPan=0.7f)
 Sets a sound's volume and stereo pan based on distance to it. Use this function when you want sounds to be louder when standing near them, and quieter as you walk away. The function should be placed in your room's Update() function. eg. ~~~ void Update() More...
 
static float ToDecibel (float linear)
 
static float FromDecibel (float dB)
 
- Public Member Functions inherited from SystemAudio
float GetVolume (AudioHandle source)
 Gets the base volume of a particular sound effect (usually use the AudioHandle for this) More...
 
void SetVolume (AudioHandle source, float volume)
 Sets the base volume of a particular sound effect (usually use the AudioHandle for this) More...
 
float GetPan (AudioHandle source)
 Gets the base pan of a particular sound effect (usually use the AudioHandle for this) More...
 
void SetPan (AudioHandle source, float pan)
 Sets the base pan of a particular sound effect (usually use the AudioHandle for this) More...
 
bool StopHandleInternal (AudioHandle handle, float overTime=0, float afterDelay=0)
 
bool GetAnyMusicPlaying ()
 
float GetCueVolume (AudioCue cue, AudioClip specificClip=null)
 Advanced function to retrieve a cue's default volume. More...
 
void PauseAllSounds (bool alsoPauseMusic=false)
 Advanced function that pauses all sounds (used when pausing game) More...
 
void ResumeAllSounds ()
 Advanced function that resumes all paused sounds (used when pausing game) More...
 
AudioHandle GetActiveMusicHandle ()
 Advanced function for retrieving the active music handle. More...
 
bool GetIsActiveMusic (AudioCue cue)
 Advanced function returns true if the passed cue is the active music. More...
 
bool EditorAddCue (AudioCue cue)
 Editor function for adding an audio cue to the list of cues playable by name. Primarily used by editor. Returns true if added, false if it already existed. More...
 
List< AudioCue > EditorGetAudioCues ()
 Editor function for retrieving all audio cues. More...
 
bool EditorGetAutoAddCues ()
 If set, any cues in the Audio folder will be automatically added (you don't have to click the button in the cue) More...
 
void StartFadeIn (AudioHandle handle, float time)
 Starts fading in a handle. In powerquest it's usually more convenient to use Audio.Play("MySound").FadeIn(overTime); More...
 
void StartFadeOut (AudioHandle handle, float time, bool stopOnFinish=false)
 Starts fading out a handle, optionally stopping it once faded out. In powerquest it's usually more convenient to use `Audio.Stop("MySound", overTime);. More...
 
void StartFade (AudioHandle handle, float targetVolume, float time, bool stopOnFinish=false)
 Starts fading a handle to the target volume, optionally stopping it once finished. In powerquest it's usually more convenient to use Audio.GetCue("MySound").Fade(targetVolume, overTime); More...