Code Monkey home page Code Monkey logo

html5_mixer's Introduction

html5_mixer

This is a minimal drop-in replacement for the music functions of SDL2_mixer to be used with the Emscripten compiler. It uses HTML5 <audio> to render music.

Overview

emscripten-ports/SDL2_mixer is a WebAssembly port that performs all sound decoding in WASM. It pushes samples via emscripten-ports/SDL2 to a Web Audio context for playback.

While this approach ensures the highest parity with native builds, the program is susceptible to dropped samples and playback stutters because music decoding and audio rendering both occur in the main thread.

To reduce processing load, we implement the SDL2_mixer interface to use the browser's native playback features via <audio>.

How to Use

Download this package to a location of your choice. Specify ./include in your "Include" directories and specify the files within ./src in your sources.

In your compiler and linker flags, specify -s USE_SDL=2. You may use this library concurrently with SDL Mixer (-s USE_SDL_MIXER=2), but this is not required.

You may shim SDL Mixer's Mix_*() music functions by specifying -DHTML5_MIXER_SHIM_MUSIC in your macro defines.

Support exists to link this library without SDL2, but this is untested. If you wish to try, specify -DHTML5_MIXER_NO_SDL.

Notes

We do not perform any decoding; we merely pass the URL or data buffer to an Audio() instance.

Your audio files must be supported by the user's web browser. For a format compatibility table, see Wikipedia.

Currently, we support a minimal subset of the SDL2_mixer API. See issue #1 for progress.

Potential Next Steps

See Also

License

The html5_mixer code is released under MIT License.

This project incorporates code from SDL_mixer_html5 which is released under 3-clause BSD License.

html5_mixer's People

Contributors

devappd avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.