[Openal] Mute when switch windows
Dave Shillito
dave.shillito at kuju.com
Wed Jul 18 10:31:19 PDT 2007
Ah... That would explain it, I was not even aware DSBCAPS_GLOBALFOCUS exited - so had obviously not used it :o)
I actually like that the sound continues (after all the graphics don't stop do they), but everyone else on the team would rather hear their mp3's. :o(
Thanks for the quick response,
DAve
-----Original Message-----
From: Daniel PEACOCK [mailto:dpeacock at creativelabs.com]
Sent: 18 July 2007 18:25
To: Dave Shillito
Cc: openal at opensource.creative.com
Subject: Re: [Openal] Mute when switch windows
Hi Dave,
I think the behaviour in DSound that enables / disables a particular DSBuffer to be heard when the application / window loses focus is the DSBCAPS_GLOBALFOCUS flag which is part of the DSBUFFERDESC structure passed to the CreateSoundBuffer function.
In OpenAL the Sources will continue to play and be audible regardless of the whether the application has the "focus" or not. The solution we recommend is to trap the WM_ACTIVATE message in your application (sent when ever your application gains or loses the "focus") and either set the Listener Gain to 0 (to mute all the Sources but allow them to continue to play) or call alSourcePause on each Source. In the later case, your application will need to know not to start any new sounds while it does not have the focus.
Dan
Daniel Peacock
Custom Engineering Manager
Creative Labs, Inc.
email : dpeacock at creativelabs.com
phone : (408) 546 6552
Hi All,
I have just switched our app over from DirectSound to OpenAL.
In the DirectSound version of the app when we run windowed and switch
focus to a new window our sound would be muted. Now in the OpenAL
version the sound continues.
I think this was since I used "SetCooperativeLevel(hwnd,
DSSCL_PRIORITY)" in DirectSound.
Is it possible to recreate the DirectSound behaviour in OpenAL?
I was looking at alcSuspendContext & alcProcessContext, but was unclear
as to what would happen if the app continued to run - triggering sounds
in the background.
Cheers,
DAve
__________________________________________________________________________________________________________________________________________
Information contained in this e-mail is intended for the use of the addressee only, and is confidential and may be the subject of Legal Professional Privilege. Any dissemination, distribution, copying or use of this communication without prior permission of the addressee is strictly prohibited.The views of the author may not necessarily constitute the views of Kuju Entertainment Ltd. Nothing in this email shall bind Kuju Entertainment Ltd in any contract or obligation.
The contents of an attachment to this e-mail may contain software viruses which could damage your own computer system. While Kuju Entertainment has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening the attachment.
Registered Office : 10 Woodside Park, Catteshall Lane, Godalming, Surrey, UK, GU7 1LG. Company Number : 3481384.Company Registered in England.
__________________________________________________________________________________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
_________________________________________________________________________________________________________________________________________
More information about the Openal
mailing list