class FunkinSound
package funkin.audio
extends FlxSound › FlxBasic
implements ICloneable<FunkinSound>
Available on all platforms
A FlxSound which adds additional functionality: - Delayed playback via negative song position. - Easy functions for immediate playback and recycling.
Static variables
staticread onlyonVolumeChanged:FlxTypedSignal<Float ‑> Void>
An FlxSignal which is dispatched when the volume changes.
Static methods
staticload(embeddedSound:FlxSoundAsset, volume:Float = 1.0, looped:Bool = false, autoDestroy:Bool = false, autoPlay:Bool = false, persist:Bool = false, ?onComplete:() ‑> Void, ?onLoad:() ‑> Void, important:Bool = false):Null<FunkinSound>
Creates a new FunkinSound object synchronously.
Parameters:
embeddedSound | The embedded sound resource you want to play. To stream, use the optional URL parameter instead. |
|---|---|
volume | How loud to play it (0 to 1). |
looped | Whether to loop this sound. |
group | The group to add this sound to. |
autoDestroy | Whether to destroy this sound when it finishes playing.
Leave this value set to |
autoPlay | Whether to play the sound immediately or wait for a |
persist | Whether to keep this |
onComplete | Called when the sound finished playing. |
onLoad | Called when the sound finished loading. Called immediately for succesfully loaded embedded sounds. |
important | If |
Returns:
A FunkinSound object, or null if the sound could not be loaded.
staticloadPartial(path:String, start:Float = 0, end:Float = 1, volume:Float = 1.0, looped:Bool = false, autoDestroy:Bool = false, autoPlay:Bool = true, ?onComplete:() ‑> Void, ?onLoad:() ‑> Void):Promise_Null_funkin_audio_FunkinSound
Will load a section of a sound file, useful for Freeplay where we don't want to load all the bytes of a song
Parameters:
path | The path to the sound file |
|---|---|
start | The start time of the sound file |
end | The end time of the sound file |
volume | Volume to start at |
looped | Whether the sound file should loop |
autoDestroy | Whether the sound file should be destroyed after it finishes playing |
autoPlay | Whether the sound file should play immediately |
onComplete | Callback when the sound finishes playing |
onLoad | Callback when the sound finishes loading |
Returns:
A FunkinSound object
staticplayMusic(key:String, params:FunkinSoundPlayMusicParams):Bool
Creates a new FunkinSound object and loads it as the current music track.
Parameters:
key | The key of the music you want to play. Music should be at |
|---|---|
params | A set of additional optional parameters.
Data should be at |
Returns:
Whether the music was started. false if music was already playing or could not be started
staticplayOnce(key:String, volume:Float = 1.0, ?onComplete:() ‑> Void, ?onLoad:() ‑> Void, important:Bool = false):Null<FunkinSound>
Play a sound effect once, then destroy it.
Parameters:
key | |
|---|---|
volume |
Returns:
A FunkinSound object, or null if the sound could not be loaded.
staticsetMusic(newMusic:FunkinSound):Void
Replaces the Flixel current music object with the given FunkinSound object.
Parameters:
newMusic | The new music to be set as the current music. |
|---|
staticstopAllAudio(musicToo:Bool = false, persistToo:Bool = false):Void
Stop all sounds in the pool and allow them to be recycled.
Constructor
Variables
important:Bool = false
If true, the game will forcefully add this sound's channel to the list of playing sounds.
muted:Bool = false
Calculate the current time of the sound.
NOTE: You need to add() the sound to the scene for update() to increment the time.
read onlywaveformData:WaveformData
Waveform data for this sound. This is lazily loaded, so it will be built the first time it is accessed.