Native tracker module decoding for HashLink, with optional Heaps integration.
- adds
openmpt.OpenMPTfor plain HashLink projects - adds Heaps integration so tracker resources are treated as
hxd.res.Sound
modxmits3m
more will be later...
final bytes = sys.io.File.getBytes("music.it");
final decoded = openmpt.OpenMPT.decode(bytes, {
format: PCMFloat,
});
if (decoded == null)
throw openmpt.OpenMPT.describeLastError();Or load directly from file:
final decoded = openmpt.OpenMPT.decodeFromFile("music.it", {
format: PCM16,
});If you need a longer loop-aware preview buffer, use:
final looped = openmpt.OpenMPT.decode(bytes, {
format: PCMFloat,
loopSeconds: 30,
});If Heaps is present, tracker files are recognized as hxd.res.Sound, so you can use them like normal sound resources:
final sound = hxd.Res.music;
final channel = sound.play();This works for tracker resources such as .it, .xm, .mod, and .s3m.
If you want to create Heaps data manually, there are helpers for that too:
final data = openmpt.OpenMPT.decodeToHeapsDataFromFile("music.it", 20);That returns hxd.snd.OpenMPTData, optionally using a finite loop-aware buffer when loopSeconds is provided.
libopenmpt is fetched automatically by CMake, so the repository does not need to vendor the full upstream source tree.
Requirements:
- CMake 3.10+
- Ninja
- MSVC build tools
HASHLINKenvironment variable pointing to your HashLink folder
The project includes a single Windows preset in CMakePresets.json.
cmake --preset release
cmake --build --preset releaseIf you use Visual Studio, opening the folder is enough - it uses the same CMake project and preset.
The native build produces:
openmpt.hdllopenmpt.libon Windows
To run a HashLink app with hlopenmpt, place openmpt.hdll next to your .hl output, or otherwise make sure it is available in the current working directory / HashLink load path.
tests\test-miniaudio.battests\test-openal.battests\test-heaps.battests\run-tests.bat
hlopenmptis meant to complement playback backends such ashlopenalorhlminiaudio- Heaps integration is implemented through macros in
openmpt.Boot/openmpt.Macro
- Linux support
- macOS support
- proper streaming/player API instead of only decode-to-buffer helpers