Mail Archives: djgpp/1998/03/14/19:01:46
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 -