Audio class Audio

Manages audio playback for sounds and music.

Constructors

Audio(AudioBackend backend)

Properties

hashCode → int
The hash code for this object.
no setterinherited
musicDuration → double
Gets the total duration of the currently loaded music in seconds.
no setter
musicPosition → double
Gets the current playback position of the music in seconds.
no setter
musicProgress → double
Gets the playback progress of the music, from 0.0 (start) to 1.0 (end).
no setter
musicState ↔ ChannelState
The current playback state of the music. See ChannelState.
getter/setter pair
musicVolume ↔ double
Gets the current volume of the music, ranging from 0.0 (silent) to 1.0 (full volume).
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
initMusicVisualizer([int fftSize = 2048]) → AudioVisualizer
Initializes or reconfigures the AudioVisualizer for the current music.
loadSoundFromFile(Sound sound, String path, Loader loadingInfo) → void
Loads a sound from a file and tracks loading progress.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
obtainFreeChannel(List<int>? targetChannels) → int
Finds and returns the ID of a free (stopped) audio channel.
pauseChannel(int channelId) → void
Pauses the sound playing on the specified channelId.
pauseMusic() → void
Pauses the currently playing music.
playMusic(String path, bool loop, [double loopStart = -1, double loopEnd = -1]) → void
Loads and plays music from the given path.
playSound(Sound sound, {int channel = -1, bool loop = false, double? loopStart, double? loopEnd}) → int
Plays the given Sound.
playSoundOnTargetChannels(Sound sound, {List<int>? targetChannels, bool loop = false, double? loopStart, double? loopEnd}) → int
Plays the given Sound on one of the specified target channels.
resume() → void
Resumes all audio playback that was previously suspended.
resumeChannel(int channelId) → void
Resumes a paused sound on the specified channelId.
resumeMusic() → void
Resumes playback of paused music.
setPan(int channelId, double pan) → void
Sets the stereo panning for the sound on the specified channelId.
setRate(int channelId, double rate) → void
Sets the playback rate for the sound on the specified channelId.
setVolume(int channelId, double volume) → void
Sets the volume for the sound on the specified channelId.
stopChannel(int channelId) → void
Stops the sound playing on the specified channelId.
stopMusic() → void
Stops the currently playing or paused music.
suspend() → void
Suspends all audio playback (music and sounds).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

audioChannelCount → const int