Updates to the libasound
library client APIs require audio applications to make some minor modifications.
For information on migration for audio drivers (deva-*), see
Board Support Packages.
Audio mixer controls and channel mapping
The audio mixer controls and
channel mapping have been updated to improve support for multichannel audio systems. The
library now supports up to 64 channel positions (see
snd_pcm_chmap_position in
asound.h for the full
list of supported channel positions). The majority of the changes affect drivers only,
but the following changes to the
snd_mixer_group_t structure may affect
audio applications:
- uint32_t channel is now uint64_t
channel_mask.
- uint32_t mute is now uint64_t
mute.
- uint32_t capture is now uint64_t
capture.
- SND_MIXER_CHN_* definitions that correspond to the
SND_CHMAP_* definitions with a value over 31 have been
created.
This change corresponds to a change in
SND_MIXER_VERSION from 3.0.0
to 3.0.1. You can use this preprocessor switch to compile for the appropriate version as
required. For
example:
#if (SND_MIXER_VERSION >= SND_PROTOCOL_VERSION('M',3,0,1))
if (((1ULL<<snd_mixer_chn) & gi.channel_mask)) {
#else
if (((1UL<<snd_mixer_chn) & gi.channels)) {
#endif
For
more information about snd_mixer_group_t, see the Audio
Library chapter of the Audio Developer's Guide.
*_flush() and *_drain()
Previously, flush and drain behavior for playback was opposite to what the function
name described, and the flush behavior for capture and playback were not consistent.
To resolve these issues, QNX SDP 7.1 replaces the
*_flush() and
*_drain() functions with the following APIs:
- snd_pcm_channel_drop()
- Stop playback or capture immediately and discard buffered data.
- snd_pcm_channel_drain()
- For playback, block until buffered data is fully consumed by the
hardware and then stop the stream. For capture, stop the stream
immediately but preserve the buffered data so that clients can continue
to read it until it is fully consumed.
-
snd_pcm_plugin_drop()
- Plugin-aware version of snd_pcm_channel_drop().
- snd_pcm_plugin_drain()
- Plugin-aware version of snd_pcm_channel_drain().
This change corresponds to a change in
SND_PCM_VERSION from
3.0.1 to 3.0.2. You can use this preprocessor switch to compile for the appropriate
version as required. For
example:
#if SND_PCM_VERSION >= SND_PROTOCOL_VERSION('P',3,0,2)
if (channel == SND_PCM_CHANNEL_PLAYBACK)
rtn = snd_pcm_plugin_drain (pcm_handle, SND_PCM_CHANNEL_PLAYBACK);
else if (channel == SND_PCM_CHANNEL_CAPTURE)
rtn = snd_pcm_plugin_drop(pcm_handle, SND_PCM_CHANNEL_CAPTURE);
#else
rtn = snd_pcm_plugin_flush (pcm_handle, channel);
#endif
For
more information on the drop and drain functions, see the Audio
Library chapter of the Audio Developer's
Guide.
snd_ctl_ducking_read()
The
snd_ctl_ducking_read() function has been deprecated and will be
removed in a future version of the product. Its replacement is
snd_ctl_ducking_status_read(). For more information, see
snd_ctl_ducking_status_read() in the
Audio
Developer's Guide.
snd_pcm_channel_params_t
Because the buffered playback mode
has been deprecated, the frags_buffered_max member has been removed
from snd_pcm_channel_params_t.