SGDK sync demo with MDSDRV comm signals
sync your game events to the music.
- create interesting boss fights that adjust in realtime to your music tracks.
- make a rhythm game
- sync up the end of one song to perfectly transition into the next with perfect timing.
- anything you can imagine :)
i made a custom fork of MDSDRV.
it enables the unused comm byte to send a single byte every frame. this takes advantage of this by enabling it and allowing the user to send comm bytes.
the following MML will send comm 1 at the start of the first a note, then it will send comm 2 at the start of the b note. it will loop (L) and allow the user to keep track of when the notes happen
A @1 L l4 'comm 1' a 'comm 2' b
we use the MDS_command(16, 0 function to track these comm signals in our SGDK code. the output of MDS_command(16, 0) will simply be a u8 you can use in your game code:
u8 comm_signal;
comm_signal = MDS_command(16, 0);
switch (comm_signal):
{
case 0:
kprintf("signal 0");
break;
case 1:
kprintf("signal 1");
break;
}
this requires a custom MDSDRV and custom mdslink to compile the music:
building these from source and recompiling your MML with mdslink every time you make a change can be annoying/difficult. i have created a custom fork of mmlgui that has a tool to build your MML files:
mmlgui - custom fork
- click on
Toolsfrom the menu and choosemdslink export - choose your mml background music folder
- choose your mml sfx folder
- choose your export directory
- click on
exportand copy the files to theres/mdsdrvdirectory
- the files generated are:
mdspcm.binmdsseq.binmdsseq.h
- compile
mdslinkfrom the mdslink (ctrmml) fork. - tell
mdslinkwhere your MML music and sfx data is, and compile:./mdslink -o "PATH/TO/SGDK/PROJECT/res/mdsdrv/mdsseq.bin" "PATH/TO/SGDK/PROJECT/res/mdsdrv/mdspcm.bin" -h "PATH/TO/SGDK/PROJECT/res/mdsdrv/mdsseq.h" PATH/TO/MML_MUSIC/*.mml PATH/TO/MML_SFX/*.mml - hopefully it works