Jump to content
  • Advertisement
Sign in to follow this  
volking

DirectX.DirectSound make simultaneous into successive

This topic is 3600 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

I have 100 tones. Each tone has it's own .WAV file. Each tone is (about) 0.2 secs long. Each .WAV file is loaded and kept an instance of a custom CLASS The custom class has ... private Microsoft.DirectX.DirectSound.Buffer m_SoundBuffer = null; private Microsoft.DirectX.DirectSound.Device m_SoundDevice; private Microsoft.DirectX.DirectSound.BufferDescription m_SoundBufferDescription; private Microsoft.DirectX.DirectSound.BufferPlayFlags m_SoundBufferFlags; internal Microsoft.DirectX.DirectSound.Buffer SoundBuffer { get { if (m_SoundBuffer == null) { m_SoundDevice = new Device(); m_SoundDevice.SetCooperativeLevel(this, CooperativeLevel.Priority); m_SoundBufferDescription = new BufferDescription(); m_SoundBufferDescription.ControlVolume = true; m_SoundBufferDescription.ControlPan = true; m_SoundBufferDescription.ControlFrequency = true; m_SoundBufferDescription.StickyFocus = true; m_SoundBufferDescription.GlobalFocus = true; m_SoundBuffer = new SecondaryBuffer(SoundDPFE, m_SoundBufferDescription, m_SoundDevice); m_SoundBufferFlags = BufferPlayFlags.Default; } return m_SoundBuffer; } } internal void SoundPlay() { SoundBuffer.Play(0, m_SoundBufferFlags); } I decide to play 5 specific tones. But, when I rapidly call "SoundPlay" for the 5 class instances, all 5 tones play SIMULTANEOUSLY! Not what I want. I want each tone to FINISH before the next tone begins. How?

Share this post


Link to post
Share on other sites
Advertisement
How about you queue the 5 sounds in the buffer using Buffer.Write?

In other words, call Buffer.Write 5 times with the 5 different tones, and then begin playing the buffer? Just create 1 buffer to share, stuff the sounds in and voila, you got 5 tones playing sequentially instead of simultaneously.

After you're done, you clear the buffer, put new sounds in and voila, you got yourself a DJ boot where you can mix teh awesomeness.

Toolmaker

Share this post


Link to post
Share on other sites
Quote:
Original post by Toolmaker
How about you queue the 5 sounds in the buffer using Buffer.Write?

Toolmaker


Wow, that was too easy (smile) Thanks. Worked great!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!