Feature: Add native MP3 decoding support via minimp3#2055
Open
MasterAlexS wants to merge 1 commit intoopenfl:8.4.0-devfrom
Open
Feature: Add native MP3 decoding support via minimp3#2055MasterAlexS wants to merge 1 commit intoopenfl:8.4.0-devfrom
MasterAlexS wants to merge 1 commit intoopenfl:8.4.0-devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds native support for decoding and playing MP3 files in the C++ backend, matching the existing architecture used for WAV and OGG formats.
To keep the implementation lightweight and avoid heavy external dependencies, this uses the
minimp3header-only library (which is already included in the ecosystem for the HashLink target).Changes made
minimp3as a Git submodule inlib/minimp3.Build.xmlto include theLIME_MP3flag and createdlib/mp3-files.xmlfor the build toolkit configuration.include/media/containers/MP3.handsrc/media/containers/MP3.cppwith theDecodemethod. It handles both memory buffers and file paths. Memory is safely mapped to Haxe'sArrayBufferViewusingalloc_null()with explicit byte assignment.src/ExternalInterface.cpp(lime_audio_load_bytes,hl_audio_load_bytes,lime_audio_load_file,hl_audio_load_file) to properly route MP3 checks to the new decoder.Testing
AudioBuffer.loadFromFile()and successfully played the decoded MP3 data throughAudioSource.