Skip to content

An example integration of libxmp-lite into Godot 4 through GDExtension and a custom AudioStream

License

Notifications You must be signed in to change notification settings

oparisy/gdextension-module

Repository files navigation

GDExtension Module Player

This repository provides an example of real-time Godot 4.3 sound generation by integrating the libxmp-lite module-decoding library in a custom AudioStream with the GDExtension system.

It is mostly a proof of concept, but I'm open to PRs if this proves useful to someone. Note that a pure GDScript module player exists (Godot Mod Player).

Code is based on gdextension-custom-audiostream. Have a look at that project for more details about GDExtension, debugger usage...

Credits & Distribution

This repository includes libxmp as a submodule, in conformance with its MIT license. Scons will include it to the GDExtension library during build.

Public Domain module files are included with this module for testing purpose; see game/CREDITS for details.

Using the Extension

After cloning and building the extension (see below), open game/project.godot in Godot Project Manager, and run it. You'll hear a module being played.

If you test this in the editor, by setting the Playing property to true there, you may get audio glitches. This is due to the fact that editor windows are running with default priority. This will not happen with a script/game, since those are run with a higher priority (as can be seen here).

Cloning the Extension

Since this project includes godot-cpp and libxmp as submodules, you'll have to clone it with git clone --recurse-submodules.

Building the Extension

Manual Compilation

To compile the extension you need to follow these steps:

  1. Make sure you cloned the extension recursively as described above

  2. Go to the top level of the project

cd gdextension-module
  1. Compile the extension
scons # this will use the default values such as target=template_debug

VSCode Compilation

For the initial build you can run the vscode task initial-build-extension. This compiles both godot-cpp and the extension. For all subsequent builds, you only need to run the task build-extension.

Previous Versions

Check out the godot-4.2.1-stable tag for a Godot 4.2 compatible version.

About

An example integration of libxmp-lite into Godot 4 through GDExtension and a custom AudioStream

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published