| 1 |
The Debian Package osso-dsp-plugin-alsa |
| 2 |
---------------------------- |
| 3 |
|
| 4 |
Comments regarding the Package |
| 5 |
|
| 6 |
Eduardo Valentin <[email protected]>, Wed, 5 Apr 2006 10:28:06 +0300 |
| 7 |
|
| 8 |
|
| 9 |
OSSO DSP SW <--> ALSA DSP plugin |
| 10 |
======================== |
| 11 |
|
| 12 |
This plugin converts the ALSA API over PCM task nodes protocol. In this way, |
| 13 |
ALSA native applications can run over DSP Gateway and use DSP PCM task nodes. |
| 14 |
|
| 15 |
This plugin provides the PCM type "alsa_dsp". The typical configuration |
| 16 |
looks like below: |
| 17 |
|
| 18 |
# PCM |
| 19 |
pcm.!default { |
| 20 |
type alsa_dsp |
| 21 |
playback_device_file ["/dev/dsptask/pcm2"] |
| 22 |
recording_device_file ["/dev/dsptask/pcm_rec"] |
| 23 |
} |
| 24 |
|
| 25 |
Put the above to ~/.asoundrc (or /etc/asound.conf or /usr/share/alsa/alsa.conf), |
| 26 |
and use "default" PCM with your ALSA apps. For example: |
| 27 |
|
| 28 |
% aplay -Ddefault foo.wav |
| 29 |
% arecord -Ddefault foo.wav |
| 30 |
|
| 31 |
The alsa_dsp plugin can have two options for pcm interface: |
| 32 |
a. playback_device_file: this is a list of PCM task node device files whose |
| 33 |
alsa_dsp plugin is allowed to use to do playback. For example: /dev/dsptask/pcm2. |
| 34 |
b. recording_device_file: this is a list of PCM task node device files whose |
| 35 |
alsa_dsp plugin is allowed to use to do recording. For example: /dev/dsptask/pcm_rec. |
| 36 |
|
| 37 |
The alsa_dsp plugin will probe the dsp task node files you provide and |
| 38 |
will use the first one whose dsp PCM task is in UNINITIALISED state. |
| 39 |
If no dsp PCM task node is usable, alsa_dsp plugin will return an ENODEV |
| 40 |
error code. |
| 41 |
|
| 42 |
For the control interface, this plugin provides the CTL type "dsp_ctl". A |
| 43 |
typical configuration is: |
| 44 |
# Mixer |
| 45 |
ctl.!default { |
| 46 |
type dsp_ctl |
| 47 |
playback_devices ["/dev/dsptask/pcm2"] |
| 48 |
recording_devices ["/dev/dsptask/pcm_rec"] |
| 49 |
} |
| 50 |
|
| 51 |
Put the above to ~/.asoundrc (or /etc/asound.conf or /usr/share/alsa/alsa.conf), |
| 52 |
and use "default" CTL with your ALSA apps. For example: |
| 53 |
% alsamixer -Ddefault |
| 54 |
|
| 55 |
The dsp_ctl plugin can have two options for ctl interface: |
| 56 |
a. playback_devices: this is a list of PCM task node device files whose |
| 57 |
dsp_ctl plugin is allowed to use to do volume control changing. These |
| 58 |
devices will be handled under the "PCM Playback Volume" and "PCM Playback Switch" |
| 59 |
control names. |
| 60 |
b. recording_devices: this is a list of PCM task node device files whose |
| 61 |
dsp_ctl plugin is allowed to use to do volume control changing. |
| 62 |
These devices will be handled under the "Capture Switch" control name. |
| 63 |
|
| 64 |
# Supported formats: |
| 65 |
|
| 66 |
Playback: |
| 67 |
16-bit PCM formats: |
| 68 |
S16_LE |
| 69 |
S16_BE |
| 70 |
U16_LE |
| 71 |
U16_BE |
| 72 |
8-bit PCM formats: |
| 73 |
A_LAW |
| 74 |
MU_LAW |
| 75 |
U8 |
| 76 |
S8 |
| 77 |
Rates: |
| 78 |
8 KHz, 11.025 KHz, 12 KHz, 16 KHz, |
| 79 |
22.050 KHz, 24 KHz, 32 KHz, 44.1 KHz, 48 KHz |
| 80 |
Channels: Mono and Stereo |
| 81 |
Recording: |
| 82 |
16-bit PCM formats: |
| 83 |
S16_LE |
| 84 |
8-bit PCM formats: |
| 85 |
A_LAW |
| 86 |
MU_LAW |
| 87 |
Rates: |
| 88 |
8 KHz |
| 89 |
Channels: Mono |
| 90 |
|
| 91 |
# Compilation |
| 92 |
To cross-compile the plugin inside scratchbox environment, you will |
| 93 |
need a libasound2 version of binaries and header files installed. |
| 94 |
Pthreads is also required. The source directory provides a Makefile. |
| 95 |
If you just type: |
| 96 |
|
| 97 |
% make clean |
| 98 |
% make |
| 99 |
|
| 100 |
under the source tree, it will generate the binaries under the |
| 101 |
"bin" sub-directory. Like: |
| 102 |
|
| 103 |
libasound_module_ctl_dsp_ctl.so and libasound_module_pcm_alsa_dsp.so |
| 104 |
|
| 105 |
The libasound_module_ctl_dsp_ctl.so is currently a symbolic link to |
| 106 |
libasound_module_pcm_alsa_dsp.so. |
| 107 |
|
| 108 |
You can just copy then to your /usr/lib/alsa-lib/ directory inside your |
| 109 |
target file system. |
| 110 |
|
| 111 |
You can also modify the behaviour of this plugin using macro definitions |
| 112 |
while compiling it. Here are macros whose can be used in CFLAGS (-D <macro>): |
| 113 |
ERROR_DEBUG It enables error debug output. You have to |
| 114 |
change in "debug.h" file. Default is to debug. |
| 115 |
DEBUG It enables debug output. You have to change in |
| 116 |
"debug.h" file. Default is not to debug. |
| 117 |
NORMAL_DSP_TASK It enables utilization of extended fields in |
| 118 |
audio_status_info_t data structure (mute, |
| 119 |
samples_played_high, samples_played_low). |
| 120 |
You can change it in "Makefile". Default |
| 121 |
is NORMAL_DSP_TASK enabled. |
| 122 |
USE_RESOURCE_MANAGER If set, the resource manager D-BUS interface |
| 123 |
will be used for power management instead of |
| 124 |
the sysfs file. |
| 125 |
ERROR_ON_PM_FAILURE It controls this plugin behaviour if it fails |
| 126 |
while openning MIC power management file |
| 127 |
(/sys/devices/platform/audio-i2c/mic_enable) |
| 128 |
or calling the resource manager request() |
| 129 |
method (if USE_RESOURCE_MANAGER is set). |
| 130 |
If you enable this macro, this plugin will |
| 131 |
return an error code. Otherwise, it will |
| 132 |
just print a debug message, and will return |
| 133 |
sucess. You can change it in Makefile. Default |
| 134 |
is ERROR_ON_PM_FAILURE disabled. |
| 135 |
|
| 136 |
# Installation |
| 137 |
The plugin is installed in /usr/lib/alsa-lib directory as default, |
| 138 |
which is the default search path of additional plugins for alsa-lib. |
| 139 |
|
| 140 |
This plugin is expected to be compatible with any standard ALSA application. |
| 141 |
The only requirement is you have to compile it against the same libasound2 you |
| 142 |
have installed in your target system. You have to enable the external plugins |
| 143 |
support in libasound2: |
| 144 |
|
| 145 |
% cd $LIB_ASOUND2_SRC |
| 146 |
% ./configure --with-pcm-plugins=extplug |
| 147 |
|
| 148 |
You can get the latest version of libasound2 in http://www.alsa-project.org. |
| 149 |
There you can find more instructions of how to compile libasound2. The cross-compilation |
| 150 |
for ARM architecture is straightforward inside the scratchbox environment. |
| 151 |
|
| 152 |
|
| 153 |
# Applications |
| 154 |
|
| 155 |
Alsa-utils: |
| 156 |
Also from http://www.alsa-project.org, you can find alsa-utils package sources. |
| 157 |
This package constains standard ALSA application, like amixer, alsamixer and |
| 158 |
aplay/arecord. |
| 159 |
|
| 160 |
The compilation of alsa-utils is also straightforward inside scratchbox environment. |
| 161 |
The only requirement is you will need to have libasound2 (and libncurses) installed |
| 162 |
inside your scratchbox environment to be able to compile alsa-utils. |
| 163 |
|
| 164 |
After compiling and installing applications on your target, you can |
| 165 |
use them with this plugin specifing the correct pcm device. For example, |
| 166 |
if you have installed alsaplayer on your target, you can specify an alsa pcm |
| 167 |
device with: |
| 168 |
target # alsaplayer -d default |
| 169 |
|
| 170 |
#Limitation |
| 171 |
|
| 172 |
- While the plugin is using a pcm task node, another applications, |
| 173 |
for example gstreamer, can not use the same task node. This will cause |
| 174 |
unexpected behaviour. |
| 175 |
- If an application does not close alsa device properly, this plugin |
| 176 |
will not have chance to release all reserved resouces. One expected |
| 177 |
behaviour in this case is to have -EBUSY error for following applications |
| 178 |
whose try to open the same alsa device. Partialy solved (version 0.6) |
| 179 |
with __attribute__((destructor)) functions. But if the application |
| 180 |
receives an uncaught signal, resources may be kept unreleased. |
| 181 |
- If many requests to volume information read / write is done in the |
| 182 |
same alsa device while it is being used to do playback, this playback |
| 183 |
could be affected and some little stops can be heard. |