audiality2
audiality2 copied to clipboard
Standardized MIDI handler program
The "interface" of the miditest*.a2s examples currently looks like this:
export Song(P V=1 L=0)
{
[...]
// MIDI handler entry point
7(Msg Ch Arg1 Arg2) {
[...]
if Msg == MIDI.NOTEOFF {
[...]
} else if Msg == MIDI.NOTEON {
[...]
} else if Msg == MIDI.CONTROLCHANGE {
[...]
} else [...]
[...]
}
}
The use of message 7 for MIDI is currently hardwired in the MIDI driver, and there's no API for changing it. However, there's no standardized arguments for the MIDI handler program!
The L (loop) argument is of course irrelevant for MIDI handlers, but the P and V arguments (similar to what's used for the "sort of" standardized instruments) make a lot of sense; transpose and volume, obviously.
It might make sense to also recommend that MIDI handlers implement some other message handlers:
- 1(): Volume
- 2(): Transpose
- 3(): All notes off (Optional arguments specifies MIDI channel?)
Finally, it would be nice if there was a standard name for the "main" MIDI handler programs in an .a2s file, similar to the Song program for songs, so that a2play can autodetect it, instead of requiring the -M switch.