[openal] Problem putting Windows system to sleep while OpenAL is initialized but idle
Chris Robinson
chris.kcat at gmail.com
Thu Jul 14 20:31:37 EDT 2016
On 07/14/2016 04:38 PM, Kirk Baker wrote:
> The above is fairly straightforward, I expect. Is there some way for
> us to "pause" OpenAL such that it won't deny system sleep? On
> Windows, powercfg -requests shows
> SYSTEM:
> [DRIVER] Realtek High Definition Audio (HDAUDIO \ FUNC_01 & VEN_10EC & DEV_0889 & SUBSYS_1458A022 & REV_1000 \ 4 & 36360a8e & 0 & 0201)
> An audio stream is currently in use.
>
> I am guessing that as soon as we initialize as above, an audio stream
> is started up and mixes in silence, keeping things ready for
> low-latency playback. If we could "pause" this when our app is
> switched out, or when a system sleep event raises, or when we know
> we're not trying to play sounds then I'd expect the system to be able
> to sleep.
Hi.
This is basically the issue, yes. OpenAL Soft starts up a playback
stream on the system when the context is created and keeps feeding it
audio for a variety of reasons.
There are a couple ways to "pause" playback. The surest way is to use
the ALC_SOFT_pause_device extension which provides the
alcDevicePauseSOFT and alcDeviceResumeSOFT functions, which pause and
resume the device respectively.
Alternatively, you can try destroying all contexts (and associated
sources, buffers, etc). OpenAL Soft will generally try to stop playback
when there's no contexts on the device. That's an implementation detail,
though, and isn't guaranteed to work.
More information about the openal
mailing list