Archived

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

RogerGuard

DirectSound

Recommended Posts

RogerGuard    122
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
RajanSky    100
Huh? That muting doesn''t seem to happen to me. What *exactly* are you using? DirectX 7? 8? What kind of interfaces, etc, are you using?

Share this post


Link to post
Share on other sites
Jim Adams    440
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
RogerGuard    122
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
RogerGuard    122
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