Mail Archives: djgpp/1998/01/18/18:15:23
Charles Crawshaw writes:
>I am trying to write a program which plays a MIDI file. I have got the
>MIDI file specifications and I know how to send and recieve values to
>and from the MPU401 on the soundblaster card. However I'm not sure just
>what I'm sposed to send from the midi file and what needs to be
>ignored.
This subject is really offtopic for a djgpp newsgroup! But since you are
here...
To play a MIDI file on the MPU interface is very easy since you just
have to dump the contents of the file to the card at the appropriate
time. You do have to parse the file contents and interpret the MIDI
messages in order to know how long they are (otherwise there is no way
to distinguish between messages and time delay values) but apart from
that you don't need to do anything special to the data.
But, what sort of soundcard do you have? Although all SB16 or above
cards include an MPU interface, this is normally just a raw connection
to the MIDI output socket, which isn't much good unless you have an
external synth connected to that. If you want to use the internal synth
from your soundcard you will need to find some specs for the OPL2 and
OPL3 FM chips, which are a great deal more complex to program. The
midi.c and adlib.c files from Allegro might be a good place to start
with this...
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa
- Raw text -