Mail Archives: djgpp/1997/11/20/02:32:12
George Foot wrote:
>
> Here are some small but significant corrections to what Tony O'Bryan wrote:
>
> #include <allegro.h>
>
> int main(int argc, char *argv[])
> {
> MIDI *MissionHandler; /* need to keep track of resources */
>
> allegro_init(); /* must initialize Allegro first */
> install_timer(); /* must install the timer before using MIDIs */
> install_sound(DIGI_AUTODETECT /* or DIGI_NONE */, MIDI_AUTODETECT, argv[0]);
> install_keyboard(); /* so that we can wait for a keypress later on */
>
> MissionHandler = load_midi("mission.mid");
> play_midi(MissionHandler,1);
>
> while (!keypressed()); /* wait for a keypress, otherwise it will stop immediately! */
>
> return 0; /* successful exit */
> }
>
> Can I refer you to ex16.c, which is a pretty minimal example of using
> MIDI files? It also has frills like freeing up the MIDI file on exit,
> and checking for errors when loading the file and installing the sound
> drivers.
>
> Needless to say, all the functions used above are well documented in
> the documentation -- look them up for more details. Especially, look
> up install_timer() and learn which Allegro components need it before
> they'll work! ;)
>
> --
> george DOT foot AT merton DOT oxford DOT ac DOT uk
thanks for the help, it works now :)
- Raw text -