Code Monkey home page Code Monkey logo

dudejoe870 / godot-openmpt Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 3.0 72.33 MB

A binding for libopenmpt (a sophisticated mod-tracker player library) for Godot 4.2. Can play .xm .s3m .it .umx and many other formats!

License: MIT License

CMake 0.13% Makefile 2.02% Batchfile 1.05% Shell 0.57% Python 0.55% C++ 87.01% M4 0.70% JavaScript 0.01% Lua 1.23% C 4.74% PowerShell 0.01% VBScript 0.01% Inno Setup 0.73% FreeBasic 1.16% CSS 0.01% HTML 0.08% GDScript 0.02%
fasttracker fasttracker2 godot godot-addon godot-plugin godot4 godotengine impulsetracker milkytracker mod-tracker

godot-openmpt's Introduction

OpenMPT for Godot

These are bindings for libopenmpt (The library version of the playback engine of OpenMPT, the modtracker software) made for Godot which allows you to play almost any tracker module format (like .xm or .it or .s3m or even something like .umx aka the Unreal Engine 1 Music format) under the sun as a normal AudioStream (as if it was just a WAV or OGG file)

Why?

Because my game uses mod-tracker music inspired by Deus-Ex, and it also makes looping and dynamic music easier.

Where can I find a pre-built addon?

Just go to the prebuilt branch and use the download ZIP feature of Github, extract it into your project and you're done!

If you want to take a look at a commit that's more recent, then you can download the addon as a CI build artifact from the Github workflow action.

Unfortunately there are no MacOS, Android, iOS, or any 32-bit binaries currently prebuilt. If you need any of those you will have to build them yourself (and in the case of mobile platforms, add them to the .gdextension file)

Documentation

For information on what functions you can use either look at the source code, or look at the in-editor docs for the types AudioStreamMPT and AudioStreamPlaybackMPT.

There is no official written documentation for the time being, but just the function names and parameter names should most likely be helpful enough; and if you know any amount of C++, the code should be pretty easy to parse.

What platforms does it support?

In theory, all of them. In practice building for certain platforms sucks and so hasn't been tested. I have only tested Windows and Linux thus far. As for MacOS... I don't have a Mac neither do I have the money for one so unless someone else would like to volunteer to compile it and provide fixes if anything goes wrong on Mac, I can't test it myself. Blame Apple for having stupid licensing in regards to their system headers, otherwise cross-compilation probably wouldn't be that hard.

As for mobile platforms, I haven't tested them either because I don't make mobile games and iOS has a lot of the same issues as MacOS does (don't have an iPhone either). Android should probably work, but it hasn't been tested. (Just like with MacOS open an issue if you run into any problems)

How to build

This project uses CMake so it's recommended to use that (even for building godot-cpp as the library names are different and I had issues mixing SCons and CMake before).

It has been tested on Windows and Linux. MacOS might work but you're on your own (at least for now), open an issue if it has any problems and I'll try to address them or you can address them yourself in a PR (probably easier if you can, since I can't test things without a Mac).

godot-cpp (both platforms)

If you're on Windows, you'll still want to use CMake from the terminal and not from Visual Studio like recommended below.

Open the custom-godotcpp-build directory in the terminal. Here we'll use CMake with this as the source and the binary directory (this is required for the main build script to work).

There is an optional define called GENERATE_DEBUG_SYMBOLS, this is the reason we need a custom build script in the first place. If you're developing and ran into an error in GodotCPP, feel free to turn it on, but if you're just building this for any other reason define it to be OFF (-DGENERATE_DEBUG_SYMBOLS=OFF). Otherwise, the binaries will end up being pretty big (perhaps so big that Github won't even let you push the files anymore!), so use with caution.

If you want to build both Release and Debug versions you'll have to define the CMAKE_BUILD_TYPE, then delete all the extra CMake generated files (other than the bin and gen directories) then define CMAKE_BUILD_TYPE again as the opposite value. This will generate both required libraries for Release and Debug.

Windows Build Instructions

Requirements

I recommend using Visual Studio 2022 and its CMake integration.

The Addon

Open the root repository directory in Visual Studio 2022 and build it in x64-Debug.

Create a configuration for x64-Release setting the build type appropriately in the panel, build that as well.

After this is done you will have both .dlls in the bin directory of the addon folder.

Linux Build Instructions

Requirements

You will need cmake, either the gcc toolchain or the clang/llvm toolchain (this is actually relatively untested as of the latest buildsystem changes, so it may or may not work with Clang anymore). Also recommended is ninja-build for the build system.

The Addon

Run CMake in the root repository directory, in this case cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=<INSERT EITHER Release OR Debug HERE>, then cd build && ninja.

After this is done you will have a .so file(s) in the bin directory of the addon folder.

After Build

Now you're pretty much done, just copy the addon directory to your Godot project, reload it if you have it open, enable the importer plugin and boom. You now can play your mod-tracker formats as a regular audio stream (and even manipulate the playback of them quite a lot).

Problems?

Open an issue, I'll be happy to take a look. I can't guarantee support though, I'm just a solo hobby developer, but I'm more than willing to take feedback or try to help if I can.

This code is experimental, however it is functional (at least on my machine)

godot-openmpt's People

Contributors

dudejoe870 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

godot-openmpt's Issues

VST in MPTM files, effects and instruments

MPTM files are pretty great and I'm glad you have them working. I've been looking for a solution like this since I love making small music for games in MPTracker and it's ancestors. I hope the Channel control (maybe row/order position control also?) are as trival as you say and I'll enjoy as much dynamic control of tracker files as I can get. Something I had a lot of control over a couple of decades ago with these types of files.

Now, we all know about MPTracker and that it uses this library for playback, but it's also a VST host. I'm not sure if that is a separate functionality to the libopenmpt library off the top of my head but I put together some free VST .dlls in the same folder as the .mptm file and while It works in the tracker it doesn't in the addon. It doesn't crash or error either, so that's good. I'm not too surprised. But if this is at all possible, it would be next level to have control over your own instruments in that way. Still I think having OPL synths working is pretty great, and they do work in .mptm with your addon, so some non-sampler, analog like synth is available and OPL is nice and retro, but it would be great to have a modern system of synth and effects working as well. Great work and keep it up.

Building not making .dlls for first step, only .libs

Using Visual Studio 2022, I use the default debug, build all and it's successful. I make the release config and build all as well, successful. So both build, I have gen folders, but make only .lib files so I have no .dll files to drop into the bin of the root godot-cpp. Am I doing something wrong?

Getting a lot of the warning:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Warning	D9025	overriding '/W3' with '/W4'	D:\dev\godot_extentions\godot libopenmpt\godot-openmpt\godot-cpp\out\build\x64-Debug\godot-cpp	D:\dev\godot_extentions\godot libopenmpt\godot-openmpt\godot-cpp\out\build\x64-Debug\cl	1		

Errors preventing build.

Getting the following errors:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	C1083	Cannot open include file: 'godot_cpp/classes/audio_stream.hpp': No such file or directory	godot-openmpt	D:\dev\godot_extentions\godot libopenmpt\godot-openmpt\src\audio_stream_mpt.h	4		
Error	C1083	Cannot open include file: 'godot_cpp/classes/object.hpp': No such file or directory	godot-openmpt	D:\dev\godot_extentions\godot libopenmpt\godot-openmpt\src\openmpt_singleton.h	4		
Error	C1083	Cannot open include file: 'godot_cpp/classes/global_constants.hpp': No such file or directory	godot-openmpt	D:\dev\godot_extentions\godot libopenmpt\godot-openmpt\godot-cpp\include\godot_cpp\core\property_info.hpp	36		

I feel like I'm missing something. Following your instructions, I run cmake on the custom_* directory, it makes the .sln files and the ALL_BUILD there. I build root of the repo, the directory containing the custom directory in VS 2022. I get these errors where it cannot find these header files.

I also tried specifically cmake -S .\custom-godotcpp-build -B .\custom-godotcpp-build -DGENERATE_DEBUG_SYMBOLS=OFF just to be sure as well as simply "cmake .."I tried using cmake in the root of the repo as well and it makes ALL_BUILD and other's but on building I get the same errors. I've tried building in VS in the custom_* directory as well, both of the last two steps are not in your instructions, but I had to try whatever I could.

Edit: I was thinking the custom-godotcpp build was working the original godot-cpp directory. I guess it does not. I'll have to try again after that make finishes.

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.