Archived

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

PixolMaster

DirectSound, more than one at a time?

Recommended Posts

Hi, My game uses directsound to play music in my game, but as soon as I plan another sound the music stops. Is there a way to play both at the same time? --- Alex Broadwin --- Domini Nocti Games

Share this post


Link to post
Share on other sites
Nope, no way to do that J/k.

If you are using DirectMusic (DirectXAudio) for both, make everything except the music a "Secondary Buffer" as described in the docs. Also make sure that the buffer flag that corresponds to something like "pre-empting" any other playing sounds is NOT set (as per default anyways).

[edited by - AndyTX on May 6, 2003 9:57:29 PM]

Share this post


Link to post
Share on other sites
what are you talking about? at least in directsound version 7 i''ve played several sounds at once.. that what''s the sound processor are for...

just keep a secondary buffer for each sound and play them...

Share this post


Link to post
Share on other sites
Ditto to Metus. From the DirectX 9 documentation:

quote:
By using the DirectSound interfaces in your application, you can do the following:

- Play sounds from files or resources in WAV format.
- Play multiple sounds simultaneously.
...



My current game uses DirectSound and has background music, explosions, multiple weapon shots, and voice messages all playing simultaneously.

Share this post


Link to post
Share on other sites
If you're using DirectMusic, then specifying the DMUS_SEGF_SECONDARY flag in the call to PlaySegment or PlaySegmentEx will do it for you PixolMaster.


Edit - didn't see he was specifying DirectSound - are you sure you're using DS for music?


[edited by - Jim Adams on May 7, 2003 11:53:47 AM]

Share this post


Link to post
Share on other sites
i can''t remember the right way, but you create your primary buffer with DSBCAPS_LOCHARDWARE (or LOCSOFTWARE) and the DSBCAPS_PRIMARY flags, then you create secondary buffers with DSBCAPS_SECONDARY and then load the buffer into the secondary;

LoadWaveFile("data\\wave1.wav", &dsbuf1);
dsbuf1->Play();

LoadWaveFile("data\\wave2.wav", &dsbuf2);
dsbuf2->Play();

Share this post


Link to post
Share on other sites
That particular problem happens most often in DirectMusic when not specifying that your non-music buffers are "secondary" buffers... thus even though he said "DirectSound", I inferred, "DirectXAudio", which apparently was write (he fixed it).

You have to admit that the naming did become a bit confusing ever since DX8 when Microsoft started amalgomating interfaces

Share this post


Link to post
Share on other sites