Mercurial > audlegacy-plugins
annotate src/alsa-ng/alsa-util.c @ 3192:d1d9b159801a
alsa-ng: Add configuration settings.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sat, 27 Jun 2009 14:53:36 -0500 |
parents | 2f5be25204f3 |
children |
rev | line source |
---|---|
3162
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
1 /* |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
2 * Audacious ALSA Plugin (-ng) |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
3 * Copyright (c) 2009 William Pitcock <nenolod@dereferenced.org> |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
4 * |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
7 * the Free Software Foundation; either version 2 of the License, or |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
8 * (at your option) any later version. |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
9 * |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
14 * |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
18 */ |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
19 |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
20 #include "alsa-stdinc.h" |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
21 |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
22 static alsaplug_format_mapping_t alsaplug_format_conv_tbl[] = { |
3185
d3cf6d14c960
alsa-ng: Add support for SND_FLOAT (SND_PCM_FORMAT_FLOAT).
William Pitcock <nenolod@atheme.org>
parents:
3162
diff
changeset
|
23 {FMT_FLOAT, SND_PCM_FORMAT_FLOAT}, |
3187
360e92f3211d
alsa-ng: Apparently 24bit values are padded to 32bit, so we need to tell ALSA that.
William Pitcock <nenolod@atheme.org>
parents:
3185
diff
changeset
|
24 {FMT_S32_LE, SND_PCM_FORMAT_S32_LE}, |
360e92f3211d
alsa-ng: Apparently 24bit values are padded to 32bit, so we need to tell ALSA that.
William Pitcock <nenolod@atheme.org>
parents:
3185
diff
changeset
|
25 {FMT_S32_BE, SND_PCM_FORMAT_S32_BE}, |
360e92f3211d
alsa-ng: Apparently 24bit values are padded to 32bit, so we need to tell ALSA that.
William Pitcock <nenolod@atheme.org>
parents:
3185
diff
changeset
|
26 {FMT_S32_NE, SND_PCM_FORMAT_S32}, |
3188 | 27 {FMT_S24_LE, SND_PCM_FORMAT_S24_LE}, |
28 {FMT_S24_BE, SND_PCM_FORMAT_S24_BE}, | |
29 {FMT_S24_NE, SND_PCM_FORMAT_S24}, | |
30 {FMT_U24_LE, SND_PCM_FORMAT_U24_LE}, | |
31 {FMT_U24_BE, SND_PCM_FORMAT_U24_BE}, | |
32 {FMT_U24_NE, SND_PCM_FORMAT_U24}, | |
3162
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
33 {FMT_S16_LE, SND_PCM_FORMAT_S16_LE}, |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
34 {FMT_S16_BE, SND_PCM_FORMAT_S16_BE}, |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
35 {FMT_S16_NE, SND_PCM_FORMAT_S16}, |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
36 {FMT_U16_LE, SND_PCM_FORMAT_U16_LE}, |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
37 {FMT_U16_BE, SND_PCM_FORMAT_U16_BE}, |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
38 {FMT_U16_NE, SND_PCM_FORMAT_U16}, |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
39 {FMT_U8, SND_PCM_FORMAT_U8}, |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
40 {FMT_S8, SND_PCM_FORMAT_S8}, |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
41 }; |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
42 |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
43 snd_pcm_format_t |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
44 alsaplug_format_convert(AFormat fmt) |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
45 { |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
46 gint i; |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
47 |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
48 for (i = 0; i < G_N_ELEMENTS(alsaplug_format_conv_tbl); i++) |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
49 { |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
50 if (alsaplug_format_conv_tbl[i].aud_fmt == fmt) |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
51 return alsaplug_format_conv_tbl[i].alsa_fmt; |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
52 } |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
53 |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
54 return SND_PCM_FORMAT_UNKNOWN; |
e387614b9be9
alsa-ng: Import rewritten ALSA plugin. This is still woefully incomplete, but supports basic playback.
William Pitcock <nenolod@atheme.org>
parents:
diff
changeset
|
55 } |