DirectSound: DSBCAPS_GLOBAL

Started by
2 comments, last by ChristophR 18 years, 7 months ago
Hi! I created a secondary sound buffer with the flag DSBCAPS_GLOBAL. Despite of that, sounds are stopped if the window looses it's focus. I also tried to use an example from the DirectX SDK and just add the DSBCAPS_GLOBAL flag, but it did not work. What could be the reason?
Advertisement
hi there ChristophR,
How are you doing?

The Problem
Sound stops playing on the second buffer as your window looses focus

The Solution
There is an exception for DSBCAPS_GLOBAL
"The buffer is a global sound buffer. With this flag set, an application using DirectSound can continue to play its buffers if the user switches focus to another application, even if the new application uses DirectSound. The one exception is if you switch focus to a DirectSound application that uses the DSSCL_WRITEPRIMARY flag for its cooperative level. In this case, the global sounds from other applications will not be audible. "

You might also want to check if your buffer isn't lost during this switch to another window.
Also if you haven't read this about creating secondary buffers it might help a bit.

I will look a little more into it when I have time. Take care buddy.

I know that there is an exception. But that is not the reason in my case, because I switched to the desktop, and the desktop does not use DirectSound at all. There is also no other application running which uses DirectSound.

I also don't think that the buffer is lost during the switch, because if I switch back the sound continues immediately.
Ok, I have found the problem. In my own project it works well now. I just set the volume to zero when I tested my setVolume function yesterday and I did not remove the call afterwards.

In the SDK example it still makes troubles. I don't know why, but it seems that the global flag is incompatible with other flags used in that project.

But that does not matter. It works in my project now and that is all I wanted.

This topic is closed to new replies.

Advertisement