Archived

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

DirectSound

This topic is 5696 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 noticed that when the window created by my application which utilizes DirectSound loses focus the sounds will be muted, then once focus is returned to this window the sounds are un-muted. Are there ways to not mute the sounds when the window loses focus? Roger Printy Software Engineer

Share this post


Link to post
Share on other sites
You can fix that problem by setting the DSBCAPS_GLOBALFOCUS flag when calling CreateSoundBuffer (as such when creating the primary sound buffer).

DirectSound C/C++ Reference > DirectSound Structures > DSBUFFERDESC

Jim Adams
home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX


[edited by - jim adams on May 6, 2002 3:15:18 PM]

Share this post


Link to post
Share on other sites
I tried adding this flag but the call to CreateSound Buffer then fails. I am using the following flags:

DSBCAPS_CTRL3D | DSBCAPS_PRIMARYBUFFER | DSBCAPS_GLOBALFOCUS

Code is as follows:
DSBUFFERDESC buffDescrip;
memset (&buffDescrip, 0x00, sizeof (DSBUFFERDESC));
buffDescrip.dwSize = sizeof(DSBUFFERDESC);
buffDescrip.dwFlags = DSBCAPS_CTRL3D | DSBCAPS_PRIMARYBUFFER | DSBCAPS_GLOBALFOCUS;

// Create the sound buffer & capture the 3d interface
if FAILED(m_lpDS->CreateSoundBuffer (&buffDescrip, &lpPrimaryBuf, NULL))
{
err = DS_FAILED;
}

Share this post


Link to post
Share on other sites
I was just about to post that I took care of the problem. I was applying the flags to the primary buffer, once I switched to applying them to the secondary buffers that are created for each handled sound the problem disappeared and it is running as intended. Thank you everyone for you assistance.

Share this post


Link to post
Share on other sites