Class BaseAudioPlayerExtensions
Inherited Members
Namespace: Doozy.Runtime.Soundy
Assembly: cs.temp.dll.dll
Syntax
public static class BaseAudioPlayerExtensions
Methods
AddOnDisposedCallback<T>(T, UnityAction)
Add a callback to the OnDisposed event.
Declaration
public static T AddOnDisposedCallback<T>(this T audioPlayer, UnityAction onDisposed)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onDisposed | OnDisposed callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
AddOnPauseCallback<T>(T, UnityAction)
Add a callback to the OnPause event.
Declaration
public static T AddOnPauseCallback<T>(this T audioPlayer, UnityAction onPause)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onPause | OnPause callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
AddOnPlayCallback<T>(T, UnityAction)
Add a callback to the OnPlay event.
Declaration
public static T AddOnPlayCallback<T>(this T audioPlayer, UnityAction onPlay)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onPlay | OnPlay callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
AddOnRecycledCallback<T>(T, UnityAction)
Add a callback to the OnRecycled event.
Declaration
public static T AddOnRecycledCallback<T>(this T audioPlayer, UnityAction onRecycled)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onRecycled | OnRecycled callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
AddOnResumeCallback<T>(T, UnityAction)
Add a callback to the OnResume event.
Declaration
public static T AddOnResumeCallback<T>(this T audioPlayer, UnityAction onResume)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onResume | OnResume callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
AddOnStopCallback<T>(T, UnityAction)
Add a callback to the OnStop event.
Declaration
public static T AddOnStopCallback<T>(this T audioPlayer, UnityAction onStop)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onStop | OnStop callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
AddOnUpdateCallback<T>(T, UnityAction)
Add a callback to the OnUpdate event.
Declaration
public static T AddOnUpdateCallback<T>(this T audioPlayer, UnityAction onUpdate)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onUpdate | OnUpdate callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
ClearCallbacks<T>(T)
Clear all callbacks from the audio player.
Declaration
public static T ClearCallbacks<T>(this T audioPlayer)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetClip<T>(T, AudioClip)
Set the audio clip to play
Declaration
public static T SetClip<T>(this T audioPlayer, AudioClip clip)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
AudioClip | clip | The audio clip to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetCrossFade<T>(T, Boolean)
Set if the audio player should fade in and out when playing and stopping.
Note: This will only work if cross fade duration is greater than 0.
Declaration
public static T SetCrossFade<T>(this T audioPlayer, bool crossFade)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Boolean | crossFade | Should the audio player cross fade? |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetCrossFadeDuration<T>(T, Single)
Set the cross fade duration for the audio player.
Declaration
public static T SetCrossFadeDuration<T>(this T audioPlayer, float duration)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | duration | Fade in duration |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetDopplerLevel<T>(T, Single)
Set the Doppler scale for this audio player
Declaration
public static T SetDopplerLevel<T>(this T audioPlayer, float value)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | value | The Doppler scale to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetFollowTarget<T>(T, Transform)
Sets the audio player to follow a target transform while playing audio. If the target transform is null, the audio player will stop following the target.
Declaration
public static T SetFollowTarget<T>(this T audioPlayer, Transform followTarget)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Transform | followTarget | The target transform to follow |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetIgnoreListenerPause<T>(T, Boolean)
Allow this audio player to play even though AudioListener.pause is set to true. This is useful for the menu element sounds or background music in pause menus.
Declaration
public static T SetIgnoreListenerPause<T>(this T audioPlayer, bool enabled)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Boolean | enabled | True to ignore AudioListener.pause, false to not ignore it |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetLoop<T>(T, Boolean)
Set this audio player to loop or not loop the audio clip
Declaration
public static T SetLoop<T>(this T audioPlayer, bool enabled)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Boolean | enabled | True to loop the audio clip, false to not loop it |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetMaxDistance<T>(T, Single)
(Logarithmic rolloff) Set the distance a sounds stops attenuating at
Declaration
public static T SetMaxDistance<T>(this T audioPlayer, float maxDistance)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | maxDistance | The distance to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetMinDistance<T>(T, Single)
Set the minimum distance within the audio source will cease to grow louder in volume
Declaration
public static T SetMinDistance<T>(this T audioPlayer, float minDistance)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | minDistance | The distance to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetMusic<T>(T, MusicId)
Load a music id into the audio player. If the audio player is already playing a music, it will be stopped and replaced with the new music. If the new music is null, the audio player will be stopped.
Declaration
public static T SetMusic<T>(this T audioPlayer, MusicId musicId)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
MusicId | musicId | The music id to load |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetMusic<T>(T, MusicObject, AudioMixerGroup)
Loads a music object into the audio player. If the audio player is already playing a music, it will be stopped and replaced with the new music. If the new music is null, the audio player will be stopped.
Declaration
public static T SetMusic<T>(this T audioPlayer, MusicObject musicObject, AudioMixerGroup audioMixerGroup = null)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
MusicObject | musicObject | The music object to load |
AudioMixerGroup | audioMixerGroup | The audio mixer group to use for the music |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetMusic<T>(T, String, String, AudioMixerGroup)
Loads a music object into the audio player. If the audio player is already playing a music, it will be stopped and replaced with the new music. If the new music is null, the audio player will be stopped.
Declaration
public static T SetMusic<T>(this T audioPlayer, string libraryName, string musicName, AudioMixerGroup audioMixerGroup = null)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
String | libraryName | The name of the library to load the music from |
String | musicName | The name of the music to load |
AudioMixerGroup | audioMixerGroup | The audio mixer group to use for the music |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetMute<T>(T, Boolean)
Mutes / unmute the audio
Declaration
public static T SetMute<T>(this T audioPlayer, bool enabled)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Boolean | enabled | True to mute the audio, false to unmute it |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetOnDisposedCallback<T>(T, UnityAction)
Set the OnDisposed callback for the audio player.
Declaration
public static T SetOnDisposedCallback<T>(this T audioPlayer, UnityAction onDisposed)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onDisposed | OnDisposed callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetOnPauseCallback<T>(T, UnityAction)
Set the OnPause callback for the audio player.
Declaration
public static T SetOnPauseCallback<T>(this T audioPlayer, UnityAction onPause)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onPause | OnPause callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetOnPlayCallback<T>(T, UnityAction)
Set the OnPlay callback for the audio player.
Declaration
public static T SetOnPlayCallback<T>(this T audioPlayer, UnityAction onPlay)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onPlay | OnPlay callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetOnRecycledCallback<T>(T, UnityAction)
Set the OnRecycled callback for the audio player.
Declaration
public static T SetOnRecycledCallback<T>(this T audioPlayer, UnityAction onRecycled)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onRecycled | OnRecycled callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetOnResumeCallback<T>(T, UnityAction)
Set the OnResume callback for the audio player.
Declaration
public static T SetOnResumeCallback<T>(this T audioPlayer, UnityAction onResume)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onResume | OnResume callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetOnStopCallback<T>(T, UnityAction)
Set the OnStop callback for the audio player.
Declaration
public static T SetOnStopCallback<T>(this T audioPlayer, UnityAction onStop)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onStop | OnStop callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetOnUpdateCallback<T>(T, UnityAction)
Set the OnUpdate callback for the audio player.
Declaration
public static T SetOnUpdateCallback<T>(this T audioPlayer, UnityAction onUpdate)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
UnityAction | onUpdate | OnUpdate callback |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetOutputAudioMixerGroup<T>(T, AudioMixerGroup)
Set the target group to which the AudioSource should route its signal
Declaration
public static T SetOutputAudioMixerGroup<T>(this T audioPlayer, AudioMixerGroup audioMixerGroup)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
AudioMixerGroup | audioMixerGroup | The AudioMixerGroup to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetPanStereo<T>(T, Single)
Set the pan level (left / right bias) of the audio. This only applies to sounds that are Mono or Stereo.
Declaration
public static T SetPanStereo<T>(this T audioPlayer, float panStereo)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | panStereo | The pan level to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetPause<T>(T, Boolean)
Pauses / unpauses the audio
Declaration
public static T SetPause<T>(this T audioPlayer, bool enabled)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Boolean | enabled | True to pause the audio, false to unpause it |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetPitch<T>(T, Single)
Set the pitch of the audio
Declaration
public static T SetPitch<T>(this T audioPlayer, float pitch)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | pitch | The pitch to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetPriority<T>(T, Int32)
Set the priority of the audio. Unity virtualizes AudioSources when there are more AudioSources playing than available hardware channels. The AudioSources with lowest priority (and audibility) are virtualized first. Priority is an integer between 0 and 255. Where, 0 = high priority, 255 = low priority.
Declaration
public static T SetPriority<T>(this T audioPlayer, int priority)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Int32 | priority | The priority to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetRecycleAfterUse<T>(T, Boolean)
Declaration
public static T SetRecycleAfterUse<T>(this T audioPlayer, bool enabled)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | |
Boolean | enabled |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetReverbZoneMix<T>(T, Single)
Set the amount by which the signal from this sound will be mixed into the global reverb associated with the Reverb Zones
Declaration
public static T SetReverbZoneMix<T>(this T audioPlayer, float reverbZoneMix)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | reverbZoneMix | The reverb zone mix to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetSound<T>(T, SoundId)
Loads a sound id into the audio player. If the audio player is already playing a sound, it will be stopped and replaced with the new sound. If the new sound is null, the audio player will be stopped.
Declaration
public static T SetSound<T>(this T audioPlayer, SoundId soundId)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
SoundId | soundId | The sound id to load |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetSound<T>(T, SoundObject, AudioMixerGroup)
Loads a sound object into the audio player. If the audio player is already playing a sound, it will be stopped and replaced with the new sound. If the new sound is null, the audio player will be stopped.
Declaration
public static T SetSound<T>(this T audioPlayer, SoundObject soundObject, AudioMixerGroup audioMixerGroup = null)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
SoundObject | soundObject | The sound object to load |
AudioMixerGroup | audioMixerGroup | The audio mixer group to use for the sound |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetSound<T>(T, String, String, AudioMixerGroup)
Loads a sound object into the audio player. If the audio player is already playing a sound, it will be stopped and replaced with the new sound. If the new sound is null, the audio player will be stopped.
Declaration
public static T SetSound<T>(this T audioPlayer, string libraryName, string soundName, AudioMixerGroup audioMixerGroup = null)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
String | libraryName | The name of the library to load the sound from |
String | soundName | The name of the sound to load |
AudioMixerGroup | audioMixerGroup | The audio mixer group to use for the sound |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetSpatialBlend<T>(T, Single)
Set how much this audio player is affected by 3D spatialisation calculations (attenuation, doppler etc). 0.0 makes the sound full 2D, 1.0 makes it full 3D.
Declaration
public static T SetSpatialBlend<T>(this T audioPlayer, float spatialBlend)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | spatialBlend | The spatial blend to set (0.0 makes the sound full 2D, 1.0 makes it full 3D) |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetSpread<T>(T, Single)
Set the spread angle (in degrees) of a 3d stereo or multichannel sound in speaker space.
Declaration
public static T SetSpread<T>(this T audioPlayer, float spread)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | spread | The spread angle (in degrees) to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
SetVolume<T>(T, Single)
Set the volume of the audio
Declaration
public static T SetVolume<T>(this T audioPlayer, float volume)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | volume | The volume to set |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
StartFadeIn<T>(T)
Starts fading in the volume of the audio player if it is playing. If the audio player is not playing, this method does nothing.
Declaration
public static T StartFadeIn<T>(this T audioPlayer)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
StartFadeIn<T>(T, Single)
Sets the fade in duration and starts fading in the volume of the audio player if it is playing. If the audio player is not playing, this method does nothing.
Declaration
public static T StartFadeIn<T>(this T audioPlayer, float duration)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | duration | Fade in duration |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
StartFadeOut<T>(T)
Starts fading out the volume of the audio player if it is playing. If the audio player is not playing, this method does nothing.
Declaration
public static T StartFadeOut<T>(this T audioPlayer)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
StartFadeOut<T>(T, Single)
Sets the fade out duration and starts fading out the volume of the audio player if it is playing. If the audio player is not playing, this method does nothing.
Declaration
public static T StartFadeOut<T>(this T audioPlayer, float duration)
where T : AudioPlayer
Parameters
Type | Name | Description |
---|---|---|
T | audioPlayer | Target audio player |
Single | duration | Fade out duration |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |