looping music in the background of your program

Alright, so I figured how to do just basic playing sound using the PlaySound() function that is part of windows.h... When you run this specific function in the code, it makes you wait till the sound is done playing before moving on in the code. So what I was wondering, is there a function that allows you to play sounds while still executing the other lines of code. So more like background music so to speak...

my thought was, say I want to have an ascii art title screen, and I want to have music playing until the user decides that they want to move off of the title screen. How would I accomplish this?
Sounds like you're doing things you shouldn't be.

Read this: http://www.cplusplus.com/forum/articles/28558/
@ Disch: Although I can agree with you that making graphics based games is more intimidating then it is difficult I also know the frustration of trying to learn too much at once. I was just about to put up a "Beginner Challenge" post about making a choose your own adventure style game to encourage aspiring game programmers. I had spent about two hours planning it out but damnit Disch! I have too much respect for you to post it as it is now! I guess I could make an amendment about how to achieve the "Clear Screen Effect" do you mind if I point to your article and leach some credibility?

@ OP: After reading Disch's article look up threads and cords as they apply to modern programming.
Last edited on
I also know the frustration of trying to learn too much at once.


That's just the thing. I don't see how this applies.

You have to learn how to use the target medium. WHATEVER that medium is. If you're using the console, you have to learn how to use cin/cout properly.

On the other hand, if you're using SFML, you have to learn how to use sf::Sprite.

So either way you're learning SOMETHING relating to user I/O. It's just a quesiton of which one to learn.

Personally I don't find any one more difficult than the other (though if I had to pick, I'd say SFML is easier. To this day I still don't fully understand how istream parses text in all cases).


I guess I could make an amendment about how to achieve the "Clear Screen Effect" do you mind if I point to your article and leach some credibility?


I am never opposed to people linking/referring/pointing to my articles. What I post is for all to see and the more people that see it by whatever means, the better. Go right ahead.

Although I think there was already an article on how to clear the screen somewhere in the articles section. Duaos wrote it, IIRC and it covers many options.

@ OP: After reading Disch's article look up threads and cords as they apply to modern programming.


Talk about learning too much at once....

Multithreading is definitely not something I would recommend to novices. It's very tricky to get right.
Alright, thanks guys. Will look into the SFML, i'm a game programming major, so it would only make sense to start messing around with it and start getting used to that instead of being stuck in the console... Thanks again guys, and Disch thanks for the article, just look at it now, looks like it's well thought out and overall a great job. Thanks again for the advice.
Topic archived. No new replies allowed.