- Online Community Forums » Programming Questions » I can't play midi!

This thread is locked; no one can reply to it. rss feed Print
I can't play midi!
Member #10,590
January 2009

I use DEV cpp with allegro and build "play.exe" successfully.

(play.cpp is a example program for the Allegro library, by Shawn Hargreaves)

I ran it and it work but I can heard nothing,why!!!

But I can play the *.mid by windows media player.

Edgar Reynaldo
Major Reynaldo
May 2007

Member #2,028
March 2002

This I guess is a derail, at 1st there is so many things that I wanted to say, corrections and whatever, but then at a 2nd thought, they have allegro working, they got the program to build, and they were very clear that the file worked in other programs. My instant response was wrong, it really is a decent post.

"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Edgar Reynaldo
Major Reynaldo
May 2007

qinhuangyi, it would help us if you gave us a few more details.

Which version of Allegro are you using?
Also, which version of Windows are you using?
Can you post the midi file as an attachment for others to try?
Did you modify play.c at all?
Did you build Allegro yourself, and did you use the play.exe program from the allegro\tests\ folder?

There is also a miditest.exe program in the same folder. Does it work on your system? It's a little quiet for me, perhaps it's just a volume issue?

Johan Halmén
Member #1,550
September 2001

Sometimes, when I've fooled around with my Allegro apps that include midi music, I lose the music volume totally. Then I check at Windows sound settings (usually by double clicking on the speaker image in systray) and I find out that the Synth or Midi (whatever it's called) slide is at zero. I slide it up and there's my music! It might be my messy code, but sometimes I feel it's a bug in Allegro.

Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Edgar Reynaldo
Major Reynaldo
May 2007

Also, if you're using Vista, the audio stack is de-evolving it seems. The only time you can adjust the volume level for a specific device is when it is actually being used, which is just about as smart as rocks (no offense to rocks, mind you).

Member #7,859
October 2006

What's even funnier is that media-player only has one volume slider: consequently it will set the midi volume to something "matching" the wave output. It will persist after exiting mediaplayer. If you have your headphones on and suddenly frère-Jacques-like homemade melodies start blaring at 20dBa, is where it becomes funny... really funny >:(
There's void set_volume(int digi_volume, int midi_volume), haven't tried it yet, though.

Member #2,981
December 2002

You can adjust any audio settings in Vista, you just have to know where to look. This comes down to usability, people who need the advanced settings can look up how to get to them, keep the rest simple for the dummies (so they don't have to try and look up how to use the advanced controls).

Don Freeman
Member #5,110
October 2004

I've noticed that stupid Media Player likes to reset the MIDI volume (more like mute it) when ever you use it. I've not found a way to programically do this...of course I haven't tried yet. Most of my projects are aimed to be multi-platform, so I try to steer clear from platform specific stuff, but this will have to make calls to the Windows API for sure.:-/

"Everyone tells me I should forget about you, you don’t deserve me. They’re right, you don’t deserve me, but I deserve you."
"It’s so simple to be wise. Just think of something stupid to say and then don’t say it."

Member #2,030
March 2002


Also, if you're using Vista, the audio stack is de-evolving it seems.

Indeed. Switch the output from e.g. speaker to headphone and you have to restart every single sound-using application.
The whole situation feels like Linux ~5 years ago. :P

Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Go to: