Jump to content

  • Log In with Google      Sign In   
  • Create Account


playing lotsa sounds at the same time


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 CoolMike   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 January 2000 - 04:34 PM

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.

Sponsor:

#2 Gromit   Members   -  Reputation: 144

Like
Likes
Like

Posted 26 January 2000 - 04:40 PM

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.

#3 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 26 January 2000 - 06:59 PM

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.

How do I manage and clean this mess up?

Jason


#4 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 29 January 2000 - 08:53 AM

Hello, does anybody use DuplicateSoundBuffer() for
sound repetition?

Jason

#5 Jim Adams   Members   -  Reputation: 440

Like
Likes
Like

Posted 29 January 2000 - 09:38 AM

I could be wrong, but I think he means that he tries to play the sound over and over again every frame:

frame()
{
// every frame play the sound
play_sound();
}

If you don''t stop the sound first, then nothing will happen and the sound will continue to play. Try:

frame()
{
// stop last frames sound
stop_sound();
// play this frame sound
play_sound();
}

Jim





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS