[Openal] disabling sound
Jebus
lordjebus at gmail.com
Mon Sep 26 09:45:47 PDT 2005
Thanks for the info. I am working on a screen saver so the only way to
turn the sound on and off is from the preference panel. The whole app
would be restarted each time. My current thought is to have a
soundEnabled variable and just check that before playing a sound, but
if there is no performance hit when playing a sound when the context
is not enabled I would do that instead.
On 9/26/05, Stephen J Baker <sjbaker at link.com> wrote:
> Jebus wrote:
> > What is the best way to toggle sound on and off ? I mean all sound not
> > an individual sound. Basically I am talking about a sound on/off
> > preference that the user can toggle.
>
> It's actually kinda tricky.
>
> Because OpenAL keeps internal timing state, you can't simply stop making
> OpenAL calls because then, when the user wants his sounds back, some things
> that should have been playing might not be synced up right.
>
> If there were some hypothetical way to tell OpenAL to just stop running, then
> if there was an enormous explosion going off when the user turned the sound off
> - then when he turned it back on again, an hour later, the explosion sound effect
> would probably finish playing!
>
> Similarly - if an explosion had *just* gone off when you turned on the audio,
> that command to start the explosion wouldn't have happened.
>
> So it seems to me that if the user can turn sound on and off at runtime,
> you probably need OpenAL to run continually even when the sound if off.
>
> It's probably best just to shut the alListener's GL_GAIN down to zero.
>
> -----------------------------------------------------------------------
> The second law of Frisbee throwing states: "Never precede any maneuver
> by a comment more predictive than "Watch this!"...it turns out that
> this also applies to writing Fragment Shaders.
> -----------------------------------------------------------------------
> Steve Baker (817)619-2657 (Vox/Vox-Mail)
> L3Com/Link Simulation & Training (817)619-2466 (Fax)
> Work: sjbaker at link.com http://www.link.com
> Home: sjbaker1 at airmail.net http://www.sjbaker.org
>
>
More information about the Openal
mailing list