gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > MIDI Loop Controller

#10998 - Zack Parrish - Tue Sep 23, 2003 1:14 am

Okay, I'm just a composer, but none of the programmers in the dev team I am in are too sure about how to code a midi playback device that supports the MIDI Controller #111. What it does is allows you to add intros and such to the music, but without the proper playback device, it's pretty much useless.

If you could direct me to something that explains how to do that, then I would appreciate it very much.

#10999 - tepples - Tue Sep 23, 2003 3:31 am

The reference for standard midi file format (.mid) that I use doesn't mention controller 111, but it does mention another way to make loops in a .mid file. Look under "Meta-Events in an MTrk" for Marker. What you do on the player side:
  • When you find a marker event named "loop start", save the current state of the track (format 0) or the state of all tracks (format 1). Here, "state" includes at least the data address and the delta-time, to allow for quick seeking.
  • When you find a marker event named "loop end", restore the information you saved at "loop start".

However, you have to be using a sequencer program that lets you drop markers into the conductor track.

If I were a programmer on your project, I'd suggest dropping standard MIDI format and using some sort of module format, such as .s3m or .xm with the instruments abstracted out into a separate file.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.