|
|
| unable to play a MIDI file |
|
Dave Calkins
Member #7,766
September 2006
|
I'm trying to play a MIDI file in a loop, but I don't hear anything playing. I'm using the below: // ... - I can successfully play the file using a MIDI player app I downloaded, so I know the file is good and my PC sound is turned up and working To debug this, I output the value of midi_time and get_midi_length() and they both show a value of 65. I tried adding a call to midi_seek(0), still no luck. Any idea why midi_time would be stuck at the "end"? i.e., at 65? Does this explain why its not playing? |
|
Kitty Cat
Member #2,815
October 2002
|
Are you sure the MIDI file loaded properly? What OS? What's the selected MIDI driver (print out digi_sriver->desc to see)? -- |
|
Archon
Member #4,195
January 2004
|
Doesn't set_volume take 2 arguments? But yes, if your operating system is Linux then midi doesn't work. Have you tried the exmidi example with that midi file? |
|
Dave Calkins
Member #7,766
September 2006
|
"Are you sure the MIDI file loaded properly?" => when I call load_midi(), it returns non-NULL (while changing the filename to an invalid one returns NULL); the returned MIDI pointer seems to contain a valid object, it shows 960 divisions, and the track variable appears to contain valid pointers "What OS?" => Windows XP SP2, Allegro 4.2.0, Visual C++ 2005 "What's the selected MIDI driver (print out digi_sriver->desc to see)?" => digi_driver->desc contains "Allegmix SB Audigy 2 ZS Audio [CCC0]"; This is the same output device I picked in the MIDI player I downloaded and it worked and successfully played the file "Doesn't set_volume take 2 arguments?" => yes, I passed 255 for both arguments; sorry, typo on my part :-) "But yes, if your operating system is Linux then midi doesn't work" => nope, using XP "Have you tried the exmidi example with that midi file" => I downloaded the pre-built misc files .zip which contains that example, tried to run it and it complained about MSVCR80.DLL; I copied that over, then when I tried to run it, I got an error about the app trying to load the runtime library incorrectly; I've seen this in the past and its prevented me from running stuff; no idea whats causing that |
|
Kitty Cat
Member #2,815
October 2002
|
Quote: "What's the selected MIDI driver (print out digi_sriver->desc to see)?" => digi_driver->desc contains "Allegmix SB Audigy 2 ZS Audio [CCC0]"; This is the same output device I picked in the MIDI player I downloaded and it worked and successfully played the file Eh, sorry 'bout that. I meant midi_driver->desc. -- |
|
Dave Calkins
Member #7,766
September 2006
|
"Eh, sorry 'bout that. I meant midi_driver->desc" => midi_driver->desc is set to "Microsoft MIDI Mapper" I noticed something else which might be relevent. I downloaded "Sweet MIDI Player" and used that to play the file. In that app, under MIDI>>MIDI Setup, you can select the output device. The choices on my system are: No Device If I choose "Microsoft MIDI Mapper", it works. I'm able to play the file using that app. |
|
Kitty Cat
Member #2,815
October 2002
|
Odd. Perhaps there's something in the MIDI file Allegro doesn't like. Can you attach it here for us to take a look at? -- |
|
Dave Calkins
Member #7,766
September 2006
|
I don't think I'm at liberty to post the MIDI file itself. Note that, when I load the MIDI file in Sweet MIDI Player, it does give me the following notifications. "Needed to remove or insert 16 events. Please re-save the file!" "MIDI channels: 14 15 do not contain any volume information! Volume are set to a mid value for those MIDI channels. Adjust the volume for those channels and re-save the file." Granted, it still plays using that app. |
|
Johan Halmén
Member #1,550
September 2001
|
I remember I once replaced the NULL with "" in the install_sound() call and got it working. Probably a happy coincidence, though. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
|
Kitty Cat
Member #2,815
October 2002
|
Quote: I don't think I'm at liberty to post the MIDI file itself. Note that, when I load the MIDI file in Sweet MIDI Player, it does give me the following notifications. "Needed to remove or insert 16 events. Please re-save the file!" "MIDI channels: 14 15 do not contain any volume information! Volume are set to a mid value for those MIDI channels. Adjust the volume for those channels and re-save the file." Granted, it still plays using that app. What if you resave the file and try to use that in Allegro? Sounds like it has or is missing some data that causes problems for Allegro's MIDI player. -- |
|
Dave Calkins
Member #7,766
September 2006
|
yes, I suppose at this point the best assumption is that there's something in the file which Allegro doesn't like. I think we're going to switch over to something like mp3 or ogg instead. |
|
Thomas Fjellstrom
Member #476
June 2000
|
Obviously, that other midi player doesn't like it either, just Allegro's MIDI player is less forgiving. And I don't blame it, have you seen the Allegro MIDI player code? ggyuuhhh. -- |
|
|