Commit 1a7dafce1dfc3dc2052d0c5d8397e72121291c57
1 parent
b36aa85c
Remove any pretense that there can be more than one AudioState
Showing
16 changed files
with
80 additions
and
103 deletions
audio/audio.c
... | ... | @@ -707,11 +707,11 @@ static void noop_conv (struct st_sample *dst, const void *src, |
707 | 707 | } |
708 | 708 | |
709 | 709 | static CaptureVoiceOut *audio_pcm_capture_find_specific ( |
710 | - AudioState *s, | |
711 | 710 | struct audsettings *as |
712 | 711 | ) |
713 | 712 | { |
714 | 713 | CaptureVoiceOut *cap; |
714 | + AudioState *s = &glob_audio_state; | |
715 | 715 | |
716 | 716 | for (cap = s->cap_head.lh_first; cap; cap = cap->entries.le_next) { |
717 | 717 | if (audio_pcm_info_eq (&cap->hw.info, as)) { |
... | ... | @@ -786,8 +786,9 @@ static void audio_detach_capture (HWVoiceOut *hw) |
786 | 786 | } |
787 | 787 | } |
788 | 788 | |
789 | -static int audio_attach_capture (AudioState *s, HWVoiceOut *hw) | |
789 | +static int audio_attach_capture (HWVoiceOut *hw) | |
790 | 790 | { |
791 | + AudioState *s = &glob_audio_state; | |
791 | 792 | CaptureVoiceOut *cap; |
792 | 793 | |
793 | 794 | audio_detach_capture (hw); |
... | ... | @@ -1295,7 +1296,7 @@ static void audio_run_out (AudioState *s) |
1295 | 1296 | HWVoiceOut *hw = NULL; |
1296 | 1297 | SWVoiceOut *sw; |
1297 | 1298 | |
1298 | - while ((hw = audio_pcm_hw_find_any_enabled_out (s, hw))) { | |
1299 | + while ((hw = audio_pcm_hw_find_any_enabled_out (hw))) { | |
1299 | 1300 | int played; |
1300 | 1301 | int live, free, nb_live, cleanup_required, prev_rpos; |
1301 | 1302 | |
... | ... | @@ -1390,7 +1391,7 @@ static void audio_run_out (AudioState *s) |
1390 | 1391 | #ifdef DEBUG_PLIVE |
1391 | 1392 | dolog ("Finishing with old voice\n"); |
1392 | 1393 | #endif |
1393 | - audio_close_out (s, sw); | |
1394 | + audio_close_out (sw); | |
1394 | 1395 | } |
1395 | 1396 | sw = sw1; |
1396 | 1397 | } |
... | ... | @@ -1402,7 +1403,7 @@ static void audio_run_in (AudioState *s) |
1402 | 1403 | { |
1403 | 1404 | HWVoiceIn *hw = NULL; |
1404 | 1405 | |
1405 | - while ((hw = audio_pcm_hw_find_any_enabled_in (s, hw))) { | |
1406 | + while ((hw = audio_pcm_hw_find_any_enabled_in (hw))) { | |
1406 | 1407 | SWVoiceIn *sw; |
1407 | 1408 | int captured, min; |
1408 | 1409 | |
... | ... | @@ -1610,8 +1611,8 @@ static int audio_driver_init (AudioState *s, struct audio_driver *drv) |
1610 | 1611 | s->drv_opaque = drv->init (); |
1611 | 1612 | |
1612 | 1613 | if (s->drv_opaque) { |
1613 | - audio_init_nb_voices_out (s, drv); | |
1614 | - audio_init_nb_voices_in (s, drv); | |
1614 | + audio_init_nb_voices_out (drv); | |
1615 | + audio_init_nb_voices_in (drv); | |
1615 | 1616 | s->drv = drv; |
1616 | 1617 | return 0; |
1617 | 1618 | } |
... | ... | @@ -1630,11 +1631,11 @@ static void audio_vm_change_state_handler (void *opaque, int running, |
1630 | 1631 | int op = running ? VOICE_ENABLE : VOICE_DISABLE; |
1631 | 1632 | |
1632 | 1633 | s->vm_running = running; |
1633 | - while ((hwo = audio_pcm_hw_find_any_enabled_out (s, hwo))) { | |
1634 | + while ((hwo = audio_pcm_hw_find_any_enabled_out (hwo))) { | |
1634 | 1635 | hwo->pcm_ops->ctl_out (hwo, op); |
1635 | 1636 | } |
1636 | 1637 | |
1637 | - while ((hwi = audio_pcm_hw_find_any_enabled_in (s, hwi))) { | |
1638 | + while ((hwi = audio_pcm_hw_find_any_enabled_in (hwi))) { | |
1638 | 1639 | hwi->pcm_ops->ctl_in (hwi, op); |
1639 | 1640 | } |
1640 | 1641 | } |
... | ... | @@ -1645,7 +1646,7 @@ static void audio_atexit (void) |
1645 | 1646 | HWVoiceOut *hwo = NULL; |
1646 | 1647 | HWVoiceIn *hwi = NULL; |
1647 | 1648 | |
1648 | - while ((hwo = audio_pcm_hw_find_any_enabled_out (s, hwo))) { | |
1649 | + while ((hwo = audio_pcm_hw_find_any_enabled_out (hwo))) { | |
1649 | 1650 | SWVoiceCap *sc; |
1650 | 1651 | |
1651 | 1652 | hwo->pcm_ops->ctl_out (hwo, VOICE_DISABLE); |
... | ... | @@ -1661,7 +1662,7 @@ static void audio_atexit (void) |
1661 | 1662 | } |
1662 | 1663 | } |
1663 | 1664 | |
1664 | - while ((hwi = audio_pcm_hw_find_any_enabled_in (s, hwi))) { | |
1665 | + while ((hwi = audio_pcm_hw_find_any_enabled_in (hwi))) { | |
1665 | 1666 | hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE); |
1666 | 1667 | hwi->pcm_ops->fini_in (hwi); |
1667 | 1668 | } |
... | ... | @@ -1689,22 +1690,7 @@ static int audio_load (QEMUFile *f, void *opaque, int version_id) |
1689 | 1690 | return 0; |
1690 | 1691 | } |
1691 | 1692 | |
1692 | -void AUD_register_card (AudioState *s, const char *name, QEMUSoundCard *card) | |
1693 | -{ | |
1694 | - card->audio = s; | |
1695 | - card->name = qemu_strdup (name); | |
1696 | - memset (&card->entries, 0, sizeof (card->entries)); | |
1697 | - LIST_INSERT_HEAD (&s->card_head, card, entries); | |
1698 | -} | |
1699 | - | |
1700 | -void AUD_remove_card (QEMUSoundCard *card) | |
1701 | -{ | |
1702 | - LIST_REMOVE (card, entries); | |
1703 | - card->audio = NULL; | |
1704 | - qemu_free (card->name); | |
1705 | -} | |
1706 | - | |
1707 | -AudioState *AUD_init (void) | |
1693 | +static void audio_init (void) | |
1708 | 1694 | { |
1709 | 1695 | size_t i; |
1710 | 1696 | int done = 0; |
... | ... | @@ -1712,7 +1698,7 @@ AudioState *AUD_init (void) |
1712 | 1698 | AudioState *s = &glob_audio_state; |
1713 | 1699 | |
1714 | 1700 | if (s->drv) { |
1715 | - return s; | |
1701 | + return; | |
1716 | 1702 | } |
1717 | 1703 | |
1718 | 1704 | LIST_INIT (&s->hw_head_out); |
... | ... | @@ -1804,24 +1790,33 @@ AudioState *AUD_init (void) |
1804 | 1790 | LIST_INIT (&s->card_head); |
1805 | 1791 | register_savevm ("audio", 0, 1, audio_save, audio_load, s); |
1806 | 1792 | qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + conf.period.ticks); |
1807 | - return s; | |
1808 | 1793 | } |
1809 | 1794 | |
1795 | +void AUD_register_card (const char *name, QEMUSoundCard *card) | |
1796 | +{ | |
1797 | + audio_init (); | |
1798 | + card->name = qemu_strdup (name); | |
1799 | + memset (&card->entries, 0, sizeof (card->entries)); | |
1800 | + LIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries); | |
1801 | +} | |
1802 | + | |
1803 | +void AUD_remove_card (QEMUSoundCard *card) | |
1804 | +{ | |
1805 | + LIST_REMOVE (card, entries); | |
1806 | + qemu_free (card->name); | |
1807 | +} | |
1808 | + | |
1809 | + | |
1810 | 1810 | CaptureVoiceOut *AUD_add_capture ( |
1811 | - AudioState *s, | |
1812 | 1811 | struct audsettings *as, |
1813 | 1812 | struct audio_capture_ops *ops, |
1814 | 1813 | void *cb_opaque |
1815 | 1814 | ) |
1816 | 1815 | { |
1816 | + AudioState *s = &glob_audio_state; | |
1817 | 1817 | CaptureVoiceOut *cap; |
1818 | 1818 | struct capture_callback *cb; |
1819 | 1819 | |
1820 | - if (!s) { | |
1821 | - /* XXX suppress */ | |
1822 | - s = &glob_audio_state; | |
1823 | - } | |
1824 | - | |
1825 | 1820 | if (audio_validate_settings (as)) { |
1826 | 1821 | dolog ("Invalid settings were passed when trying to add capture\n"); |
1827 | 1822 | audio_print_settings (as); |
... | ... | @@ -1837,7 +1832,7 @@ CaptureVoiceOut *AUD_add_capture ( |
1837 | 1832 | cb->ops = *ops; |
1838 | 1833 | cb->opaque = cb_opaque; |
1839 | 1834 | |
1840 | - cap = audio_pcm_capture_find_specific (s, as); | |
1835 | + cap = audio_pcm_capture_find_specific (as); | |
1841 | 1836 | if (cap) { |
1842 | 1837 | LIST_INSERT_HEAD (&cap->cb_head, cb, entries); |
1843 | 1838 | return cap; |
... | ... | @@ -1887,8 +1882,8 @@ CaptureVoiceOut *AUD_add_capture ( |
1887 | 1882 | LIST_INSERT_HEAD (&cap->cb_head, cb, entries); |
1888 | 1883 | |
1889 | 1884 | hw = NULL; |
1890 | - while ((hw = audio_pcm_hw_find_any_out (s, hw))) { | |
1891 | - audio_attach_capture (s, hw); | |
1885 | + while ((hw = audio_pcm_hw_find_any_out (hw))) { | |
1886 | + audio_attach_capture (hw); | |
1892 | 1887 | } |
1893 | 1888 | return cap; |
1894 | 1889 | ... | ... |
audio/audio.h
... | ... | @@ -78,7 +78,6 @@ typedef struct CaptureVoiceOut CaptureVoiceOut; |
78 | 78 | typedef struct SWVoiceIn SWVoiceIn; |
79 | 79 | |
80 | 80 | typedef struct QEMUSoundCard { |
81 | - AudioState *audio; | |
82 | 81 | char *name; |
83 | 82 | LIST_ENTRY (QEMUSoundCard) entries; |
84 | 83 | } QEMUSoundCard; |
... | ... | @@ -94,12 +93,10 @@ void AUD_log (const char *cap, const char *fmt, ...) |
94 | 93 | #endif |
95 | 94 | ; |
96 | 95 | |
97 | -AudioState *AUD_init (void); | |
98 | 96 | void AUD_help (void); |
99 | -void AUD_register_card (AudioState *s, const char *name, QEMUSoundCard *card); | |
97 | +void AUD_register_card (const char *name, QEMUSoundCard *card); | |
100 | 98 | void AUD_remove_card (QEMUSoundCard *card); |
101 | 99 | CaptureVoiceOut *AUD_add_capture ( |
102 | - AudioState *s, | |
103 | 100 | struct audsettings *as, |
104 | 101 | struct audio_capture_ops *ops, |
105 | 102 | void *opaque | ... | ... |
audio/audio_int.h
... | ... | @@ -104,6 +104,7 @@ typedef struct HWVoiceIn { |
104 | 104 | } HWVoiceIn; |
105 | 105 | |
106 | 106 | struct SWVoiceOut { |
107 | + QEMUSoundCard *card; | |
107 | 108 | struct audio_pcm_info info; |
108 | 109 | t_sample *conv; |
109 | 110 | int64_t ratio; |
... | ... | @@ -120,6 +121,7 @@ struct SWVoiceOut { |
120 | 121 | }; |
121 | 122 | |
122 | 123 | struct SWVoiceIn { |
124 | + QEMUSoundCard *card; | |
123 | 125 | int active; |
124 | 126 | struct audio_pcm_info info; |
125 | 127 | int64_t ratio; | ... | ... |
audio/audio_template.h
... | ... | @@ -36,11 +36,9 @@ |
36 | 36 | #define HWBUF hw->conv_buf |
37 | 37 | #endif |
38 | 38 | |
39 | -static void glue (audio_init_nb_voices_, TYPE) ( | |
40 | - AudioState *s, | |
41 | - struct audio_driver *drv | |
42 | - ) | |
39 | +static void glue (audio_init_nb_voices_, TYPE) (struct audio_driver *drv) | |
43 | 40 | { |
41 | + AudioState *s = &glob_audio_state; | |
44 | 42 | int max_voices = glue (drv->max_voices_, TYPE); |
45 | 43 | int voice_size = glue (drv->voice_size_, TYPE); |
46 | 44 | |
... | ... | @@ -194,8 +192,9 @@ static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw) |
194 | 192 | LIST_REMOVE (sw, entries); |
195 | 193 | } |
196 | 194 | |
197 | -static void glue (audio_pcm_hw_gc_, TYPE) (AudioState *s, HW **hwp) | |
195 | +static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp) | |
198 | 196 | { |
197 | + AudioState *s = &glob_audio_state; | |
199 | 198 | HW *hw = *hwp; |
200 | 199 | |
201 | 200 | if (!hw->sw_head.lh_first) { |
... | ... | @@ -211,14 +210,15 @@ static void glue (audio_pcm_hw_gc_, TYPE) (AudioState *s, HW **hwp) |
211 | 210 | } |
212 | 211 | } |
213 | 212 | |
214 | -static HW *glue (audio_pcm_hw_find_any_, TYPE) (AudioState *s, HW *hw) | |
213 | +static HW *glue (audio_pcm_hw_find_any_, TYPE) (HW *hw) | |
215 | 214 | { |
216 | - return hw ? hw->entries.le_next : s->glue (hw_head_, TYPE).lh_first; | |
215 | + AudioState *s = &glob_audio_state; | |
216 | + return hw ? hw->entries.le_next : glue (s->hw_head_, TYPE).lh_first; | |
217 | 217 | } |
218 | 218 | |
219 | -static HW *glue (audio_pcm_hw_find_any_enabled_, TYPE) (AudioState *s, HW *hw) | |
219 | +static HW *glue (audio_pcm_hw_find_any_enabled_, TYPE) (HW *hw) | |
220 | 220 | { |
221 | - while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (s, hw))) { | |
221 | + while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (hw))) { | |
222 | 222 | if (hw->enabled) { |
223 | 223 | return hw; |
224 | 224 | } |
... | ... | @@ -227,12 +227,11 @@ static HW *glue (audio_pcm_hw_find_any_enabled_, TYPE) (AudioState *s, HW *hw) |
227 | 227 | } |
228 | 228 | |
229 | 229 | static HW *glue (audio_pcm_hw_find_specific_, TYPE) ( |
230 | - AudioState *s, | |
231 | 230 | HW *hw, |
232 | 231 | struct audsettings *as |
233 | 232 | ) |
234 | 233 | { |
235 | - while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (s, hw))) { | |
234 | + while ((hw = glue (audio_pcm_hw_find_any_, TYPE) (hw))) { | |
236 | 235 | if (audio_pcm_info_eq (&hw->info, as)) { |
237 | 236 | return hw; |
238 | 237 | } |
... | ... | @@ -240,10 +239,10 @@ static HW *glue (audio_pcm_hw_find_specific_, TYPE) ( |
240 | 239 | return NULL; |
241 | 240 | } |
242 | 241 | |
243 | -static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s, | |
244 | - struct audsettings *as) | |
242 | +static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as) | |
245 | 243 | { |
246 | 244 | HW *hw; |
245 | + AudioState *s = &glob_audio_state; | |
247 | 246 | struct audio_driver *drv = s->drv; |
248 | 247 | |
249 | 248 | if (!glue (s->nb_hw_voices_, TYPE)) { |
... | ... | @@ -298,7 +297,7 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s, |
298 | 297 | LIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries); |
299 | 298 | glue (s->nb_hw_voices_, TYPE) -= 1; |
300 | 299 | #ifdef DAC |
301 | - audio_attach_capture (s, hw); | |
300 | + audio_attach_capture (hw); | |
302 | 301 | #endif |
303 | 302 | return hw; |
304 | 303 | |
... | ... | @@ -309,33 +308,31 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (AudioState *s, |
309 | 308 | return NULL; |
310 | 309 | } |
311 | 310 | |
312 | -static HW *glue (audio_pcm_hw_add_, TYPE) (AudioState *s, | |
313 | - struct audsettings *as) | |
311 | +static HW *glue (audio_pcm_hw_add_, TYPE) (struct audsettings *as) | |
314 | 312 | { |
315 | 313 | HW *hw; |
316 | 314 | |
317 | 315 | if (glue (conf.fixed_, TYPE).enabled && glue (conf.fixed_, TYPE).greedy) { |
318 | - hw = glue (audio_pcm_hw_add_new_, TYPE) (s, as); | |
316 | + hw = glue (audio_pcm_hw_add_new_, TYPE) (as); | |
319 | 317 | if (hw) { |
320 | 318 | return hw; |
321 | 319 | } |
322 | 320 | } |
323 | 321 | |
324 | - hw = glue (audio_pcm_hw_find_specific_, TYPE) (s, NULL, as); | |
322 | + hw = glue (audio_pcm_hw_find_specific_, TYPE) (NULL, as); | |
325 | 323 | if (hw) { |
326 | 324 | return hw; |
327 | 325 | } |
328 | 326 | |
329 | - hw = glue (audio_pcm_hw_add_new_, TYPE) (s, as); | |
327 | + hw = glue (audio_pcm_hw_add_new_, TYPE) (as); | |
330 | 328 | if (hw) { |
331 | 329 | return hw; |
332 | 330 | } |
333 | 331 | |
334 | - return glue (audio_pcm_hw_find_any_, TYPE) (s, NULL); | |
332 | + return glue (audio_pcm_hw_find_any_, TYPE) (NULL); | |
335 | 333 | } |
336 | 334 | |
337 | 335 | static SW *glue (audio_pcm_create_voice_pair_, TYPE) ( |
338 | - AudioState *s, | |
339 | 336 | const char *sw_name, |
340 | 337 | struct audsettings *as |
341 | 338 | ) |
... | ... | @@ -358,7 +355,7 @@ static SW *glue (audio_pcm_create_voice_pair_, TYPE) ( |
358 | 355 | goto err1; |
359 | 356 | } |
360 | 357 | |
361 | - hw = glue (audio_pcm_hw_add_, TYPE) (s, &hw_as); | |
358 | + hw = glue (audio_pcm_hw_add_, TYPE) (&hw_as); | |
362 | 359 | if (!hw) { |
363 | 360 | goto err2; |
364 | 361 | } |
... | ... | @@ -373,31 +370,30 @@ static SW *glue (audio_pcm_create_voice_pair_, TYPE) ( |
373 | 370 | |
374 | 371 | err3: |
375 | 372 | glue (audio_pcm_hw_del_sw_, TYPE) (sw); |
376 | - glue (audio_pcm_hw_gc_, TYPE) (s, &hw); | |
373 | + glue (audio_pcm_hw_gc_, TYPE) (&hw); | |
377 | 374 | err2: |
378 | 375 | qemu_free (sw); |
379 | 376 | err1: |
380 | 377 | return NULL; |
381 | 378 | } |
382 | 379 | |
383 | -static void glue (audio_close_, TYPE) (AudioState *s, SW *sw) | |
380 | +static void glue (audio_close_, TYPE) (SW *sw) | |
384 | 381 | { |
385 | 382 | glue (audio_pcm_sw_fini_, TYPE) (sw); |
386 | 383 | glue (audio_pcm_hw_del_sw_, TYPE) (sw); |
387 | - glue (audio_pcm_hw_gc_, TYPE) (s, &sw->hw); | |
384 | + glue (audio_pcm_hw_gc_, TYPE) (&sw->hw); | |
388 | 385 | qemu_free (sw); |
389 | 386 | } |
390 | 387 | |
391 | 388 | void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw) |
392 | 389 | { |
393 | 390 | if (sw) { |
394 | - if (audio_bug (AUDIO_FUNC, !card || !card->audio)) { | |
395 | - dolog ("card=%p card->audio=%p\n", | |
396 | - card, card ? card->audio : NULL); | |
391 | + if (audio_bug (AUDIO_FUNC, !card)) { | |
392 | + dolog ("card=%p\n", card); | |
397 | 393 | return; |
398 | 394 | } |
399 | 395 | |
400 | - glue (audio_close_, TYPE) (card->audio, sw); | |
396 | + glue (audio_close_, TYPE) (sw); | |
401 | 397 | } |
402 | 398 | } |
403 | 399 | |
... | ... | @@ -410,7 +406,7 @@ SW *glue (AUD_open_, TYPE) ( |
410 | 406 | struct audsettings *as |
411 | 407 | ) |
412 | 408 | { |
413 | - AudioState *s; | |
409 | + AudioState *s = &glob_audio_state; | |
414 | 410 | #ifdef DAC |
415 | 411 | int live = 0; |
416 | 412 | SW *old_sw = NULL; |
... | ... | @@ -419,15 +415,12 @@ SW *glue (AUD_open_, TYPE) ( |
419 | 415 | ldebug ("open %s, freq %d, nchannels %d, fmt %d\n", |
420 | 416 | name, as->freq, as->nchannels, as->fmt); |
421 | 417 | |
422 | - if (audio_bug (AUDIO_FUNC, | |
423 | - !card || !card->audio || !name || !callback_fn || !as)) { | |
424 | - dolog ("card=%p card->audio=%p name=%p callback_fn=%p as=%p\n", | |
425 | - card, card ? card->audio : NULL, name, callback_fn, as); | |
418 | + if (audio_bug (AUDIO_FUNC, !card || !name || !callback_fn || !as)) { | |
419 | + dolog ("card=%p name=%p callback_fn=%p as=%p\n", | |
420 | + card, name, callback_fn, as); | |
426 | 421 | goto fail; |
427 | 422 | } |
428 | 423 | |
429 | - s = card->audio; | |
430 | - | |
431 | 424 | if (audio_bug (AUDIO_FUNC, audio_validate_settings (as))) { |
432 | 425 | audio_print_settings (as); |
433 | 426 | goto fail; |
... | ... | @@ -485,7 +478,7 @@ SW *glue (AUD_open_, TYPE) ( |
485 | 478 | } |
486 | 479 | } |
487 | 480 | else { |
488 | - sw = glue (audio_pcm_create_voice_pair_, TYPE) (s, name, as); | |
481 | + sw = glue (audio_pcm_create_voice_pair_, TYPE) (name, as); | |
489 | 482 | if (!sw) { |
490 | 483 | dolog ("Failed to create voice `%s'\n", name); |
491 | 484 | return NULL; |
... | ... | @@ -493,6 +486,7 @@ SW *glue (AUD_open_, TYPE) ( |
493 | 486 | } |
494 | 487 | |
495 | 488 | if (sw) { |
489 | + sw->card = card; | |
496 | 490 | sw->vol = nominal_volume; |
497 | 491 | sw->callback.fn = callback_fn; |
498 | 492 | sw->callback.opaque = callback_opaque; | ... | ... |
audio/wavcapture.c
... | ... | @@ -145,7 +145,7 @@ int wav_start_capture (CaptureState *s, const char *path, int freq, |
145 | 145 | |
146 | 146 | qemu_put_buffer (wav->f, hdr, sizeof (hdr)); |
147 | 147 | |
148 | - cap = AUD_add_capture (NULL, &as, &ops, wav); | |
148 | + cap = AUD_add_capture (&as, &ops, wav); | |
149 | 149 | if (!cap) { |
150 | 150 | monitor_printf(mon, "Failed to add audio capture\n"); |
151 | 151 | qemu_free (wav->path); | ... | ... |
hw/ac97.c
... | ... | @@ -1310,7 +1310,6 @@ static void ac97_on_reset (void *opaque) |
1310 | 1310 | |
1311 | 1311 | int ac97_init (PCIBus *bus) |
1312 | 1312 | { |
1313 | - AudioState *audio = AUD_init(); | |
1314 | 1313 | PCIAC97LinkState *d; |
1315 | 1314 | AC97LinkState *s; |
1316 | 1315 | uint8_t *c; |
... | ... | @@ -1371,7 +1370,7 @@ int ac97_init (PCIBus *bus) |
1371 | 1370 | pci_register_io_region (&d->dev, 1, 64 * 4, PCI_ADDRESS_SPACE_IO, ac97_map); |
1372 | 1371 | register_savevm ("ac97", 0, 2, ac97_save, ac97_load, s); |
1373 | 1372 | qemu_register_reset (ac97_on_reset, s); |
1374 | - AUD_register_card (audio, "ac97", &s->card); | |
1373 | + AUD_register_card ("ac97", &s->card); | |
1375 | 1374 | ac97_on_reset (s); |
1376 | 1375 | return 0; |
1377 | 1376 | } | ... | ... |
hw/adlib.c
... | ... | @@ -278,7 +278,6 @@ static void Adlib_fini (AdlibState *s) |
278 | 278 | |
279 | 279 | int Adlib_init (qemu_irq *pic) |
280 | 280 | { |
281 | - AudioState *audio = AUD_init(); | |
282 | 281 | AdlibState *s = &glob_adlib; |
283 | 282 | struct audsettings as; |
284 | 283 | |
... | ... | @@ -308,7 +307,7 @@ int Adlib_init (qemu_irq *pic) |
308 | 307 | as.fmt = AUD_FMT_S16; |
309 | 308 | as.endianness = AUDIO_HOST_ENDIANNESS; |
310 | 309 | |
311 | - AUD_register_card (audio, "adlib", &s->card); | |
310 | + AUD_register_card ("adlib", &s->card); | |
312 | 311 | |
313 | 312 | s->voice = AUD_open_out ( |
314 | 313 | &s->card, | ... | ... |
hw/cs4231a.c
... | ... | @@ -638,7 +638,6 @@ static int cs_load(QEMUFile *f, void *opaque, int version_id) |
638 | 638 | |
639 | 639 | int cs4231a_init (qemu_irq *pic) |
640 | 640 | { |
641 | - AudioState *audio = AUD_init(); | |
642 | 641 | int i; |
643 | 642 | CSState *s; |
644 | 643 | |
... | ... | @@ -660,6 +659,6 @@ int cs4231a_init (qemu_irq *pic) |
660 | 659 | qemu_register_reset (cs_reset, s); |
661 | 660 | cs_reset (s); |
662 | 661 | |
663 | - AUD_register_card (audio,"cs4231a", &s->card); | |
662 | + AUD_register_card ("cs4231a", &s->card); | |
664 | 663 | return 0; |
665 | 664 | } | ... | ... |
hw/es1370.c
... | ... | @@ -1007,7 +1007,6 @@ static void es1370_on_reset (void *opaque) |
1007 | 1007 | |
1008 | 1008 | int es1370_init (PCIBus *bus) |
1009 | 1009 | { |
1010 | - AudioState *audio = AUD_init(); | |
1011 | 1010 | PCIES1370State *d; |
1012 | 1011 | ES1370State *s; |
1013 | 1012 | uint8_t *c; |
... | ... | @@ -1058,7 +1057,7 @@ int es1370_init (PCIBus *bus) |
1058 | 1057 | register_savevm ("es1370", 0, 2, es1370_save, es1370_load, s); |
1059 | 1058 | qemu_register_reset (es1370_on_reset, s); |
1060 | 1059 | |
1061 | - AUD_register_card (audio, "es1370", &s->card); | |
1060 | + AUD_register_card ("es1370", &s->card); | |
1062 | 1061 | es1370_reset (s); |
1063 | 1062 | return 0; |
1064 | 1063 | } | ... | ... |
hw/gus.c
... | ... | @@ -252,13 +252,12 @@ static int GUS_load (QEMUFile *f, void *opaque, int version_id) |
252 | 252 | |
253 | 253 | int GUS_init (qemu_irq *pic) |
254 | 254 | { |
255 | - AudioState *audio = AUD_init(); | |
256 | 255 | GUSState *s; |
257 | 256 | struct audsettings as; |
258 | 257 | |
259 | 258 | s = qemu_mallocz (sizeof (*s)); |
260 | 259 | |
261 | - AUD_register_card (audio, "gus", &s->card); | |
260 | + AUD_register_card ("gus", &s->card); | |
262 | 261 | |
263 | 262 | as.freq = conf.freq; |
264 | 263 | as.nchannels = 2; | ... | ... |
hw/omap2.c
... | ... | @@ -1973,7 +1973,7 @@ struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta, |
1973 | 1973 | omap_eac_reset(s); |
1974 | 1974 | |
1975 | 1975 | #ifdef HAS_AUDIO |
1976 | - AUD_register_card(AUD_init(), "OMAP EAC", &s->codec.card); | |
1976 | + AUD_register_card("OMAP EAC", &s->codec.card); | |
1977 | 1977 | |
1978 | 1978 | iomemtype = cpu_register_io_memory(0, omap_eac_readfn, |
1979 | 1979 | omap_eac_writefn, s); | ... | ... |
hw/pcspk.c
... | ... | @@ -98,11 +98,10 @@ static void pcspk_callback(void *opaque, int free) |
98 | 98 | |
99 | 99 | int pcspk_audio_init(qemu_irq *pic) |
100 | 100 | { |
101 | - AudioState *audio = AUD_init(); | |
102 | 101 | PCSpkState *s = &pcspk_state; |
103 | 102 | struct audsettings as = {PCSPK_SAMPLE_RATE, 1, AUD_FMT_U8, 0}; |
104 | 103 | |
105 | - AUD_register_card(audio, s_spk, &s->card); | |
104 | + AUD_register_card(s_spk, &s->card); | |
106 | 105 | |
107 | 106 | s->voice = AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback, &as); |
108 | 107 | if (!s->voice) { | ... | ... |
hw/sb16.c
... | ... | @@ -1400,7 +1400,6 @@ static int SB_load (QEMUFile *f, void *opaque, int version_id) |
1400 | 1400 | |
1401 | 1401 | int SB16_init (qemu_irq *pic) |
1402 | 1402 | { |
1403 | - AudioState *audio = AUD_init(); | |
1404 | 1403 | SB16State *s; |
1405 | 1404 | int i; |
1406 | 1405 | static const uint8_t dsp_write_ports[] = {0x6, 0xc}; |
... | ... | @@ -1447,6 +1446,6 @@ int SB16_init (qemu_irq *pic) |
1447 | 1446 | s->can_write = 1; |
1448 | 1447 | |
1449 | 1448 | register_savevm ("sb16", 0, 1, SB_save, SB_load, s); |
1450 | - AUD_register_card (audio, "sb16", &s->card); | |
1449 | + AUD_register_card ("sb16", &s->card); | |
1451 | 1450 | return 0; |
1452 | 1451 | } | ... | ... |
hw/tsc210x.c
... | ... | @@ -82,7 +82,6 @@ typedef struct { |
82 | 82 | SWVoiceOut *dac_voice[1]; |
83 | 83 | int i2s_rx_rate; |
84 | 84 | int i2s_tx_rate; |
85 | - AudioState *audio; | |
86 | 85 | |
87 | 86 | int tr[8]; |
88 | 87 | |
... | ... | @@ -1117,7 +1116,6 @@ uWireSlave *tsc2102_init(qemu_irq pint) |
1117 | 1116 | s->pint = pint; |
1118 | 1117 | s->model = 0x2102; |
1119 | 1118 | s->name = "tsc2102"; |
1120 | - s->audio = AUD_init();; | |
1121 | 1119 | |
1122 | 1120 | s->tr[0] = 0; |
1123 | 1121 | s->tr[1] = 1; |
... | ... | @@ -1143,7 +1141,7 @@ uWireSlave *tsc2102_init(qemu_irq pint) |
1143 | 1141 | qemu_add_mouse_event_handler(tsc210x_touchscreen_event, s, 1, |
1144 | 1142 | "QEMU TSC2102-driven Touchscreen"); |
1145 | 1143 | |
1146 | - AUD_register_card(s->audio, s->name, &s->card); | |
1144 | + AUD_register_card(s->name, &s->card); | |
1147 | 1145 | |
1148 | 1146 | qemu_register_reset((void *) tsc210x_reset, s); |
1149 | 1147 | register_savevm(s->name, -1, 0, |
... | ... | @@ -1169,7 +1167,6 @@ uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav) |
1169 | 1167 | s->davint = dav; |
1170 | 1168 | s->model = 0x2301; |
1171 | 1169 | s->name = "tsc2301"; |
1172 | - s->audio = AUD_init(); | |
1173 | 1170 | |
1174 | 1171 | s->tr[0] = 0; |
1175 | 1172 | s->tr[1] = 1; |
... | ... | @@ -1195,7 +1192,7 @@ uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav) |
1195 | 1192 | qemu_add_mouse_event_handler(tsc210x_touchscreen_event, s, 1, |
1196 | 1193 | "QEMU TSC2301-driven Touchscreen"); |
1197 | 1194 | |
1198 | - AUD_register_card(s->audio, s->name, &s->card); | |
1195 | + AUD_register_card(s->name, &s->card); | |
1199 | 1196 | |
1200 | 1197 | qemu_register_reset((void *) tsc210x_reset, s); |
1201 | 1198 | register_savevm(s->name, -1, 0, tsc210x_save, tsc210x_load, s); | ... | ... |
hw/wm8750.c
... | ... | @@ -647,14 +647,13 @@ static int wm8750_load(QEMUFile *f, void *opaque, int version_id) |
647 | 647 | |
648 | 648 | i2c_slave *wm8750_init(i2c_bus *bus) |
649 | 649 | { |
650 | - AudioState *audio = AUD_init(); | |
651 | 650 | WM8750State *s = (WM8750State *) |
652 | 651 | i2c_slave_init(bus, 0, sizeof(WM8750State)); |
653 | 652 | s->i2c.event = wm8750_event; |
654 | 653 | s->i2c.recv = wm8750_rx; |
655 | 654 | s->i2c.send = wm8750_tx; |
656 | 655 | |
657 | - AUD_register_card(audio, CODEC, &s->card); | |
656 | + AUD_register_card(CODEC, &s->card); | |
658 | 657 | wm8750_reset(&s->i2c); |
659 | 658 | |
660 | 659 | register_savevm(CODEC, -1, 0, wm8750_save, wm8750_load, s); | ... | ... |
vnc.c
... | ... | @@ -855,7 +855,7 @@ static void audio_add(VncState *vs) |
855 | 855 | ops.destroy = audio_capture_destroy; |
856 | 856 | ops.capture = audio_capture; |
857 | 857 | |
858 | - vs->audio_cap = AUD_add_capture(NULL, &vs->as, &ops, vs); | |
858 | + vs->audio_cap = AUD_add_capture(&vs->as, &ops, vs); | |
859 | 859 | if (!vs->audio_cap) { |
860 | 860 | monitor_printf(mon, "Failed to add audio capture\n"); |
861 | 861 | } | ... | ... |