Uh-oh... Playing a MID file?

This is a discussion on Uh-oh... Playing a MID file? within the C++ Programming forums, part of the General Programming Boards category; (WinXP, Borland C++ Free Command Line Compiler) Ok, for the past half hour I have attempted a number of combinations ...

  1. #1
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379

    Uh-oh... Playing a MID file?

    (WinXP, Borland C++ Free Command Line Compiler)

    Ok, for the past half hour I have attempted a number of combinations of flags with PlaySound. Then I noticed I misread the part about SND_PURGE, I thought it said use this flag to play a sound file other than a wav, but what it said was, use this to clear the sound buffer of files other than a wav. So, I went scrolling through MSDN to find a play wav function (or something near that) what I found, gave me a fairly severe headache :P.

    They're about ten different midiIn, ten different midiOut, and about five Midistream..... So, I guess I want to use midiOut, sooo noobishly, I went looking for midiOutPlay or midiOutStart, but none to be found. midiOpen was the most promising, but its documentation is near nothing. Theirs nooo way I could figure it out.

    When I googled midiOutOpen, I got a few chineese (or japeneese?) sites, and some error sites. But still no documentation on how to play a midi file! So I went back to google *C++ +"Playing a midi file"* *C++ "Mid Files"* *C++ "Playing non-wav sounds". And a few others, I didint get much. I did find this:

    Code:
    mciSendString("play PATH",NULL,0,NULL);
    This is the closest I got. It seems pritty simple, almost to simple. Sence when does MS do simple programming? So, I'm going to guess that this has the same catch as PlaySound, it cant play two at once. Thats just a guess though.

    So, does this have a catch where it stops all other sounds, then plays a sound? And, what are the other parameters for? (NULL, 0, NULL arent very helpful :P) And does this have a return value?

    Thank you!
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  2. #2
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    I did a few tests on this, and I have several problems. I have no way of knowing when the midi ends, and I have no control over volume. Its very slow, it takes several seconds to start :/. In fact, this pritty much gives no control at all. I know theirs an alternative, I dont care if its complicated, all it needs to do is play several midis at once. Anyone have a link to an alternative? *Oh, and avoid DX midi players please*
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  3. #3
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Ok, screw it. Every class I see just doesnt work, so I'll build my own :P. I have one issue though, I can find how many devices to play a midi their are, but I cant seem to find how to get a device to play a midi... Ummm... I'm lost :P. I'm still sifting through msdn, but no luck :/.

    Lol, maybe not, its just a little (lot) more complicated than it looked -,-. Maybe DX is my only option -,-.
    Last edited by Blackroot; 02-14-2006 at 05:17 AM.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  4. #4
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    What is wrong with mciSendString?
    You can play 2 songs at the same time ( .mp3, .wav, .wma etc. ) and songs with spaces in there name.

  5. #5
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    It takes several seconds to boot, but I'm giving in. Its to damn complicated to do it myself >.<. Ah well, one day I might be able to understand the jungle that is microsofts documentation .
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  6. #6
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Check out this web site. I don't know if it has exactly what you're looking for, but it helped me write a simple little MIDI program once. (My little program just directly played a few notes. It didn't play a MIDI file.)

  7. #7
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Yes, thats what I needed!

    Thanks!
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 11:39 PM
  2. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 04:53 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 11:51 PM
  5. file processing updating record error
    By uuser in forum C Programming
    Replies: 2
    Last Post: 04-27-2003, 01:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21