SoLoud class interface
The main class to call all the audio methods that play sounds.
This class has a singleton instance which represents the (also singleton) instance of the SoLoud (C++) engine.
For methods that capture sounds, use SoLoudCapture.
Properties
-
activeSounds
→ Iterable<
AudioSource> -
The sounds that are currently being played.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialized
→ FutureOr<
bool> -
A Future that returns
true
when the audio engine is initialized (and ready to play sounds, for example).no setter - isInitialized → bool
-
The current status of the engine. This is
true
when the engine has been initialized and is immediately ready.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addGlobalFilter(
FilterType filterType) → void -
Adds a
filterType
to all sounds. -
countAudioSource(
AudioSource audioSource) → int - Returns the number of concurrent sounds that are playing a specific audio source.
-
deinit(
) → void - Stops the engine and disposes of all resources, including sounds and the audio isolate in a synchronous way.
-
disposeAllSources(
) → Future< void> - Disposes all audio sources that are currently loaded. Also stops all sound instances if anything is playing.
-
disposeSource(
AudioSource source) → Future< void> -
Stops all handles of the already loaded
source
, and reclaims memory. -
fadeGlobalVolume(
double to, Duration time) → void -
Smoothly changes the global volume to the value of
to
over specifiedtime
. -
fadePan(
SoundHandle handle, double to, Duration time) → void -
Smoothly changes a currently playing sound's pan setting
to the value of
to
over specifiedtime
. -
fadeRelativePlaySpeed(
SoundHandle handle, double to, Duration time) → void -
Smoothly changes a currently playing sound's relative play speed
to the value of
to
over specifiedtime
. -
fadeVolume(
SoundHandle handle, double to, Duration time) → void -
Smoothly changes a single sound instance's volume
to the value of
to
over the specifiedtime
. -
get3dSoundSpeed(
) → double - Gets the speed of sound.
-
getActiveVoiceCount(
) → int - Returns the number of concurrent sounds that are playing at the moment.
-
getAudioTexture2D(
Pointer< Pointer< audioData) → voidFloat> > - Return a floats matrix of 256x512. Every row are composed of 256 FFT values plus 256 of wave data. Every time is called, a new row is stored in the first row and all the previous rows are shifted up. The last one will be lost.
-
getFilterParameter(
FilterType filterType, int attributeId) → double -
Gets the value of a parameter of the given
filterType
. -
getFilterParamNames(
FilterType filterType) → List< String> -
Gets parameters of the given
filterType
. -
getFxParams(
FilterType filterType, int attributeId) → double - Deprecated alias of getFilterParameter.
-
getGlobalVolume(
) → double - Gets the current global volume.
-
getIsValidVoiceHandle(
SoundHandle handle) → bool -
Check if the
handle
is still valid. -
getLength(
AudioSource source) → Duration -
Get the length of a loaded audio
source
. -
getLooping(
SoundHandle handle) → bool -
Query whether a sound (supplied via
handle
) is set to loop. -
getLoopPoint(
SoundHandle handle) → Duration -
Get the loop point value of a currently playing sound, provided via
its
handle
. -
getMaxActiveVoiceCount(
) → int - Gets the current maximum active voice count.
-
getPause(
SoundHandle handle) → bool -
Gets the pause state of a currently playing sound identified by
handle
. -
getPosition(
SoundHandle handle) → Duration -
Get the current sound position of a sound instance (provided via its
handle
). -
getProtectVoice(
SoundHandle handle) → bool - Get a sound's protection state.
-
getRelativePlaySpeed(
SoundHandle handle) → double -
Get a sound's relative play speed. Provide the sound instance via
its
handle
. -
getVisualizationEnabled(
) → bool - Get visualization state.
-
getVoiceCount(
) → int - Returns the number of voices the application has told SoLoud to play.
-
getVolume(
SoundHandle handle) → double -
Get the volume of the currently playing sound instance, provided
via its
handle
. -
init(
{Duration timeout = const Duration(seconds: 10), bool automaticCleanup = false}) → Future< void> - Initializes the audio engine.
-
isFilterActive(
FilterType filterType) → int -
Checks whether the given
filterType
is active. -
loadAsset(
String key, {LoadMode mode = LoadMode.memory, AssetBundle? assetBundle}) → Future< AudioSource> - Load a new sound to be played once or multiple times later, from an asset.
-
loadFile(
String path, {LoadMode mode = LoadMode.memory}) → Future< AudioSource> - Load a new sound to be played once or multiple times later, from the file system.
-
loadUrl(
String url, {LoadMode mode = LoadMode.memory, Client? httpClient}) → Future< AudioSource> - Load a new sound to be played once or multiple times later, from a network URL.
-
loadWaveform(
WaveForm waveform, bool superWave, double scale, double detune) → Future< AudioSource> - Load a new waveform to be played once or multiple times later.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
oscillateGlobalVolume(
double from, double to, Duration time) → void - Set fader to oscillate the global volume at specified frequency.
-
oscillatePan(
SoundHandle handle, double from, double to, Duration time) → void - Sets oscillation of the pan at specified frequency.
-
oscillateRelativePlaySpeed(
SoundHandle handle, double from, double to, Duration time) → void - Sets oscillation of the play speed at specified frequency.
-
oscillateVolume(
SoundHandle handle, double from, double to, Duration time) → void - Sets fader to oscillate the volume at specified frequency.
-
pauseSwitch(
SoundHandle handle) → void -
Pause or unpause a currently playing sound identified by
handle
. -
play(
AudioSource sound, {double volume = 1, double pan = 0, bool paused = false, bool looping = false, Duration loopingStartAt = Duration.zero}) → Future< SoundHandle> -
Play an already-loaded sound identified by
sound
. Creates a new playing instance of the sound, and returns its SoundHandle. -
play3d(
AudioSource sound, double posX, double posY, double posZ, {double velX = 0, double velY = 0, double velZ = 0, double volume = 1, bool paused = false, bool looping = false, Duration loopingStartAt = Duration.zero}) → Future< SoundHandle> - This function is the 3D version of the play call.
-
removeGlobalFilter(
FilterType filterType) → void -
Removes
filterType
from all sounds. -
schedulePause(
SoundHandle handle, Duration time) → void -
Waits the specified
time
, then pauses the currently playing sound. -
scheduleStop(
SoundHandle handle, Duration time) → void -
Waits the specified
time
, then stops the currently playing sound. -
seek(
SoundHandle handle, Duration time) → void -
Seek a currently playing sound instance, provided via its
handle
. Specify thetime
(as a Duration) to which you want to move the play head. -
set3dListenerAt(
double atX, double atY, double atZ) → void - Sets the at-vector (i.e. position) parameter of the 3D audio listener.
-
set3dListenerParameters(
double posX, double posY, double posZ, double atX, double atY, double atZ, double upX, double upY, double upZ, double velocityX, double velocityY, double velocityZ) → void - Sets the position, at-vector, up-vector and velocity parameters of the 3D audio listener with one call.
-
set3dListenerPosition(
double posX, double posY, double posZ) → void - Sets the position parameter of the 3D audio listener.
-
set3dListenerUp(
double upX, double upY, double upZ) → void - Sets the up-vector parameter of the 3D audio listener.
-
set3dListenerVelocity(
double velocityX, double velocityY, double velocityZ) → void - Sets the 3D listener's velocity vector.
-
set3dSoundSpeed(
double speed) → void - Since SoLoud has no knowledge of the scale of your coordinates, you may need to adjust the speed of sound for these effects to work correctly. The default value is 343, which assumes that your world coordinates are in meters (where 1 unit is 1 meter), and that the environment is dry air at around 20 degrees Celsius.
-
set3dSourceAttenuation(
SoundHandle handle, int attenuationModel, double attenuationRolloffFactor) → void - You can change the attenuation model and rolloff factor parameters of a live 3D audio source.
-
set3dSourceDopplerFactor(
SoundHandle handle, double dopplerFactor) → void - Sets the doppler factor of a live 3D audio source.
-
set3dSourceMinMaxDistance(
SoundHandle handle, double minDistance, double maxDistance) → void - Sets the minimum and maximum distance parameters of a live 3D audio source.
-
set3dSourceParameters(
SoundHandle handle, double posX, double posY, double posZ, double velocityX, double velocityY, double velocityZ) → void - Sets the position and velocity parameters of a live 3D audio source with one call.
-
set3dSourcePosition(
SoundHandle handle, double posX, double posY, double posZ) → void - Sets the position of a live 3D audio source.
-
set3dSourceVelocity(
SoundHandle handle, double velocityX, double velocityY, double velocityZ) → void - Set the velocity parameter of a live 3D audio source.
-
setFftSmoothing(
double smooth) → void - Smooth FFT data. When new data is read and the values are decreasing, the new value will be decreased with an amplitude between the old and the new value. This will resul on a less shaky visualization.
-
setFilterParameter(
FilterType filterType, int attributeId, double value) → void -
Sets a parameter of the given
filterType
. -
setGlobalVolume(
double volume) → void - Sets the global volume which affects all sounds.
-
setLooping(
SoundHandle handle, bool enable) → void -
Set the looping flag of a currently playing sound, provided via
its
handle
. -
setLoopPoint(
SoundHandle handle, Duration time) → void -
Set the loop point of a currently playing sound, provided via
its
handle
. -
setMaxActiveVoiceCount(
int maxVoiceCount) → void - Sets the current maximum active voice count.
-
setPause(
SoundHandle handle, bool pause) → void -
Pause or unpause a currently playing sound identified by
handle
. -
setProtectVoice(
SoundHandle handle, bool protect) → void - Sets a sound instance's protection state.
-
setRelativePlaySpeed(
SoundHandle handle, double speed) → void - Set a sound's relative play speed.
-
setVisualizationEnabled(
bool enabled) → void - Enable or disable visualization.
-
setVolume(
SoundHandle handle, double volume) → void -
Set the volume for a currently playing sound instance, provided
via its
handle
. -
setWaveform(
AudioSource sound, WaveForm newWaveform) → void - Set a waveform type to the given sound: see WaveForm enum.
-
setWaveformDetune(
AudioSource sound, double newDetune) → void -
If this sound is a
superWave
you can change the detune at runtime. -
setWaveformFreq(
AudioSource sound, double newFrequency) → void - Set the frequency of the given waveform sound.
-
setWaveformScale(
AudioSource sound, double newScale) → void -
If this sound is a
superWave
you can change the scale at runtime. -
setWaveformSuperWave(
AudioSource sound, bool superwave) → void - Set the given waveform sound's super wave flag.
-
speechText(
String textToSpeech) → Future< AudioSource> -
Create a new audio source from the given
textToSpeech
. -
stop(
SoundHandle handle) → Future< void> -
Stop a currently playing sound identified by
handle
and clear it from the sound handle list. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited