Generally, MIDI is the way to go for games because it puts a minimal load on your CPU & data bus. Your soundcard/soundchip does all of the work.
Here's a great MIDI web site.
The site is hard to navigate, so here's the Windows programing info on the same site, where you will find this:
Code:
HMIDIOUT handle;
/* Open default MIDI Out device */
if (!midiOutOpen(&handle, (UINT)-1, 0, 0, CALLBACK_NULL) )
{
/* Output the C note (ie, sound the note) */
midiOutShortMsg(handle, 0x00403C90);
/* Output the E note */
midiOutShortMsg(handle, 0x00404090);
/* Output the G note */
midiOutShortMsg(handle, 0x00404390);
/* Here you should insert a delay so that you can hear the notes sounding */
Sleep(1000);
/* Now let's turn off those 3 notes */
midiOutShortMsg(handle, 0x00003C90);
midiOutShortMsg(handle, 0x00004090);
midiOutShortMsg(handle, 0x00004390);
/* Close the MIDI device */
midiOutClose(handle);
}
Of course for the ultimate resource, there's MSDN. (The ultimate hard-to-navigate web site too!! )