FAST SDK Coding Reference 1.0.3
|
A class to play AudioClips
from a playlist.
More...
Public Member Functions | |
void | AddToPlaylist (AudioClip audioClip) |
Add an AudioClip to the end of the playlist. | |
void | ClearPlaylist () |
Remove all the clips from the playlist. | |
void | NewPlaylist (AudioClip[] audioClips) |
Change the playlist and stop the player. | |
void | Pause () |
Pauses the AudioPlayer playback by pausing the underlying AudioSource . | |
void | Play () |
Start playing the playlist from the beginning. | |
void | Play (AudioClip[] audioClips) |
Change the playlist and start playing it from the beginning. | |
void | Stop () |
Stop playing audio. This does not pause the playlist. | |
void | UnPause () |
Unpauses the AudioPlayer playback by unpausing the underlying AudioSource . | |
Public Attributes | |
bool | isFadeVolumeOnStop = false |
Inspector, Code Set to true to fade the volume as the AudioPlayer stops. | |
UnityEvent< string > | OnClipEnd |
Inspector, Code Calls the function(s) subscribed to this UnityEvent when an AudioClip reaches the end. | |
UnityEvent< string > | OnClipStart |
Inspector, Code Calls the function(s) subscribed to this UnityEvent when an AudioClip starts playing. | |
UnityEvent< string > | OnClipStop |
Inspector, Code Calls the function(s) subscribed to this UnityEvent when an AudioClip stops playing before it reaches the end. | |
bool[] | targetChannels = new bool[2] |
Inspector, Code The array to select which channels to use. Set an element to true if that index represents a channel to use. | |
float | volumeFadeDuration = 0.5f |
Inspector, Code The volume fade duration in seconds when the AudioPlayer stops if FAST.AudioPlayer.isFadeVolumeOnStop is set to true . | |
Properties | |
bool | IsPaused [get] |
Indicates the AudioPlayer playback is paused if true . | |
bool | IsRunning [get] |
Indicates the AudioPlayer is running a play or stop command if true . | |
float | MaxVolume [get, set] |
Inspector, Code The maximum volume of the AudioSources associated with this AudioPlayer . | |
float | Progress [get] |
Indicates the amount of the playlist that has been played so far. | |
Private Attributes | |
List< AudioClip > | playlist = new() |
Inspector, Runtime The list of AudioClips that are playing or queued to play when the AudioPlayer begins playing. | |
A class to play AudioClips
from a playlist.
This class was designed primiarily for narration, but it could be used for any type of audio.
void AddToPlaylist | ( | AudioClip | audioClip | ) |
Add an AudioClip
to the end of the playlist.
This does not interrupt the AudioPlayer
.
audioClip | The AudioClip to add to the playlist. |
void ClearPlaylist | ( | ) |
Remove all the clips from the playlist.
If an AudioClip
is currently playing, it will finish and then the AudioPlayer
will stop.
void NewPlaylist | ( | AudioClip[] | audioClips | ) |
Change the playlist and stop the player.
audioClips | The new playlist of AudioClips . |
void Pause | ( | ) |
Pauses the AudioPlayer
playback by pausing the underlying AudioSource
.
void Play | ( | ) |
Start playing the playlist from the beginning.
If the AudioPlayer
is already playing, it will restart the playlist.
void Play | ( | AudioClip[] | audioClips | ) |
Change the playlist and start playing it from the beginning.
If the AudioPlayer
is already playing, it will restart the playlist.
audioClips | The new playlist of AudioClips . |
void Stop | ( | ) |
Stop playing audio. This does not pause the playlist.
If you play after calling Stop()
, the playlist will restart from the beginning.
void UnPause | ( | ) |
Unpauses the AudioPlayer
playback by unpausing the underlying AudioSource
.
bool isFadeVolumeOnStop = false |
Inspector, Code
Set to true
to fade the volume as the AudioPlayer
stops.
UnityEvent<string> OnClipEnd |
Inspector, Code
Calls the function(s) subscribed to this UnityEvent
when an AudioClip
reaches the end.
The string
parameter passed into the callback function(s) is the name of the AudioClip
that reached the end.
UnityEvent<string> OnClipStart |
Inspector, Code
Calls the function(s) subscribed to this UnityEvent
when an AudioClip
starts playing.
The string
parameter passed into the callback function(s) is the name of the AudioClip
that started playing.
UnityEvent<string> OnClipStop |
Inspector, Code
Calls the function(s) subscribed to this UnityEvent
when an AudioClip
stops playing before it reaches the end.
The string
parameter passed into the callback function(s) is the name of the AudioClip
that stopped playing.
|
private |
Inspector, Runtime
The list of AudioClips
that are playing or queued to play when the AudioPlayer
begins playing.
This attribute is primarily to make the playlist visible in the Inspector at runtime. Use the AudioPlayer
functions to modify the playlist.
bool [] targetChannels = new bool[2] |
Inspector, Code
The array to select which channels to use. Set an element to true
if that index represents a channel to use.
Most commonly, set the array size to the number of audio channels used in the application.
float volumeFadeDuration = 0.5f |
Inspector, Code
The volume fade duration in seconds when the AudioPlayer
stops if FAST.AudioPlayer.isFadeVolumeOnStop is set to true
.
|
get |
Indicates the AudioPlayer
playback is paused if true
.
|
get |
Indicates the AudioPlayer
is running a play or stop command if true
.
|
getset |
Inspector, Code
The maximum volume of the AudioSources
associated with this AudioPlayer
.
The volume range is clamped to [0.0, 1.0]
|
get |
Indicates the amount of the playlist that has been played so far.
The progress range is normalized to [0.0, 1.0]