Skip to content

Vortex2Oblivion/hxopus

Repository files navigation

Haxe support for the Opus Audio Codec

This library works on the C++ target only!

Installation

haxelib install hxopus

Or through git.

haxelib git hxopus https://github.com/Vortex2Oblivion/hxopus.git

Usage

Hxopus provides helper functions for easy playback on some popular game frameworks

OpenFL

// Passing the filename in directly.
var sound:Sound = Opus.toOpenFL("path/to/your/sound.opus");
sound.play();

// Or with the raw bytes
var sound:Sound = Opus.toOpenFL(Assets.getBytes("path/to/your/sound.opus"));
sound.play();

Flixel

// Passing the filename in directly.
var sound:FlxSound = Opus.toFlxSound("path/to/your/sound.opus");
sound.play();

// Or with the raw bytes
var sound:FlxSound = Opus.toFlxSound(Assets.getBytes("path/to/your/sound.opus"));
sound.play();

Other

If you are using another framework you will have to support it yourself. However Hxopus provides helper functions for decoding the audio file and getting the bytes,

Bytes.ofData(Opus.getDecodedBytes(bytes:Bytes));

Credits

Xiph.org Foundation - Libopus and Opusfile libraries.

Gian-Carlo Pascutto - Libogg.

Cherry - CherryAudio used for decoding the opus files and helping me optimize the opus loader.

Carlos Ballesteros Velasco - OpenFL-Opus Referenced a lot when making the ndll for hxopus.

Prio - Shockwave Shuffle Song used for testing playback.

About

Opus audio decoding and playback in haxe.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages