🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Simultaneous sounds with DirectSound

Started by
3 comments, last by Krippy2k 22 years, 10 months ago
Hi all I am kinda new to sound APIs and such, but I am learning DirectSound right now. The problem I am having is this: I can load .wav files for gunshots, and breaking glass. I can play each sound seperately. But if for instance, I shoot my gun at a wall you can hear the gunshot. If I shoot the glass, you will hear the glass break. But when I shoot the glass, my gunshot doesn''t sound. I start he gunshot sound first, and when the bullet hits the glass the glass sound starts but apparently it is stopping the gunshot segment or something. I''m trying to figure out from the DirectX SDK docs but it was written with sound techies in mind. lol Thanks, Krippy
Advertisement
OIh yeah, I''m using PlaySegmentEx to play the segment which was loaded by LoadObjectFromFile.

Thanks
Krippy
don''t use direct music, but your own mixer routines. they are easier, faster (directsound is _very_ unoptimized!! often software mixing is faster than hardware mixing through directsound...), more flexible and, most important, you can easily debug them, unlike your current problem.

mixing routines are written in 1-2 days, with optimizations 3-4 days.
Hey, USE DirectSound!

I'm not a Microsoft friend, but

- I'm lazy
- I don't have much time to develop a sound engine
- I like to use things that work wonderfully
- I love hardware support

So, don't tell me the matter of speed
DirectSound isn't that slow!
In DOS times I wrote a mixing engine + soundcard specific stuff.
It was horrible!

I think to play your sound you must not only load a wave file but also create a DirectSoundBuffer and play this.
These buffers cam be played parallel.
Mmmh, I haven't heard anything of PlaySegmentEx (it sounds like a mmsystem-like function), but perhaps its because I use DX6 and this is a newer interface.
If it's the case, please forget everything I said

BTW: I created a great DSound-based sound engine in a week, completely with 3D/2D-sound, dopplers, looping, frequency control...

Ciao!



Have a look at our game "Crashday" at www.moonbyte.de


Edited by - MothaBrain on June 1, 2001 10:18:22 AM
Hi Krippy,

I'm doing the same as you at the moment, and the only way I found to play simultaneous sounds is to play them as a secondary segment like this -

  M_performance->PlaySegmentEx(P_sample->GetSegment(),                             NULL,                             NULL,                             DMUS_SEGF_SECONDARY,                             0,                             NULL,                             NULL,                             M_audio_path);  


But I still have some problems getting samples to loop.

My plan (when I have time) is to drop DirectMusic and start using the old DirectSound interface that is still included in DirectX 8. It makes so much more sense just from reading the sdk docs, samples are called samples not segments for a start.

Dan

Edited by - danbrown on August 9, 2001 7:28:25 AM

Dan

This topic is closed to new replies.

Advertisement