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...