Here is my UDGJ2 entry; ModPlayer and I want socks now It is not of course, but I wanted it to be somehow ready for the UDGJ. Maybe someone wants to use it for their Jam game.
As a dinosaur developer, I miss my C64 and Amiga days. When developing this simple extension I remembered those days a lot.
Mod Player (aka chiptune player) can load and play good old .XM and .MOD file formats.
There are some hitchups, but extension supports MacOS, Windows, Linux, Android, iOS and HTML5. Unfortunately, HTML5 bundle is little tricky. There is a little py script which simplify things for now. Please read the details on Github page.
Most important issue for me is that I couldnāt find a way to retrieve build path when developing on Defold Editor. It returns something like ā¦/Defold.app/⦠and it is not possible to read files from that location. As a workaround I added a player.build_path function for manuel setting. But this is just for working on the editor only. If there is a better way of doing this please let me know.
I couldnāt test the musics on Linux because I couldnāt manage to configure the sound card on my VMs successfully. If someone can test it Iāll be glad.
Other notes and know issues:
Loading and parsing is blocker. It will block the main thread (UI thread). Since the mod files are small it is better to load them when bootstraping or preloading. It may cause a pause on UI.
Loading and parsing .XM files much more faster then .MOD files. Use XM if possible. (Tested with same tracker file as .mod and .xm)
Not %100 compatible with every MOD or XM file.
I couldnāt find a way to retrieve build path when developing on Defold Editor. You have to provide a full path to player.build_path("<FULL_PATH>/res/common/assets/") function for working on Defold Editor only . It doesnāt required when bundling.
Different platform bundles didnāt tested very well.
Ok, so you mean os system folder location, your example of ā<FULL_PATH>/res/common/assets/ā was throwing off because of wrong slash symbols.
But I get error :
Compilation failed: invalid escape sequence near '"D
for your example project on line:
local build_path = "D:\Users\agnis\Documents\Defold\SOURCE\defold-modplayer-master\res\common\assets"
Actually slash symbols are correct. I made a mistake on doc by using \. My bad, sorry about that. (Just updated the doc)
This should work. Donāt forget to add trailing /
local build_path = "D:/Users/agnis/Documents/Defold/SOURCE/defold-modplayer-master/res/common/assets/"
Unfortunately I donāt have a Windows box and I canāt test this with Defold Editor. But this time, I tested this path with Wine and it works. Please let me know it is fail or not.
YES! That is working. I tried backward slash before but didnāt think about trailing one.
I say backward because on window directories have "\ ", I donāt remember if Mac or Linux have an opposite.
Well, the biggest problem with it is to convey the right information to users other than that itās an actually neat workaround.
Sorry, for additional questioning:
I noticed that it does auto-loop for songs so I made test pattern in Milkytracker with 2 snare hits to test and the mod player kept looping it (for the first time returning to start it makes tiny glitchy sounds and Iāve heard those also when it looped included sound files).
Is this mod player usable for game sound effects (single play over music or taking over channel like NES music)?
Iām aware of that glitch. But honestly Iām not sure why it is happening. It happens on some patterns with some samples(only when starting), but I didnāt investigate it yet. (It shouldnāt happend with .mod files, only with .xm) Somehow it is related to my patch. Iāll take a look at this after the UDGJ2
It is better not to trust the loop for pattern continuity. It is not suitable for this kind of job.
Maybe Interesting idea, I never thought about this. It is quite performant but Iām not sure if it is usable for this kind of a job or not. Iāll definitely try this when I got time.
You can set loop by using; player.music_loop(music, 1) ā single play