1
Index: alsa-lib-1.0.20/src/pcm/pcm_ioplug.c
2
===================================================================
3
--- alsa-lib-1.0.20.orig/src/pcm/pcm_ioplug.c 2009-09-06 10:14:02.000000000 -0400
4
+++ alsa-lib-1.0.20/src/pcm/pcm_ioplug.c 2009-09-06 10:31:01.000000000 -0400
8
if (io->data->state != SND_PCM_STATE_PREPARED)
12
err = io->data->callback->start(io->data);
14
Index: alsa-lib-1.0.20/src/pcm/pcm_meter.c
15
===================================================================
16
--- alsa-lib-1.0.20.orig/src/pcm/pcm_meter.c 2009-09-06 10:14:02.000000000 -0400
17
+++ alsa-lib-1.0.20/src/pcm/pcm_meter.c 2009-09-06 10:31:01.000000000 -0400
19
struct _snd_pcm_scope {
22
- snd_pcm_scope_ops_t *ops;
23
+ const snd_pcm_scope_ops_t *ops;
25
struct list_head list;
28
* \param scope PCM meter scope
29
* \param val callbacks
31
-void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, snd_pcm_scope_ops_t *val)
32
+void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, const snd_pcm_scope_ops_t *val)
36
Index: alsa-lib-1.0.20/src/pcm/pcm_mmap_emul.c
37
===================================================================
38
--- alsa-lib-1.0.20.orig/src/pcm/pcm_mmap_emul.c 2009-09-06 10:14:02.000000000 -0400
39
+++ alsa-lib-1.0.20/src/pcm/pcm_mmap_emul.c 2009-09-06 10:31:01.000000000 -0400
41
unsigned int mmap_emul :1;
42
snd_pcm_uframes_t hw_ptr;
43
snd_pcm_uframes_t appl_ptr;
44
+ snd_pcm_uframes_t start_threshold;
52
+static int snd_pcm_mmap_emul_sw_params(snd_pcm_t *pcm,
53
+ snd_pcm_sw_params_t *params)
55
+ mmap_emul_t *map = pcm->private_data;
58
+ map->start_threshold = params->start_threshold;
60
+ /* HACK: don't auto-start in the slave PCM */
61
+ params->start_threshold = pcm->boundary;
62
+ err = snd_pcm_generic_sw_params(pcm, params);
65
+ /* restore the value for this PCM */
66
+ params->start_threshold = map->start_threshold;
70
static int snd_pcm_mmap_emul_prepare(snd_pcm_t *pcm)
72
mmap_emul_t *map = pcm->private_data;
74
snd_pcm_uframes_t offset;
75
snd_pcm_sframes_t size;
77
+ /* HACK: don't start stream automatically at commit in mmap mode */
78
+ pcm->start_threshold = pcm->boundary;
80
size = map->appl_ptr - *slave->appl.ptr;
82
size += pcm->boundary;
85
- offset = *slave->appl.ptr % pcm->buffer_size;
86
- return snd_pcm_write_mmap(pcm, offset, size);
88
+ offset = *slave->appl.ptr % pcm->buffer_size;
89
+ size = snd_pcm_write_mmap(pcm, offset, size);
91
+ pcm->start_threshold = map->start_threshold; /* restore */
95
/* read the available chunk on the slave PCM to mmap buffer */
97
.hw_refine = snd_pcm_mmap_emul_hw_refine,
98
.hw_params = snd_pcm_mmap_emul_hw_params,
99
.hw_free = snd_pcm_generic_hw_free,
100
- .sw_params = snd_pcm_generic_sw_params,
101
+ .sw_params = snd_pcm_mmap_emul_sw_params,
102
.channel_info = snd_pcm_generic_channel_info,
103
.dump = snd_pcm_mmap_emul_dump,
104
.nonblock = snd_pcm_generic_nonblock,
105
Index: alsa-lib-1.0.20/src/pcm/pcm_dmix_i386.h
106
===================================================================
107
--- alsa-lib-1.0.20.orig/src/pcm/pcm_dmix_i386.h 2009-09-06 10:14:02.000000000 -0400
108
+++ alsa-lib-1.0.20/src/pcm/pcm_dmix_i386.h 2009-09-06 10:31:01.000000000 -0400
110
"\tmovzwl (%%esi), %%ecx\n"
111
"\tmovl (%%ebx), %%edx\n"
112
"\tsall $16, %%eax\n"
113
+ "\torl %%eax, %%ecx\n"
114
"\t" LOCK_PREFIX "btsw $0, (%%edi)\n"
115
- "\tleal (%%ecx,%%eax,1), %%ecx\n"
117
"\t" XSUB " %%edx, %%ecx\n"
119
Index: alsa-lib-1.0.20/src/pcm/pcm_dmix_x86_64.h
120
===================================================================
121
--- alsa-lib-1.0.20.orig/src/pcm/pcm_dmix_x86_64.h 2009-09-06 10:14:02.000000000 -0400
122
+++ alsa-lib-1.0.20/src/pcm/pcm_dmix_x86_64.h 2009-09-06 10:31:01.000000000 -0400
123
@@ -284,11 +284,11 @@
126
"\tmovsbl 2(%%rsi), %%eax\n"
127
- "\tmovswl (%%rsi), %%ecx\n"
128
+ "\tmovzwl (%%rsi), %%ecx\n"
129
"\tmovl (%%rbx), %%edx\n"
130
"\tsall $16, %%eax\n"
131
+ "\torl %%eax, %%ecx\n"
132
"\t" LOCK_PREFIX "btsw $0, (%%rdi)\n"
133
- "\t.byte 0x67, 0x8d, 0x0c, 0x01\n"
135
"\t" XSUB " %%edx, %%ecx\n"
137
Index: alsa-lib-1.0.20/src/pcm/pcm_hooks.c
138
===================================================================
139
--- alsa-lib-1.0.20.orig/src/pcm/pcm_hooks.c 2009-09-06 10:14:02.000000000 -0400
140
+++ alsa-lib-1.0.20/src/pcm/pcm_hooks.c 2009-09-06 10:31:01.000000000 -0400
142
struct list_head list;
145
+struct snd_pcm_hook_dllist {
147
+ struct list_head list;
151
snd_pcm_generic_t gen;
152
struct list_head hooks[SND_PCM_HOOK_TYPE_LAST + 1];
153
+ struct list_head dllist;
157
+static int hook_add_dlobj(snd_pcm_t *pcm, void *dlobj)
159
+ snd_pcm_hooks_t *h = pcm->private_data;
160
+ struct snd_pcm_hook_dllist *dl;
162
+ dl = malloc(sizeof(*dl));
167
+ list_add_tail(&dl->list, &h->dllist);
171
+static void hook_remove_dlobj(struct snd_pcm_hook_dllist *dl)
173
+ list_del(&dl->list);
174
+ snd_dlclose(dl->dlobj);
178
static int snd_pcm_hooks_close(snd_pcm_t *pcm)
180
snd_pcm_hooks_t *h = pcm->private_data;
182
snd_pcm_hook_remove(hook);
185
+ while (!list_empty(&h->dllist)) {
186
+ pos = h->dllist.next;
187
+ hook_remove_dlobj(list_entry(pos, struct snd_pcm_hook_dllist, list));
189
err = snd_pcm_generic_close(pcm);
193
for (k = 0; k <= SND_PCM_HOOK_TYPE_LAST; ++k) {
194
INIT_LIST_HEAD(&h->hooks[k]);
196
+ INIT_LIST_HEAD(&h->dllist);
197
err = snd_pcm_new(&pcm, SND_PCM_TYPE_HOOKS, name, slave->stream, slave->mode);
201
snd_config_iterator_t i, next;
202
int (*install_func)(snd_pcm_t *pcm, snd_config_t *args) = NULL;
205
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
206
SNDERR("Invalid hook definition");
208
@@ -402,20 +435,26 @@
211
snd_config_delete(type);
213
- if (args && snd_config_get_string(args, &str) >= 0) {
214
- err = snd_config_search_definition(root, "hook_args", str, &args);
216
- SNDERR("unknown hook_args %s", str);
218
- err = install_func(pcm, args);
219
- snd_config_delete(args);
224
+ if (args && snd_config_get_string(args, &str) >= 0) {
225
+ err = snd_config_search_definition(root, "hook_args", str, &args);
227
+ SNDERR("unknown hook_args %s", str);
229
err = install_func(pcm, args);
230
+ snd_config_delete(args);
232
+ err = install_func(pcm, args);
235
+ err = hook_add_dlobj(pcm, h);
246
Index: alsa-lib-1.0.20/src/conf/cards/USB-Audio.conf
247
===================================================================
248
--- alsa-lib-1.0.20.orig/src/conf/cards/USB-Audio.conf 2009-09-06 10:14:02.000000000 -0400
249
+++ alsa-lib-1.0.20/src/conf/cards/USB-Audio.conf 2009-09-06 10:31:01.000000000 -0400
251
# If a device requires non-standard definitions for front, surround40,
252
# surround51, surround71 or iec958, they can be defined here.
254
-# USB-Audio."NoiseBlaster 3000".pcm.surround51 {
256
-# @args.CARD { type string }
259
+# M-Audio AudioPhile USB:
260
+# device 0: analog output, digital input
261
+# device 1: digital output, analog input
262
+USB-Audio."AudioPhile".pcm.default {
264
+ @args.CARD { type string }
278
+ strings [ "dsnoop:DEVICE=1,CARD=" $CARD ]
282
+USB-Audio."AudioPhile".pcm.iec958 {
283
+ @args [ CARD AES0 AES1 AES2 AES3 ]
284
+ @args.CARD { type string }
285
+ @args.AES0 { type integer }
286
+ @args.AES1 { type integer }
287
+ @args.AES2 { type integer }
288
+ @args.AES3 { type integer }
303
################################################################################
304
Index: alsa-lib-1.0.20/include/pcm.h
305
===================================================================
306
--- alsa-lib-1.0.20.orig/include/pcm.h 2009-09-06 10:34:28.000000000 -0400
307
+++ alsa-lib-1.0.20/include/pcm.h 2009-09-06 10:37:14.000000000 -0400
308
@@ -1022,7 +1022,8 @@
309
int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope);
310
snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name);
311
int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr);
312
-void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, snd_pcm_scope_ops_t *val);
313
+void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope,
314
+ const snd_pcm_scope_ops_t *val);
315
void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val);
316
const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope);
317
void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope);