Since DirectSound is deprecated, I’d decided to go ahead and write a sound manager class for my Game Prog. II Assignent, using the Windows API’s PlaySound function instead of uisng DirectSound. This function is relatively easy to implement, and it plays a .wav file supplied as a parameter while using only one line of code. The downside however, is that it cannot handle multiple channels, ie playing multiple sounds simultaneously. This serves as only a quick and dirty hack to get things done, and highly unrecommended for use in larger projects.

Anyway, here’s how you would use it:

if (player.isHit()) {
	PlaySound("hitSound.wav", NULL, SND_ASYNC);
}

This tells Windows to play “hitSound.wav”, and the SND_ASYNC flag indicates that the program will continue to run while the sound is playing. If you would rather pause your program for the duration of the sound, you would call it with the SND_SYNC flag like this:

PlaySound("hitSound.wav", NULL, SND_SYNC);

For a list of available flags, you could refer to the MSDN docs. Commonly used flags are the SND_SYNC, SND_ASYNC and SND_LOOP.
Now go and finish your assignments!