It only took me about a half hour to get DirectSound up and running and playing sounds. I can play lots of sounds together at the same time, but not the same sound. For instance, every game loop I want the game to play a gunshot sound. But instead of playing the gunshot sound each loop (starting the sound over each frame) it just plays it and repeats when done, so in actuality about 100 frames go by for each sound. So all it is doing is waiting until the sound is done playing before it starts again. I don''t want this. If I have a machine gun shooting 10 rounds per second, I want the sounds to be played at 10 per second, meaning I must have the sound played while the previous sound is still playing. I know this is possible, but do I need multiple buffers for the same sound or what?
Thanks in advance.
Keep on reading the doc''s, it''s all in there. You need another instance of the sound, but you don''t need any more buffers. ie. you load the sound once into the buffer and have multiple pointers to it.
Let''s say I want to play a gun shot sound a bunch of times, and I don''t wanna wait for the last gun shot sound to finish. So I use DuplicateSoundBuffer() to create duplicate pointers to my gun shot sound data. And I play the duplicate sound.
That''s the easy part.
Question is, what do I do with all these pointers after the sound is played? I know I have to delete/get rid of them, but how do you do that safely? I obviously have to keep track of them all, and I probably want to be able to create as many pointers as needed, and I also have to be able to wait for it to finish playing completely.