Music & Sound With C++

Problem:
I need music that repeats/loops in the background while I am running my program. Then, when I get to another part of my program, that background music needs to pause, play another sound file, then resume the background music.

Example Of Problem:
For example, I have a Blackjack program that plays the background music when you run it. Then, when you actually log in or create an account it plays a sound file that says "Welcome". Or if i get to a function that shuffles my vector(deck of cards), it plays a sound effect that sounds like a deck of cards shuffling.

What I Have Tried:
Playsound() - It loops/repeats but does not allow me to pause, resume, etc. My code is:
1
2
3
4
5
        #include <windows.h>        #include <mmsystem.h>
        #pragma comment(lib, "winmm.lib") // Link to the winmm library


        PlaySound(TEXT("86876__milton__title-screen.wav"), NULL, SND_LOOP | SND_ASYNC); // Background music 

MCI - Can't figure out how to get it to loop/repeat, pause, or resume. All I can get is the following code:
1
2
3
4
5
6
7
8
9
        #include <windows.h>        #include <mmsystem.h>
        #pragma comment(lib, "winmm.lib") // Link to the winmm library


        MCIERROR me = mciSendString("open 86876__milton__title-screen.wav type waveaudio alias song1",NULL, 0, 0);
        if (me == 0)
        {
            me = mciSendString("play song1", NULL, 0, 0);
        }

I keep reading that I need to stay away from 3rd party stuff when working with Visual Studio, or anything Microsoft. But, if you can suggest something that is nice and simple, then please.
Other:
I am a beginner so I need it to be as simple as possible. For Python Pygame mixer, it is literally 1 line to play, pause, resume etc. Please help...
PlaySound() isn't designed for anything but very simple tasks. You need to use the WaveOutOpen(), etc functions for anything more serious on Windows.

http://www.google.com/search?btnI=1&q=msdn+Waveform+Audio+Reference

I keep reading that I need to stay away from 3rd party stuff when working with Visual Studio, or anything Microsoft.
I'm not sure where you are reading stuff like that, but it isn't generally true.

There are good libraries available, like OpenAL and GStreamer.
Don't bother to use audio engines. BASS and FMOD are good choices.

BASS: http://www.un4seen.com
FMOD: http://www.fmod.org
Does anyone think it would cause some kind of problem down the road if I use Playsound and MCI together? For example, playsound has my looping background music and MCI will do the quick sound effect tidbits that occur throughout the game..??
Topic archived. No new replies allowed.