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

From: "Tony O'Bryan" <aho450s AT nic DOT smsu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Playing Midi in allegro
Date: Thu, 20 Nov 1997 10:20:24 -0600
Organization: Southwest Missouri State University
Lines: 24
Message-ID: <34746348.17C1@nic.smsu.edu>
References: <34738705 DOT 1F8CB3B4 AT primenet DOT com> <3473965C DOT 6DA9 AT nic DOT smsu DOT edu> <3473CABF DOT DCB989AC AT primenet DOT com>
Reply-To: aho450s AT nic DOT smsu DOT edu
NNTP-Posting-Host: sara.a38.smsu.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I should know better than to post untested code. :)  Here is a tested,
working bare-bones MIDI playing Allegro program.  Replace my MIDI file
reference with your own MIDI file (I used a MIDI file that came with
Visual Basic 5.0).  Keep in mind that it doesn't do any error checking
(for simplicity of illustration).

#include <allegro.h>

int main(void)
  {
  MIDI *MidiFile;

  allegro_init();
  install_timer();
  install_keyboard();
  install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,NULL);

  MidiFile = load_midi("/vb/samples/comptool/mci/mcitest.mid");
  play_midi(MidiFile,FALSE);

  while (!key[KEY_ESC]);

  return 0;
  }

- Raw text -


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