Here are some of the updates in functionality that were introduced with the Audio component Build ID 237—June 29, 2017 (7.0.237.S2017062909757) update:
- Changes to the snd_pcm_*_pause and software mixer interaction
- When your subchannel went through the software mixer ("sw_mixer")
and you paused the audio stream (calling snd_pcm_*_pause()), it ramped
down the volume, but immediately transitioned to the PAUSED state.
The transition to PAUSED state shouldn't have occurred until
the volume had ramped down to zero.
With this update, the snd_pcm_*_pause() call blocks until
the software mixer completes ramping down the volume to zero.
Only after the volume ramps down to zero does the subchannel
transition to the PAUSED state. It's important to note that
if you don't use a software mixer, no ramping occurs. For more information, see PCM software mixer.
- Detect whether a subchannel is soft- or hard- suspended
- In previous releases, there was no way to determine whether you
were soft- or hard-suspended. From this release onward, you can use the
snd_pcm_channel_status_t to determine the status using
the ducking_state member. For more information, see Understanding preemption.
- Audio management policies on group subchannels
- Previously, the audio management polices weren't correctly applied
to subchannels that were grouped together. Subchannels in the same
PCM link group caused audio management polices to be applied on one
another. For example, if you had two subchannels grouped together
and one of those streams was playing, but then you played the
second stream in that group (which is the same audio type),
incorrect audio ducking occurred where the first stream
would have audio ducking applied to it so that the second
stream could play.
This update applies audio management policies
so that grouped subchannels are treated as a
single audio stream rather individual streams. For more information, see Understanding audio ducking.
- Use snd_pcm_*_resume(), snd_pcm_*_pause(), and snd_*_prepare() on grouped PCM handles
- Previously, when you grouped audio subchannels together
using the snd_pcm_link() call, you could start the
audio streams only by meeting the start mode condition.
With this update, you can also call snd_pcm_*_resume(),
snd_pcm_*_pause(), and snd_pcm_*_prepare() on the grouped
PCM handles.
- This default behavior is referred to as synchronized behavior and is the
default PCM link mode (SND_PCM_LINK_MODE_SYNC). You can change this
behavior using the snd_pcm_link_mode() and snd_pcm_transition() functions. Both of these functions
are available after you install this update.
- Changed state transition when a preemption state clears
- If the preemption state is cleared and the client application didn't previously called snd_pcm_*_go() or snd_pcm_*_write(), the subchannel transitions back to the PREPARED state.
- Audio management occurs on non-active channels
- Previously, audio management preemption didn't occur when you enabled audio ducking on a subchannel that wasn't in an active, streaming state (e.g., calling snd_pcm_channel_audio_ducking()). Active subchannels are in the RUNNING, SUSPENDED, or PAUSED state.
- This update permits audio preemption to occur on a non-active channel and allow a subchannel to receive SND_PCM_EVENT_* events when you enable ducking behavior on a non-active subchannel. Now this allows, for example, a subchannel to transition from the PREPARED to the SUSPENDED state.
Note: Audio preemption doesn't occur unless you call snd_pcm_*_prepare(). You can call snd_pcm_channel_audio_ducking() before or after the subchannel transitions to the PREPARED state.
- The following is a summary of the state transitions that can occur with this update when audio management policies are in place:
- If a subchannel is in the READY state, audio ducking policies are applied, but audio management preemption policies are not, and therefore the subchannel stays in the READY state.
- If the subchannel is in a PREPARED state and audio preemption occurs, the subchannel changes to the SUSPENDED state.
- If the client application attempts to start the subchannel while it's in the SUSPENDED state, what occurs depends on whether it's soft- or hard-suspended:
- If the preemption state is cleared and the client application didn't previously called snd_pcm_*_go() or snd_pcm_*_write(), the subchannel transitions back to the PREPARED state.
- If the subchannel isn't streaming and snd_pcm_*_resume() is called while the subchannel is soft-suspended, the subchannel transitions back to the PREPARED state.
Previously, when you grouped audio subchannels together using the snd_pcm_link() call, you could start the audio streams only by meeting the start mode condition. With this update, you can also call snd_pcm_*_resume(), snd_pcm_*_pause(), and snd_pcm_*_prepare() on the grouped PCM handles.
For more information, see Understanding preemption.
- Usage change of second argument in the snd_pcm_link() function
- The second argument in the snd_pcm_link() must be a
PCM handle that doesn't belong to a PCM group. For more information,
see note in snd_pcm_link().
The following entries are new:
- New snd_pcm_link_transition(),
which triggers other handles in the group to start playback as soon
as the specified audio subchannel's currently buffered data
has been completely written to the hardware.
- New snd_pcm_link_mode()
function, which sets the link mode for a subchannel in a group.
- New ducking_state member added to the snd_pcm_channel_status_t()
type, has a new ducking_state member which provides the
reason ducking occurred.