Does anyone know where I can get a good sound tutorial for C++?
Does anyone know where I can get a good sound tutorial for C++?
For DOS or Windows or what?
For DOS i use PlaySound().
I don't do windows yet
well, sound is not part of C++, so you might wanna try an api like SDL(libsdl.org).
For Windows it's really simple.
Make sure you include winmm.lib in your linked library files.
Make sure you include mmsystem.h
#include <mmsystem.h>
Use PlaySound to actually play the sound.
PlaySound("dice.wav",NULL,SND_FILENAME | SND_ASYNC);
In this case "dice.wav" is the name of a *.wav file that is in the root directory of my project.
The second param is NULL if you are playing your *.wav from a file (as opposed to playing it from a resource, in which case this param would be the handle to the executable file that has the sound resource).
The last param lists the flags for playing the file. To play a sound from a *.wav file you only need: SND_FILENAME - tells it that the first param is a filename of the sound to play ** and ** SND_ASYNC - tells it that the sound is to play asynchronously and the function will return immediately after the start of the sound (as opposed to SND_SYNC in which case it plays back synchronously and the function returns after the sound ends).