asoundrc.template provides configuration for the ainit utility. It's a
template file and ainit will create final ALSA configuration file according to it.
asoundrc.template is a common ALSA configuration file (like /etc/alsa/alsa.conf),
but with one difference. Everything between two '%' chars is processed and replaced by ainit.
When ainit is lauched, it parses the asoundrc.template file and copies it
to target (defined in ainit.conf). If ainit finds defined string
enclosed by '%' chars, it will take corresponding action (allocate/free memory, semaphore)
and eventualy write result to the target file.
Ainit can recognize this tokens:
%ipc_sem%
If ainit is lauched with "start" argument and this token is found
it will allocate new IPC semaphore and write appropriate ipc_key to the target file.
This semaphore can be used with alsa-lib for secure sound data sharing
with dmix, dshare or dsnoop plugins because this semaphore is allocated with
restricted permissions.
If ainit is lauched with "stop" argument and this token is found
it will free this IPC semaphore.
%ipc_mem_direct%
%ipc_mem_plug%
If ainit is lauched with "start" argument and one of this tokens is found
it will allocate new shared memory and write appropriate ipc_key to the target file.
This memory can be used with alsa-lib for secure sound data sharing
with dmix, dshare or dsnoop plugins because this memory is allocated with
restricted permissions.
If ainit is lauched with "stop" argument and one of this tokens is found
it will free this shared memory.
EXAMPLE
#
# Sample asoundrc.template file for dmix plugin
# enabled for the first sound card
#
pcm.!default {
type plug
slave.pcm "dmixer"
}
pcm.dmixer {
type dmix
%ipc_sem%
%ipc_mem_direct%
%ipc_mem_plug%
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
}
ctl.dmixer {
type hw
card 0
}