This topic is now archived and is closed to further replies.

Guest Anonymous Poster

Playing Direct Sound files at the same time

This topic is 6622 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You can map your sound file into memory with File Mapping technique, and then you can use memcpy function to fill your Direct Sound buffers. It means when you use the File mapping, you can access your file randomly, as RAM.

Share this post

Link to post
Share on other sites
Hello Davaris

A more easily method than Tuan described is to use IDirectSound: uplicateSoundBuffer like that:

pDS; // the directsound object
pDSB1; // i assume that this is your original soundbuffer which is properly initialized
pDSB2; // the second one

pDS->DuplicateSoundBuffer(pDSB1, pDSB2);

Please look at the DX7 SDK documentation for more details.


Share this post

Link to post
Share on other sites
Guest Anonymous Poster

I've got Direct Sound working OK
but if I want to play the same sound
at the same time I have to load up a
separate copy. As an example you
have two machine gunners fireing
and one starts just before the other.
If want to hear them both you have to
load and play two separate sounds.
If you have 10 machine gunners
you would have to load 10 machine gun sounds which would eat memory.
Is there a way to play the same sound
several times at the same time and only use the one piece of memory?

Share this post

Link to post
Share on other sites