]> git.proxmox.com Git - mirror_qemu.git/blame - audio/fmodaudio.c
same PCI parameters as PIIX3
[mirror_qemu.git] / audio / fmodaudio.c
CommitLineData
85571bc7 1/*
1d14ffa9
FB
2 * QEMU FMOD audio driver
3 *
4 * Copyright (c) 2004-2005 Vassili Karpov (malc)
5 *
85571bc7
FB
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24#include <fmod.h>
25#include <fmod_errors.h>
26#include "vl.h"
27
1d14ffa9
FB
28#define AUDIO_CAP "fmod"
29#include "audio_int.h"
fb065187 30
1d14ffa9
FB
31typedef struct FMODVoiceOut {
32 HWVoiceOut hw;
fb065187
FB
33 unsigned int old_pos;
34 FSOUND_SAMPLE *fmod_sample;
35 int channel;
1d14ffa9 36} FMODVoiceOut;
85571bc7 37
1d14ffa9
FB
38typedef struct FMODVoiceIn {
39 HWVoiceIn hw;
40 FSOUND_SAMPLE *fmod_sample;
41} FMODVoiceIn;
85571bc7
FB
42
43static struct {
1d14ffa9 44 const char *drvname;
85571bc7
FB
45 int nb_samples;
46 int freq;
47 int nb_channels;
48 int bufsize;
49 int threshold;
1d14ffa9 50 int broken_adc;
85571bc7 51} conf = {
1d14ffa9
FB
52 NULL,
53 2048 * 2,
85571bc7 54 44100,
1d14ffa9
FB
55 2,
56 0,
85571bc7 57 0,
1d14ffa9 58 0
85571bc7
FB
59};
60
1d14ffa9
FB
61static void GCC_FMT_ATTR (1, 2) fmod_logerr (const char *fmt, ...)
62{
63 va_list ap;
64
65 va_start (ap, fmt);
66 AUD_vlog (AUDIO_CAP, fmt, ap);
67 va_end (ap);
68
69 AUD_log (AUDIO_CAP, "Reason: %s\n",
70 FMOD_ErrorString (FSOUND_GetError ()));
71}
72
73static void GCC_FMT_ATTR (2, 3) fmod_logerr2 (
74 const char *typ,
75 const char *fmt,
76 ...
77 )
78{
79 va_list ap;
80
81 AUD_log (AUDIO_CAP, "Can not initialize %s\n", typ);
82
83 va_start (ap, fmt);
84 AUD_vlog (AUDIO_CAP, fmt, ap);
85 va_end (ap);
86
87 AUD_log (AUDIO_CAP, "Reason: %s\n",
88 FMOD_ErrorString (FSOUND_GetError ()));
89}
85571bc7 90
1d14ffa9 91static int fmod_write (SWVoiceOut *sw, void *buf, int len)
85571bc7 92{
1d14ffa9 93 return audio_pcm_sw_write (sw, buf, len);
85571bc7
FB
94}
95
1d14ffa9 96static void fmod_clear_sample (FMODVoiceOut *fmd)
85571bc7 97{
1d14ffa9 98 HWVoiceOut *hw = &fmd->hw;
85571bc7
FB
99 int status;
100 void *p1 = 0, *p2 = 0;
101 unsigned int len1 = 0, len2 = 0;
102
103 status = FSOUND_Sample_Lock (
104 fmd->fmod_sample,
105 0,
1d14ffa9 106 hw->samples << hw->info.shift,
85571bc7
FB
107 &p1,
108 &p2,
109 &len1,
110 &len2
111 );
112
113 if (!status) {
1d14ffa9 114 fmod_logerr ("Failed to lock sample\n");
85571bc7
FB
115 return;
116 }
117
1d14ffa9
FB
118 if ((len1 & hw->info.align) || (len2 & hw->info.align)) {
119 dolog ("Lock returned misaligned length %d, %d, alignment %d\n",
120 len1, len2, hw->info.align + 1);
85571bc7
FB
121 goto fail;
122 }
123
1d14ffa9
FB
124 if ((len1 + len2) - (hw->samples << hw->info.shift)) {
125 dolog ("Lock returned incomplete length %d, %d\n",
126 len1 + len2, hw->samples << hw->info.shift);
85571bc7
FB
127 goto fail;
128 }
1d14ffa9
FB
129
130 audio_pcm_info_clear_buf (&hw->info, p1, hw->samples);
85571bc7
FB
131
132 fail:
133 status = FSOUND_Sample_Unlock (fmd->fmod_sample, p1, p2, len1, len2);
134 if (!status) {
1d14ffa9 135 fmod_logerr ("Failed to unlock sample\n");
85571bc7
FB
136 }
137}
138
1d14ffa9 139static void fmod_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len)
85571bc7 140{
1d14ffa9
FB
141 int src_len1 = dst_len;
142 int src_len2 = 0;
143 int pos = hw->rpos + dst_len;
144 st_sample_t *src1 = hw->mix_buf + hw->rpos;
145 st_sample_t *src2 = NULL;
146
147 if (pos > hw->samples) {
148 src_len1 = hw->samples - hw->rpos;
149 src2 = hw->mix_buf;
85571bc7
FB
150 src_len2 = dst_len - src_len1;
151 pos = src_len2;
152 }
153
154 if (src_len1) {
155 hw->clip (dst, src1, src_len1);
1d14ffa9 156 mixeng_clear (src1, src_len1);
85571bc7
FB
157 }
158
159 if (src_len2) {
1d14ffa9 160 dst = advance (dst, src_len1 << hw->info.shift);
85571bc7 161 hw->clip (dst, src2, src_len2);
1d14ffa9 162 mixeng_clear (src2, src_len2);
85571bc7 163 }
1d14ffa9
FB
164
165 hw->rpos = pos % hw->samples;
85571bc7
FB
166}
167
1d14ffa9 168static int fmod_unlock_sample (FSOUND_SAMPLE *sample, void *p1, void *p2,
85571bc7
FB
169 unsigned int blen1, unsigned int blen2)
170{
1d14ffa9 171 int status = FSOUND_Sample_Unlock (sample, p1, p2, blen1, blen2);
85571bc7 172 if (!status) {
1d14ffa9 173 fmod_logerr ("Failed to unlock sample\n");
85571bc7
FB
174 return -1;
175 }
176 return 0;
177}
178
1d14ffa9
FB
179static int fmod_lock_sample (
180 FSOUND_SAMPLE *sample,
181 struct audio_pcm_info *info,
182 int pos,
183 int len,
184 void **p1,
185 void **p2,
186 unsigned int *blen1,
187 unsigned int *blen2
188 )
85571bc7 189{
85571bc7
FB
190 int status;
191
192 status = FSOUND_Sample_Lock (
1d14ffa9
FB
193 sample,
194 pos << info->shift,
195 len << info->shift,
85571bc7
FB
196 p1,
197 p2,
198 blen1,
199 blen2
200 );
201
202 if (!status) {
1d14ffa9 203 fmod_logerr ("Failed to lock sample\n");
85571bc7
FB
204 return -1;
205 }
206
1d14ffa9
FB
207 if ((*blen1 & info->align) || (*blen2 & info->align)) {
208 dolog ("Lock returned misaligned length %d, %d, alignment %d\n",
209 *blen1, *blen2, info->align + 1);
210
211 fmod_unlock_sample (sample, *p1, *p2, *blen1, *blen2);
212
213 *p1 = NULL - 1;
214 *p2 = NULL - 1;
215 *blen1 = ~0U;
216 *blen2 = ~0U;
85571bc7
FB
217 return -1;
218 }
1d14ffa9
FB
219
220 if (!*p1 && *blen1) {
221 dolog ("warning: !p1 && blen1=%d\n", *blen1);
222 *blen1 = 0;
223 }
224
225 if (!p2 && *blen2) {
226 dolog ("warning: !p2 && blen2=%d\n", *blen2);
227 *blen2 = 0;
228 }
229
85571bc7
FB
230 return 0;
231}
232
1d14ffa9 233static int fmod_run_out (HWVoiceOut *hw)
85571bc7 234{
1d14ffa9
FB
235 FMODVoiceOut *fmd = (FMODVoiceOut *) hw;
236 int live, decr;
85571bc7
FB
237 void *p1 = 0, *p2 = 0;
238 unsigned int blen1 = 0, blen2 = 0;
239 unsigned int len1 = 0, len2 = 0;
1d14ffa9 240 int nb_live;
85571bc7 241
1d14ffa9
FB
242 live = audio_pcm_hw_get_live_out2 (hw, &nb_live);
243 if (!live) {
244 return 0;
85571bc7
FB
245 }
246
247 if (!hw->pending_disable
1d14ffa9
FB
248 && nb_live
249 && (conf.threshold && live <= conf.threshold)) {
250 ldebug ("live=%d nb_live=%d\n", live, nb_live);
251 return 0;
85571bc7
FB
252 }
253
254 decr = live;
255
85571bc7 256 if (fmd->channel >= 0) {
1d14ffa9
FB
257 int len = decr;
258 int old_pos = fmd->old_pos;
259 int ppos = FSOUND_GetCurrentPosition (fmd->channel);
85571bc7 260
1d14ffa9
FB
261 if (ppos == old_pos || !ppos) {
262 return 0;
85571bc7 263 }
1d14ffa9
FB
264
265 if ((old_pos < ppos) && ((old_pos + len) > ppos)) {
266 len = ppos - old_pos;
267 }
268 else {
269 if ((old_pos > ppos) && ((old_pos + len) > (ppos + hw->samples))) {
270 len = hw->samples - old_pos + ppos;
271 }
272 }
273 decr = len;
274
275 if (audio_bug (AUDIO_FUNC, decr < 0)) {
276 dolog ("decr=%d live=%d ppos=%d old_pos=%d len=%d\n",
277 decr, live, ppos, old_pos, len);
278 return 0;
85571bc7 279 }
85571bc7 280 }
85571bc7 281
1d14ffa9
FB
282
283 if (!decr) {
284 return 0;
85571bc7
FB
285 }
286
1d14ffa9
FB
287 if (fmod_lock_sample (fmd->fmod_sample, &fmd->hw.info,
288 fmd->old_pos, decr,
289 &p1, &p2,
290 &blen1, &blen2)) {
291 return 0;
85571bc7
FB
292 }
293
1d14ffa9
FB
294 len1 = blen1 >> hw->info.shift;
295 len2 = blen2 >> hw->info.shift;
85571bc7
FB
296 ldebug ("%p %p %d %d %d %d\n", p1, p2, len1, len2, blen1, blen2);
297 decr = len1 + len2;
85571bc7 298
1d14ffa9
FB
299 if (p1 && len1) {
300 fmod_write_sample (hw, p1, len1);
85571bc7
FB
301 }
302
1d14ffa9
FB
303 if (p2 && len2) {
304 fmod_write_sample (hw, p2, len2);
85571bc7
FB
305 }
306
1d14ffa9 307 fmod_unlock_sample (fmd->fmod_sample, p1, p2, blen1, blen2);
85571bc7 308
85571bc7 309 fmd->old_pos = (fmd->old_pos + decr) % hw->samples;
1d14ffa9 310 return decr;
85571bc7
FB
311}
312
1d14ffa9 313static int aud_to_fmodfmt (audfmt_e fmt, int stereo)
85571bc7
FB
314{
315 int mode = FSOUND_LOOP_NORMAL;
316
317 switch (fmt) {
318 case AUD_FMT_S8:
319 mode |= FSOUND_SIGNED | FSOUND_8BITS;
320 break;
321
322 case AUD_FMT_U8:
323 mode |= FSOUND_UNSIGNED | FSOUND_8BITS;
324 break;
325
326 case AUD_FMT_S16:
327 mode |= FSOUND_SIGNED | FSOUND_16BITS;
328 break;
329
330 case AUD_FMT_U16:
331 mode |= FSOUND_UNSIGNED | FSOUND_16BITS;
332 break;
333
334 default:
1d14ffa9
FB
335 dolog ("Internal logic error: Bad audio format %d\n", fmt);
336#ifdef DEBUG_FMOD
337 abort ();
338#endif
339 mode |= FSOUND_8BITS;
85571bc7
FB
340 }
341 mode |= stereo ? FSOUND_STEREO : FSOUND_MONO;
342 return mode;
343}
344
1d14ffa9 345static void fmod_fini_out (HWVoiceOut *hw)
85571bc7 346{
1d14ffa9 347 FMODVoiceOut *fmd = (FMODVoiceOut *) hw;
85571bc7
FB
348
349 if (fmd->fmod_sample) {
350 FSOUND_Sample_Free (fmd->fmod_sample);
351 fmd->fmod_sample = 0;
352
353 if (fmd->channel >= 0) {
354 FSOUND_StopSound (fmd->channel);
355 }
356 }
357}
358
1d14ffa9 359static int fmod_init_out (HWVoiceOut *hw, int freq, int nchannels, audfmt_e fmt)
85571bc7
FB
360{
361 int bits16, mode, channel;
1d14ffa9 362 FMODVoiceOut *fmd = (FMODVoiceOut *) hw;
85571bc7 363
1d14ffa9 364 mode = aud_to_fmodfmt (fmt, nchannels == 2 ? 1 : 0);
85571bc7
FB
365 fmd->fmod_sample = FSOUND_Sample_Alloc (
366 FSOUND_FREE, /* index */
367 conf.nb_samples, /* length */
368 mode, /* mode */
369 freq, /* freq */
370 255, /* volume */
371 128, /* pan */
372 255 /* priority */
373 );
374
375 if (!fmd->fmod_sample) {
1d14ffa9 376 fmod_logerr2 ("DAC", "Failed to allocate FMOD sample\n");
85571bc7
FB
377 return -1;
378 }
379
380 channel = FSOUND_PlaySoundEx (FSOUND_FREE, fmd->fmod_sample, 0, 1);
381 if (channel < 0) {
1d14ffa9 382 fmod_logerr2 ("DAC", "Failed to start playing sound\n");
85571bc7
FB
383 FSOUND_Sample_Free (fmd->fmod_sample);
384 return -1;
385 }
386 fmd->channel = channel;
387
1d14ffa9
FB
388 /* FMOD always operates on little endian frames? */
389 audio_pcm_init_info (&hw->info, freq, nchannels, fmt,
390 audio_need_to_swap_endian (0));
391 bits16 = (mode & FSOUND_16BITS) != 0;
85571bc7
FB
392 hw->bufsize = conf.nb_samples << (nchannels == 2) << bits16;
393 return 0;
394}
395
1d14ffa9 396static int fmod_ctl_out (HWVoiceOut *hw, int cmd, ...)
85571bc7
FB
397{
398 int status;
1d14ffa9 399 FMODVoiceOut *fmd = (FMODVoiceOut *) hw;
85571bc7
FB
400
401 switch (cmd) {
402 case VOICE_ENABLE:
403 fmod_clear_sample (fmd);
404 status = FSOUND_SetPaused (fmd->channel, 0);
405 if (!status) {
1d14ffa9 406 fmod_logerr ("Failed to resume channel %d\n", fmd->channel);
85571bc7
FB
407 }
408 break;
409
410 case VOICE_DISABLE:
411 status = FSOUND_SetPaused (fmd->channel, 1);
412 if (!status) {
1d14ffa9 413 fmod_logerr ("Failed to pause channel %d\n", fmd->channel);
85571bc7
FB
414 }
415 break;
416 }
417 return 0;
418}
419
1d14ffa9
FB
420static int fmod_init_in (HWVoiceIn *hw, int freq, int nchannels, audfmt_e fmt)
421{
422 int bits16, mode;
423 FMODVoiceIn *fmd = (FMODVoiceIn *) hw;
424
425 if (conf.broken_adc) {
426 return -1;
427 }
428
429 mode = aud_to_fmodfmt (fmt, nchannels == 2 ? 1 : 0);
430 fmd->fmod_sample = FSOUND_Sample_Alloc (
431 FSOUND_FREE, /* index */
432 conf.nb_samples, /* length */
433 mode, /* mode */
434 freq, /* freq */
435 255, /* volume */
436 128, /* pan */
437 255 /* priority */
438 );
439
440 if (!fmd->fmod_sample) {
441 fmod_logerr2 ("ADC", "Failed to allocate FMOD sample\n");
442 return -1;
443 }
444
445 /* FMOD always operates on little endian frames? */
446 audio_pcm_init_info (&hw->info, freq, nchannels, fmt,
447 audio_need_to_swap_endian (0));
448 bits16 = (mode & FSOUND_16BITS) != 0;
449 hw->bufsize = conf.nb_samples << (nchannels == 2) << bits16;
450 return 0;
451}
452
453static void fmod_fini_in (HWVoiceIn *hw)
454{
455 FMODVoiceIn *fmd = (FMODVoiceIn *) hw;
456
457 if (fmd->fmod_sample) {
458 FSOUND_Record_Stop ();
459 FSOUND_Sample_Free (fmd->fmod_sample);
460 fmd->fmod_sample = 0;
461 }
462}
463
464static int fmod_run_in (HWVoiceIn *hw)
465{
466 FMODVoiceIn *fmd = (FMODVoiceIn *) hw;
467 int hwshift = hw->info.shift;
468 int live, dead, new_pos, len;
469 unsigned int blen1 = 0, blen2 = 0;
470 unsigned int len1, len2;
471 unsigned int decr;
472 void *p1, *p2;
473
474 live = audio_pcm_hw_get_live_in (hw);
475 dead = hw->samples - live;
476 if (!dead) {
477 return 0;
478 }
479
480 new_pos = FSOUND_Record_GetPosition ();
481 if (new_pos < 0) {
482 fmod_logerr ("Can not get recording position\n");
483 return 0;
484 }
485
486 len = audio_ring_dist (new_pos, hw->wpos, hw->samples);
487 if (!len) {
488 return 0;
489 }
490 len = audio_MIN (len, dead);
491
492 if (fmod_lock_sample (fmd->fmod_sample, &fmd->hw.info,
493 hw->wpos, len,
494 &p1, &p2,
495 &blen1, &blen2)) {
496 return 0;
497 }
498
499 len1 = blen1 >> hwshift;
500 len2 = blen2 >> hwshift;
501 decr = len1 + len2;
502
503 if (p1 && blen1) {
504 hw->conv (hw->conv_buf + hw->wpos, p1, len1, &nominal_volume);
505 }
506 if (p2 && len2) {
507 hw->conv (hw->conv_buf, p2, len2, &nominal_volume);
508 }
509
510 fmod_unlock_sample (fmd->fmod_sample, p1, p2, blen1, blen2);
511 hw->wpos = (hw->wpos + decr) % hw->samples;
512 return decr;
513}
514
85571bc7
FB
515static struct {
516 const char *name;
517 int type;
518} drvtab[] = {
519 {"none", FSOUND_OUTPUT_NOSOUND},
520#ifdef _WIN32
521 {"winmm", FSOUND_OUTPUT_WINMM},
522 {"dsound", FSOUND_OUTPUT_DSOUND},
523 {"a3d", FSOUND_OUTPUT_A3D},
524 {"asio", FSOUND_OUTPUT_ASIO},
525#endif
526#ifdef __linux__
527 {"oss", FSOUND_OUTPUT_OSS},
528 {"alsa", FSOUND_OUTPUT_ALSA},
529 {"esd", FSOUND_OUTPUT_ESD},
530#endif
531#ifdef __APPLE__
532 {"mac", FSOUND_OUTPUT_MAC},
533#endif
534#if 0
535 {"xbox", FSOUND_OUTPUT_XBOX},
536 {"ps2", FSOUND_OUTPUT_PS2},
537 {"gcube", FSOUND_OUTPUT_GC},
538#endif
1d14ffa9 539 {"none-realtime", FSOUND_OUTPUT_NOSOUND_NONREALTIME}
85571bc7
FB
540};
541
542static void *fmod_audio_init (void)
543{
1d14ffa9 544 size_t i;
85571bc7
FB
545 double ver;
546 int status;
547 int output_type = -1;
1d14ffa9 548 const char *drv = conf.drvname;
85571bc7
FB
549
550 ver = FSOUND_GetVersion ();
551 if (ver < FMOD_VERSION) {
552 dolog ("Wrong FMOD version %f, need at least %f\n", ver, FMOD_VERSION);
553 return NULL;
554 }
555
1d14ffa9
FB
556#ifdef __linux__
557 if (ver < 3.75) {
558 dolog ("FMOD before 3.75 has bug preventing ADC from working\n"
559 "ADC will be disabled.\n");
560 conf.broken_adc = 1;
561 }
562#endif
563
85571bc7
FB
564 if (drv) {
565 int found = 0;
566 for (i = 0; i < sizeof (drvtab) / sizeof (drvtab[0]); i++) {
567 if (!strcmp (drv, drvtab[i].name)) {
568 output_type = drvtab[i].type;
569 found = 1;
570 break;
571 }
572 }
573 if (!found) {
1d14ffa9
FB
574 dolog ("Unknown FMOD driver `%s'\n", drv);
575 dolog ("Valid drivers:\n");
576 for (i = 0; i < sizeof (drvtab) / sizeof (drvtab[0]); i++) {
577 dolog (" %s\n", drvtab[i].name);
578 }
85571bc7
FB
579 }
580 }
581
582 if (output_type != -1) {
583 status = FSOUND_SetOutput (output_type);
584 if (!status) {
1d14ffa9 585 fmod_logerr ("FSOUND_SetOutput(%d) failed\n", output_type);
85571bc7
FB
586 return NULL;
587 }
588 }
589
85571bc7
FB
590 if (conf.bufsize) {
591 status = FSOUND_SetBufferSize (conf.bufsize);
592 if (!status) {
1d14ffa9 593 fmod_logerr ("FSOUND_SetBufferSize (%d) failed\n", conf.bufsize);
85571bc7
FB
594 }
595 }
596
597 status = FSOUND_Init (conf.freq, conf.nb_channels, 0);
598 if (!status) {
1d14ffa9 599 fmod_logerr ("FSOUND_Init failed\n");
85571bc7
FB
600 return NULL;
601 }
602
603 return &conf;
604}
605
1d14ffa9
FB
606static int fmod_read (SWVoiceIn *sw, void *buf, int size)
607{
608 return audio_pcm_sw_read (sw, buf, size);
609}
610
611static int fmod_ctl_in (HWVoiceIn *hw, int cmd, ...)
612{
613 int status;
614 FMODVoiceIn *fmd = (FMODVoiceIn *) hw;
615
616 switch (cmd) {
617 case VOICE_ENABLE:
618 status = FSOUND_Record_StartSample (fmd->fmod_sample, 1);
619 if (!status) {
620 fmod_logerr ("Failed to start recording\n");
621 }
622 break;
623
624 case VOICE_DISABLE:
625 status = FSOUND_Record_Stop ();
626 if (!status) {
627 fmod_logerr ("Failed to stop recording\n");
628 }
629 break;
630 }
631 return 0;
632}
633
85571bc7
FB
634static void fmod_audio_fini (void *opaque)
635{
1d14ffa9 636 (void) opaque;
85571bc7
FB
637 FSOUND_Close ();
638}
639
1d14ffa9
FB
640static struct audio_option fmod_options[] = {
641 {"DRV", AUD_OPT_STR, &conf.drvname,
642 "FMOD driver", NULL, 0},
643 {"FREQ", AUD_OPT_INT, &conf.freq,
644 "Default frequency", NULL, 0},
645 {"SAMPLES", AUD_OPT_INT, &conf.nb_samples,
646 "Buffer size in samples", NULL, 0},
647 {"CHANNELS", AUD_OPT_INT, &conf.nb_channels,
648 "Number of default channels (1 - mono, 2 - stereo)", NULL, 0},
649 {"BUFSIZE", AUD_OPT_INT, &conf.bufsize,
650 "(undocumented)", NULL, 0},
651#if 0
652 {"THRESHOLD", AUD_OPT_INT, &conf.threshold,
653 "(undocumented)"},
654#endif
655
656 {NULL, 0, NULL, NULL, NULL, 0}
657};
658
659static struct audio_pcm_ops fmod_pcm_ops = {
660 fmod_init_out,
661 fmod_fini_out,
662 fmod_run_out,
663 fmod_write,
664 fmod_ctl_out,
665
666 fmod_init_in,
667 fmod_fini_in,
668 fmod_run_in,
669 fmod_read,
670 fmod_ctl_in
85571bc7
FB
671};
672
1d14ffa9
FB
673struct audio_driver fmod_audio_driver = {
674 INIT_FIELD (name = ) "fmod",
675 INIT_FIELD (descr = ) "FMOD 3.xx http://www.fmod.org",
676 INIT_FIELD (options = ) fmod_options,
677 INIT_FIELD (init = ) fmod_audio_init,
678 INIT_FIELD (fini = ) fmod_audio_fini,
679 INIT_FIELD (pcm_ops = ) &fmod_pcm_ops,
680 INIT_FIELD (can_be_default = ) 1,
681 INIT_FIELD (max_voices_out = ) INT_MAX,
682 INIT_FIELD (max_voices_in = ) INT_MAX,
683 INIT_FIELD (voice_size_out = ) sizeof (FMODVoiceOut),
684 INIT_FIELD (voice_size_in = ) sizeof (FMODVoiceIn)
85571bc7 685};