Static methods
staticparseBytesMp3(data:Bytes, startByte:Int = 0):{kbps:Null<Int>, introLengthMs:Null<Int>, buf:AudioBuffer}
Parses bytes from a partial mp3 file, and returns an AudioBuffer with proper sound data.
Parameters:
data | bytes from an MP3 file |
|---|---|
startByte | how many bytes into the original audio are we reading from, to use to calculate extra metadata (introLengthMs) |
Returns:
{buf:AudioBuffer, kbps:Int, introLengthMs:Int} AudioBuffer, kbps of the audio, and the length of the intro in milliseconds
staticpartialLoadAndPlayFile(path:String, rangeStart:Float = 0, rangeEnd:Float = 1):Future<Sound>
Loads partial sound bytes from a file, returning a Sound object. Will play the sound after loading via FlxG.sound.play()
Parameters:
path | |
|---|---|
rangeStart | what percent of the song should it start at |
rangeEnd | what percent of the song should it end at |
Returns:
Future
staticpartialLoadFromFile(path:String, rangeStart:Float = 0, rangeEnd:Float = 1, paddedIntro:Bool = false):Promise_openfl_media_Sound
Loads partial sound bytes from a file, returning a Sound object. Will load via HTTP Range header on HTML5, and load the bytes from the file on native. On subsequent calls, will return a cached Sound object from Assets.cache
Parameters:
path | |
|---|---|
rangeStart | what percent of the song should it start at |
rangeEnd | what percent of the song should it end at |
Returns:
Future