Thread: Playing midis

  1. #1
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373

    Playing midis

    I want a one line thing that plays midis. Perhaps a 3 line at the most or so. Im still a newbie and can't use Fmod, to complex from what i see at gametutorial.com. I am using Dev C++ with the gnu compiler. Please help me. Text game sucks with 9 megabyte wave files that last 20 seconds for music, and restarts every loop.
    This war, like the next war, is a war to end war.

  2. #2
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I'm sorry, but I am believing that there is no 1-3 line solution for playing midis. This is not Visual Basic, nor Java, but C/C++. In other words, much of what was done for you before, you must do manually now.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  3. #3
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    uh... i know you did your share of helping me, hunter2, but would you mind giving me an idea of what im looking at?
    This war, like the next war, is a war to end war.

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I found some code for playing MIDI:s along time ago (was lost in a format, sorry...) and it was rather 3000 lines than 3.
    Just to give you a hint of what to expect...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    I think windows comes with some stuff for playing MIDI's. I think in MMSYSTEM.

  6. #6
    |<o>| <--cyclopse LouDu's Avatar
    Join Date
    Mar 2003
    Posts
    137
    playing midis in console games is like a 25 char length code but hah, i'm not ellign you cause ur a nerwb who doesnt try to do anything on your own
    Languages <> C++, HTML

    /*The Ledgend of Ludlow Coming to a PC Near
    You intro Cinenmatic Needed email me of
    Reply to one of my threads if you can make
    one, thats decent. */

  7. #7
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Loudu, i try every thing on my own before i post. I tried game tutorials, ive tried google, ive tried newsgroups, ive tried TV, and i have tried using MSDN, MSDN doesn't like me, winmm library, which i found that it stands for WINdows Multi Media, is needed, but when i can't find any working source code, im screwed.

    Try thinking, loudu, just try.
    This war, like the next war, is a war to end war.

  8. #8
    |<o>| <--cyclopse LouDu's Avatar
    Join Date
    Mar 2003
    Posts
    137
    how about you search the board for,, ah let me think Playing Midis? newb
    Languages <> C++, HTML

    /*The Ledgend of Ludlow Coming to a PC Near
    You intro Cinenmatic Needed email me of
    Reply to one of my threads if you can make
    one, thats decent. */

  9. #9
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Originally posted by LouDu
    <snip>...but hah, i'm not ellign you cause ur a nerwb who doesnt try to do anything on your own
    That's exactly the kind of elitist attitude that shouldn't be in the programming world.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  10. #10
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I would have to agree to that; I tried doing midis before, but gave up because it was too hard to incorporate into my code.

    Just because somebody is having trouble doing something, it doesn't mean that they haven't tried doing it. True, the question could have been phrased better ("I want this. It has to meet this requirement." doesn't sound good). But at least we can keep the tone civil here.

    Be polite... Keep in mind that being helpful does not give license to be rude.
    -quote taken from the C Board guidelines
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  11. #11
    |<o>| <--cyclopse LouDu's Avatar
    Join Date
    Mar 2003
    Posts
    137
    Sorry for the rudenest, but he sends me private messages about how my game is lame, and he hasnt even writen most of his, the great people of the board have, and that just gets me mad, since i put in 50+ hours on my text rpg and researched it all from scratch sorry agian.
    Languages <> C++, HTML

    /*The Ledgend of Ludlow Coming to a PC Near
    You intro Cinenmatic Needed email me of
    Reply to one of my threads if you can make
    one, thats decent. */

  12. #12
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    From what've searched, There's no easy way to play MID, One
    thing you could do is converting a MID to a WAV .
    Then play that WAV with playsound(), Wich takes only one line.

    Just in case, Playsound Tutorial
    --

  13. #13
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    Originally posted by LouDu
    Sorry for the rudenest, but he sends me private messages about how my game is lame, and he hasnt even writen most of his, the great people of the board have, and that just gets me mad, since i put in 50+ hours on my text rpg and researched it all from scratch sorry agian.
    That's wonderful. Talk to him in PMs about it or on AIM or something. Don't take your little stupid personal vendettas around the board with you.

    bd - the simple answer seems to be that playing a midi's going to be difficult in straight C++

  14. #14
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    Hunter2:
    Right, see, i am using wavs, and i have converted midis to waves, but when i convert, i have to set it to minimal quality, and its still about 30 megs. I have some REALLY HIGH QUALITY waves, about a minutes long each, and there a megs, slightly bigger. They're working now, but they're not long enough.I have a global varible called int mus; every turn, mus is added by one, or, since im talking to programmers, i can say mus++ every turn.
    When mus == 15, i testmus(), which will start playing the wav, and set mus to 0.

    And, on your space shooterz game, it would really benifit from a nice midi....ahhhh... doom, sweet doom music.......

    On how i asked the question: I was in a hurry, so i couldn't dish out something more polite....

    here, let me try again.

    *AHEM**COUGH COUGH*
    I would like to know some working code to play a midi file.
    I want to be able to play a midi so i don't have to use 50 meg waves. Please help me on this. Thank you!

    Ps: I would like an easy non-600 line way.

    Loudu:
    Okay, quote from me *kinda, not hitting a qoute button*:
    "My first game was worse."
    See? And i didn't spend no 50+ hours on it, i spent 115+ hours on it. And i was doing C++ for about 4 weeks at that time. Also, i think i said "No offense meant" somewhere in that PM......

    Man, if only you hear the criticism of my music! I make good music, lots of people give it 5 out of 5. I write that by myslef. The style is what alot of people hate. Chip/Rock, Chip/Techno.

    And i write all of my code. People just help me learn things to use in the code.


    Pianorain: I agree, If i've ever been rude on here it was because of A: I was in a hurry, and needed to type fast, or B: Somebody was ticking me off on here, like, oh i dunno... Loudu, for instance?
    This war, like the next war, is a war to end war.

  15. #15
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    Are you using any external libraries, like Allegro?

    > oh i dunno... Loudu, for instance?

    Taking a parting shot at someone's not going to stop the fight any sooner. I'm going to say it again. No one cares about your stupid little squabbles. Keep it off the board, or I will.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. PC or Console gamers, what are you playing?
    By indigo0086 in forum A Brief History of Cprogramming.com
    Replies: 119
    Last Post: 04-14-2008, 08:17 AM
  2. How do I keep the sounds playing?
    By Queatrix in forum Windows Programming
    Replies: 0
    Last Post: 07-21-2007, 10:19 AM
  3. Uh-oh... Playing a MID file?
    By Blackroot in forum C++ Programming
    Replies: 6
    Last Post: 02-14-2006, 08:49 PM
  4. playing midis through the MCI
    By NoOneHere in forum Windows Programming
    Replies: 1
    Last Post: 03-07-2003, 06:20 PM