IAudioPlayer
The interface of the AudioPlayer, it's the main entry of the Method Chaining
Last updated
The interface of the AudioPlayer, it's the main entry of the Method Chaining
Last updated
Ami.BroAudio
public
When is called, it returns an IAudioPlayer representing the AudioPlayer currently playing the audio. You can chain more methods after this, or cache the instance for later use.
This interface is composed of several interfaces, including , , , .
The AudioPlayer has utilized the , which will recycle the AudioPlayer to the pool once it has finished its playing (or being stopped manually).
If you've cached the instance of the AudioPlayer and tried to access it after it finished (recycled). To avoid accessing the wrong player, Bro will reject your access and log a warning to indicate the target player is unavailable.
ID
SoundID, int
IsPlaying
bool
Return true if the player's AudioSource is playing
IsActive
bool
Returns true if the player is about to play or is playing
AudioSource
Gets the AudioSource component of the player
CurrentPlayingClip
IBroAudioClip
Gets the clip that the player is playing
Triggered when the audio player has finished playing
GetOutputData
void
float[] samples, int channels
GetSpectrumData
void
SetPitch
IAudioPlayer
float pitch
Set the player's pitch.
IAudioPlayer
float pitch, float fadeTime
Set the player's pitch by the given fade time
SetVelocity
IAudioPlayer
int velocity
Set the velocity to determine which audio clip to play
OnStart
IAudioPlayer
Action<IAudioPlayer>
Triggered when the AudioPlayer starts playing
OnUpdate
IAudioPlayer
Action<IAudioPlayer>
Triggered each frame while the AudioPlayer is playing
OnEnd
IAudioPlayer
Action<IAudioPlayer>
Triggered when the AudioPlayer stops playing
OnAudioFilterRead
IAudioPlayer
Action<float[], int>
Stop
void
none
Stop playing the audio
void
Action onFinished
Stop playing and trigger the action when it's finished
void
float fadeOut
Stop playing the audio by the given fadeOut time
void
Action onFinished, float fadeOut
Stop playing the audio by the given fadeOut time, and trigger the action when it's finished
Pause
void
none
Pause the audio
void
float fadeOut
Pause by the given fadeOut time
UnPause
void
none
Resume the paused audio
void
float fadeIn
Resume the paused audio by the given fadeIn time
SetVolume
IAudioPlayer
float volume
Set the player's volume (acceptable range 0~10)
void
float volume, float fadeTime
Set the player's volume by the given fadeTime
AsBGM
none
Set the player as a music player, which will transition automatically if another BGM is played after it
AsDominator
none
Set the player as a dominator player, which will affect or change the behavior of other audio players during its playback
SetScheduledStartTime
IAudioPlayer
double dspTime
SetScheduledEndTime
IAudioPlayer
double dspTime
Changes the time at which a sound that has already been scheduled to play will end.
SetDelay
IAudioPlayer
float time
Delays the playback start time by the specified duration in seconds.
The that the player is playing
OnEndPlaying deprecated <use instead>
event Action<>
Similar to , It's recommended to use this in
float[] samples, int channels, window
Similar to, It's recommended to use this in
Similar to .OnAudioFilterRead().
Schedules the sound to start playing at a specific time on the absolute timeline that reads from .