Skip to content

tommyettinger/libgdx-oboe

 
 

Repository files navigation

Icon

libGDX Oboe

libGDX oboe

Reimplementation of the Audio interface for libGDX framework using Oboe and FFmpeg, which allows music to flow without any delay or another unpleasant distortion.

And if you ever asked yourself "Why is my libGDX app music is so broken ?", then you've come to the right place.

🔰 How to Use🎺 Explore Examples🚜 How to Build

Content of docs directory.

Quick, show me some code !

Here is how do one essentially "use" this library (code in Kotlin):

class AndroidLauncher : AndroidApplication() {
    // Magic happens here:
    override fun createAudio(context: Context, config: AndroidApplicationConfiguration): AndroidAudio =
            OboeAudio(context.assets)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        // Create an app like always
        val config = AndroidApplicationConfiguration()
        initialize(SomeApp(), config)
    }
}

How does this works ?

Using Oboe library from Google, you can create high-performance audio streams which may plug in and tweak some features in runtime to boost speed even further. This streams are native, so there is no GC that will slow things down. For audio decoding, this library also provide native tools: libavformat and friends (FFmpeg) with MP3, OGG and WAV support only. Such audio decoder is blazing fast, so combining that with oboe streams, we get ourselves responsive and fast Audio implementation.

State of features

Here is a table of known goodies and problems for certain features per file format (decoder):

FeatureWAVOGGMP3
🧮State🧮State🧮State
Seek⭐️Precise, no content lost.👌Bad initial seek, but dropping frames until PTS is equal to desired seek TS. May lose some content if PTS isn't precise enough.👌Same as OGG.

Progress:

OboeAudio class:

  • newSound method (With OboeSound);
  • newMusic method (With OboeMusic);
  • newAudioDevice method (With OboeAudioDevice);
  • newAudioRecorder method.

WARN: not marked methods will result in undefined behaviour. (actually, just a crash)

About

🎶 libGDX audio replacement for Android (API 16+) built on top of Oboe.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 81.7%
  • Shell 7.9%
  • Kotlin 7.8%
  • CMake 2.6%