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
|
AudioSource | source [get] |
| Retrieves the unity AudioSource this handle is using.
|
|
string | cueName [get] |
|
bool | isPlaying [get] |
| Is the clip playing right now? (Read Only). Note: will return false when AudioSource.Pause is called.
|
|
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.
|
|
float | pitch [get, set] |
| The pitch of the audio source. See Unity docs for more info.
|
|
float | panStereo [get, set] |
| Pans a playing sound in a stereo way (left or right). See Unity docs for more info.
|
|
float | time [get, set] |
| Playback position in seconds. See Unity docs for more info.
|
|
bool | loop [get] |
| Is the audio clip looping.
|
|
float | startDelay [set] |
| Delay before cue is started- must be set immediately after playing (same as AfterDelay() )
|
|
AudioClip | clip [get] |
| The audio clip that is playing.
|
|
|
| AudioHandle (AudioSource source, string fromCue=null) |
|
void | Pause () |
| Pauses playing the clip.
|
|
void | UnPause () |
| Resumes playing the clip after pausing.
|
|
void | Stop (float overTime=0.0f, float afterDelay=0.0f) |
| Stops the clip, optionally fading out over time, and/or after a delay.
|
|
void | AfterDelay (float time) |
| Makes the clip start after the passed in time (if called immediately after play) eg. `Audio.Play("GunshotEcho").AfterDelay(1.0f);.
|
|
AudioHandle | FadeIn (float overTime) |
| Fades in the sound from zero, call directly after playing the sound to fade it in. eg Audio.Play("MoodyAmbience").FadeIn(1);
|
|
AudioHandle | Fade (float targetVolume, float overTime) |
| Fades the volume from it's current volume to another over the specified length of time.
|
|