In my program, currently I am able to play background music. My game is based off a shooting game, how can I make it where if I press a button, let's say the up arrow, it ail play a sound and right after it plays the sound, it continues where we left off in the background music? Here is my code:
#include <iostream>
#include <Windows.h>
#include <conio.h>
#pragma comment (lib , "winmm.lib") // Used for sound
using namespace std;
// Define key
#define KEY_UP 72
int main()
{
int key = 0;
while(true)
{
PlaySound(TEXT("Background Music.wav"), NULL, SND_FILENAME|SND_ASYNC);
key = _getch();
if (key == KEY_UP)
PlaySound(TEXT("GunSound.wav"), NULL, SND_FILENAME|SND_ASYNC);
}
return 0;
}