#### Archived

This topic is now archived and is closed to further replies.

# Playing a simple .wav sound in a c++ application

## Recommended Posts

flip5577    138
For my AP computer science class, we have to make this pacman game for our final project. I want to add sound to my game. I have a wav file that I want to play every time he eats a dot. What code and header files do i have to use to get him to play a sound? Larry Charles CEO Centra Entertainment Studios

##### Share on other sites
Using the Platform SDK (i.e. no DirectSound):
BOOL PlaySound(  LPCSTR pszSound,    HMODULE hmod,       DWORD fdwSound    );

Header: Declared in Mmsystem.h; include Windows.h.
Library: Use Winmm.lib.

Have a look to here for details

Forever trusting who we are
And nothing else matters
- Metallica