PowerQuest
AudioHandle Class Reference

Detailed Description

Audio handle- Use for changing a sound that's currently playing.

  • All the Play(...) functions in the audio system return an AudioHandle. You can store and use this to manipluate the clip that's playing. Especially useful for looping sounds (at least, if you ever want to stop them)
  • It wraps around unity's "AudioSource", but gives access to it so you can still use whatever functionality unity provides with it's AudioSources
  • See Unity's docs on AudioSource for more specific info

Properties

AudioSource source [get]
 Retrieves the unity AudioSource this handle is using. More...
 
bool isPlaying [get]
 Is the clip playing right now? (Read Only). Note: will return false when AudioSource.Pause is called. More...
 
float volume [get, set]
 The base volume of clip (0.0 to 1.0) Before falloff, ducking, etc is applied. To get the final volume, use source.volume. More...
 
float pitch [get, set]
 The pitch of the audio source. See Unity docs for more info. More...
 
float panStereo [get, set]
 Pans a playing sound in a stereo way (left or right). See Unity docs for more info. More...
 
float time [get, set]
 Playback position in seconds. See Unity docs for more info. More...
 
bool loop [get]
 Is the audio clip looping. More...
 
AudioClip clip [get]
 The audio clip that is playing. More...
 

Static Public Member Functions

static implicit operator AudioSource (AudioHandle handle)
 

Public Member Functions

 AudioHandle (AudioSource source)
 
void Pause ()
 Pauses playing the clip. More...
 
void UnPause ()
 Resumes playing the clip after pausing. More...
 
void Stop (float overTime=0.0f)
 Stops the clip, optionally fading out over time) More...
 

Property Documentation

◆ source

AudioSource source
get

Retrieves the unity AudioSource this handle is using.

◆ isPlaying

bool isPlaying
get

Is the clip playing right now? (Read Only). Note: will return false when AudioSource.Pause is called.

◆ volume

float volume
getset

The base volume of clip (0.0 to 1.0) Before falloff, ducking, etc is applied. To get the final volume, use source.volume.

◆ pitch

float pitch
getset

The pitch of the audio source. See Unity docs for more info.

◆ panStereo

float panStereo
getset

Pans a playing sound in a stereo way (left or right). See Unity docs for more info.

◆ time

float time
getset

Playback position in seconds. See Unity docs for more info.

◆ loop

bool loop
get

Is the audio clip looping.

◆ clip

AudioClip clip
get

The audio clip that is playing.

Member Function Documentation

◆ Pause()

void Pause ( )
inline

Pauses playing the clip.

◆ UnPause()

void UnPause ( )
inline

Resumes playing the clip after pausing.

◆ Stop()

void Stop ( float  overTime = 0.0f)
inline

Stops the clip, optionally fading out over time)