AudioObject Class |
Namespace: (Default Namespace)
public class AudioObject : RegisteredComponent
The AudioObject type exposes the following members.
Name | Description | |
---|---|---|
AudioObject | Initializes a new instance of the AudioObject class |
Name | Description | |
---|---|---|
audioID |
Gets the audio ID.
| |
audioItem |
Gets the corresponding AudioSubItem
| |
audioObjectTime |
Returns the high precision local time of this audio object
| |
audioTime |
Sets or gets the current audio time relative to ClipStartTime | |
category |
Gets the category.
| |
clipLength |
Gets the length of the clip.
| |
completelyPlayedDelegate |
Gets or sets the delegate to be called once an audio clip was completely played.
| |
isFadeOutComplete |
return true if the audio has completely faded out
| |
isFadingIn |
return true if the audio is currently fading in
| |
isFadingOut |
return true if the audio is currently fading out
| |
isFadingOutOrScheduled |
return true if the audio is currently fading out or is scheduled to fade out
| |
isPlayedAsMusicOrAmbienceSound |
Returns true if the audio object is treated as music
| |
pan |
Sets or gets the audio pan.
| |
pitch |
Sets or gets the audio pitch.
| |
playCalledAtTime |
Gets the systemTime at which the audio Play() function was called.
| |
primaryAudioSource |
returns the primary AudioSource
| |
scheduledPlayingAtDspTime |
Gets or sets the DSP time at which the audio is scheduled to play.
| |
secondaryAudioSource |
returns the secondary AudioSource
| |
startedPlayingAtTime |
Gets the systemTime at which the audio started playing.
| |
stopAfterFadeOut |
If enabled, the audio will stop playing if a fadeout is finished.
| |
subItem |
Gets the corresponding AudioSubItem
| |
timeUntilEnd |
Gets the time until the clip will stop.
| |
volume |
Gets or sets the volume.
| |
volumeItem |
Gets or sets the volume of the audio item.
| |
volumeTotal |
Gets the total volume.
| |
volumeTotalWithoutFade |
Gets the total volume.
|
Name | Description | |
---|---|---|
DestroyAudioObject |
Destroys the audio object (using ObjectPoolController if pooling is enabled)
| |
DoesBelongToCategory |
Checks if this AudioObject belongs to a specific category
| |
FadeIn |
Fades-in a playing audio.
| |
FadeOut(Single) |
Starts a fade-out. If the AudioItem mode is is a sequence, the next sub-item will continue to play
after the this sub-item is completely faded out.
| |
FadeOut(Single, Single) |
Starts a fade-out at a specified time. If the AudioItem mode is is a sequence, the next sub-item will continue to play
after the this sub-item is completely faded out.
| |
FinishSequence |
Finishes a playing sequence, depending on the AudioItem's loop mode :
| |
InverseTransformPitch |
Inverse pitch transformation: TransformPitch(Single) | |
InverseTransformVolume |
Inverse volume transformation TransformVolume(Single) | |
IsPaused |
Determines whether the audio clip is paused.
| |
IsPlaying |
Determines if either the primary or the secondary audio clip is playing.
| |
IsPrimaryPlaying |
Determines if the primary audio clip is playing.
| |
IsSecondaryPlaying |
Determines if the secondary audio clip is playing.
| |
Pause |
Pauses the audio clip.
| |
Pause(Single) |
Pauses the audio clip with a fade-out.
| |
Play |
Plays the audio clip with the specified delay.
| |
PlayAfter |
Plays the specified audio after the current has finished playing
| |
PlayNow |
Plays the specified audio.
| |
PlayScheduled |
Plays the audio clip at the specified high precision DSP time (see the Unity AudioSettings.dspTime documentation)
| |
Stop |
Stops playing this instance.
| |
Stop(Single) |
Stops a playing audio with fade-out.
| |
Stop(Single, Single) |
Stops a playing audio with fade-out at a specified time.
| |
SwitchAudioSources |
Switches the primary and secondary audio source
| |
TransformPitch |
Transforms the pitch from semitones to a multiplicative factor
| |
TransformVolume |
Transforms the volume to make it perceptually more intuitive to scale and cross-fade.
| |
Unpause |
Unpauses the audio clip.
| |
Unpause(Single) |
Unpauses the audio clip with a fade-in.
|
var soundFX = new PoolableReference<AudioObject>( AudioController.Play( "someSFX" ) ); // some other part of the code executed later when the sound may have stopped playing // and was moved back to the pool AudioObject audioObject = soundFX.Get(); if( audioObject != null ) { // it is safe to access audioObject here audioObject.Stop(); }