delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/20/02:32:12

From: Mike McLean <libolt AT primenet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Playing Midi in allegro
Date: 19 Nov 1997 23:26:00 -0700
Organization: Primenet Services for the Internet
Lines: 37
Message-ID: <3473D845.73E8B87E@primenet.com>
References: <34738705 DOT 1F8CB3B4 AT primenet DOT com> <3473965C DOT 6DA9 AT nic DOT smsu DOT edu> <650h5h$q62$2 AT news DOT ox DOT ac DOT uk>
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019