Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/lime/media/AudioBuffer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import flash.net.URLRequest;
#end

/**
The `AudioBuffer` class represents a buffer of audio data that can be played back using an `AudioSource`.
The `AudioBuffer` class represents a buffer of audio data that can be played back using an `AudioSource`.
It supports a variety of audio formats and platforms, providing a consistent API for loading and managing audio data.

Depending on the platform, the audio backend may differ, but the class provides a unified interface for accessing
Depending on the platform, the audio backend may differ, but the class provides a unified interface for accessing
audio data, whether it's stored in memory, loaded from a file, or streamed.

@see lime.media.AudioSource
Expand Down Expand Up @@ -119,7 +119,13 @@ class AudioBuffer
}

var audioBuffer = new AudioBuffer();
audioBuffer.src = new Howl({src: [base64String], html5: true, preload: false});

#if force_html5_audio
audioBuffer.src = new Howl({src: [base64String], html5: true, preload: true});
#else
audioBuffer.src = new Howl({src: [base64String], preload: true});
#end

return audioBuffer;
#elseif (lime_cffi && !macro)
#if !cs
Expand Down Expand Up @@ -165,7 +171,12 @@ class AudioBuffer

#if (js && html5 && lime_howlerjs)
var audioBuffer = new AudioBuffer();
audioBuffer.src = new Howl({src: ["data:" + __getCodec(bytes) + ";base64," + Base64.encode(bytes)], html5: true, preload: false});

#if force_html5_audio
audioBuffer.src = new Howl({src: ["data:" + __getCodec(bytes) + ";base64," + Base64.encode(bytes)], html5: true, preload: true});
#else
audioBuffer.src = new Howl({src: ["data:" + __getCodec(bytes) + ";base64," + Base64.encode(bytes)], preload: true});
#end

return audioBuffer;
#elseif (lime_cffi && !macro)
Expand Down Expand Up @@ -287,7 +298,7 @@ class AudioBuffer
@return An `AudioBuffer` instance with the decoded audio data.
**/
#if lime_vorbis

public static function fromVorbisFile(vorbisFile:VorbisFile):AudioBuffer
{
if (vorbisFile == null) return null;
Expand Down