www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/14/19:01:46

From: qballlives AT aol DOT com (QBallLives)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: MIDIs not working
Date: 14 Mar 1998 23:56:54 GMT
Lines: 89
Message-ID: <19980314235601.SAA24090@ladder03.news.aol.com>
NNTP-Posting-Host: ladder03.news.aol.com
Organization: AOL http://www.aol.com
References: <19980313211201 DOT QAA23423 AT ladder03 DOT news DOT aol DOT com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm looking and looking... and I'm not seeing anything that looks very wrong -
but Included the code to Allegros ex16.c... because I know that works
(allegro3)

I notice you're sending NULL as a parameter to install_sound, but I read:

int install_sound(int digi_card, int midi_card, char *cfg_path);

that the char *cfg_path is only there for compatablility purposes...

hmmm... could it be that you're loading the midi first???

See code at bottom of post...

>okay, i put this message up and (stupidly) didn't put in the code!! so, my
>problem is i can't get MIDI playing programs to work and here is the code.
>
>#include "stdio.h"
>#include "allegro.h"
>
>main ()
>{
>int allegro_init();
>int install_keyboard();
>int install_timer();
>
>MIDI *rok;
>rok = load_midi("Rockem.mid");
>detect_midi_driver(MIDI_AUTODETECT);
>install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL);
>set_volume(255, 255);
>play_midi(rok, TRUE);
>if(readkey()){
>  destroy_midi(rok);
>  return 0;
> }
>}
>please help!!
>
>

int main(int argc, char *argv[])
{
   MIDI *the_music;

   if (argc != 2) {
      printf("Usage: 'ex16 filename.mid'\n");
      return 1;
   }

   allegro_init();
   install_keyboard(); 
   install_timer();

   /* install a MIDI sound driver */
   if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, argv[0]) != 0) {
      printf("Error initialising sound system\n%s\n", allegro_error);
      return 1;
   }

   /* read in the MIDI file */
   the_music = load_midi(argv[1]);
   if (!the_music) {
      printf("Error reading MIDI file '%s'\n", argv[1]);
      return 1;
   }

   printf("Midi driver: %s\n", midi_driver->name);
   printf("Playing %s\n", argv[1]);

   /* start up the MIDI file */
   play_midi(the_music, TRUE);

   /* wait for a keypress */
   readkey();

   /* destroy the MIDI file */
   destroy_midi(the_music);

   return 0;
}

I hope this helps


Jim the loiterer
aloiterer AT juno DOT com
http://www.fortunecity.com/skyscraper/gigahertz/179/index.html

- Raw text -


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