Revision 0d9acba8 audio/audio.c
b/audio/audio.c | ||
---|---|---|
1711 | 1711 |
const char *drvname; |
1712 | 1712 |
AudioState *s = &glob_audio_state; |
1713 | 1713 |
|
1714 |
if (s->drv) { |
|
1715 |
return s; |
|
1716 |
} |
|
1717 |
|
|
1714 | 1718 |
LIST_INIT (&s->hw_head_out); |
1715 | 1719 |
LIST_INIT (&s->hw_head_in); |
1716 | 1720 |
LIST_INIT (&s->cap_head); |
... | ... | |
1718 | 1722 |
|
1719 | 1723 |
s->ts = qemu_new_timer (vm_clock, audio_timer, s); |
1720 | 1724 |
if (!s->ts) { |
1721 |
dolog ("Could not create audio timer\n"); |
|
1722 |
return NULL; |
|
1725 |
hw_error("Could not create audio timer\n"); |
|
1723 | 1726 |
} |
1724 | 1727 |
|
1725 | 1728 |
audio_process_options ("AUDIO", audio_options); |
... | ... | |
1772 | 1775 |
if (!done) { |
1773 | 1776 |
done = !audio_driver_init (s, &no_audio_driver); |
1774 | 1777 |
if (!done) { |
1775 |
dolog ("Could not initialize audio subsystem\n");
|
|
1778 |
hw_error("Could not initialize audio subsystem\n");
|
|
1776 | 1779 |
} |
1777 | 1780 |
else { |
1778 | 1781 |
dolog ("warning: Using timer based audio emulation\n"); |
1779 | 1782 |
} |
1780 | 1783 |
} |
1781 | 1784 |
|
1782 |
if (done) { |
|
1783 |
VMChangeStateEntry *e; |
|
1784 |
|
|
1785 |
if (conf.period.hertz <= 0) { |
|
1786 |
if (conf.period.hertz < 0) { |
|
1787 |
dolog ("warning: Timer period is negative - %d " |
|
1788 |
"treating as zero\n", |
|
1789 |
conf.period.hertz); |
|
1790 |
} |
|
1791 |
conf.period.ticks = 1; |
|
1792 |
} |
|
1793 |
else { |
|
1794 |
conf.period.ticks = ticks_per_sec / conf.period.hertz; |
|
1795 |
} |
|
1785 |
VMChangeStateEntry *e; |
|
1796 | 1786 |
|
1797 |
e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); |
|
1798 |
if (!e) { |
|
1799 |
dolog ("warning: Could not register change state handler\n" |
|
1800 |
"(Audio can continue looping even after stopping the VM)\n"); |
|
1787 |
if (conf.period.hertz <= 0) { |
|
1788 |
if (conf.period.hertz < 0) { |
|
1789 |
dolog ("warning: Timer period is negative - %d " |
|
1790 |
"treating as zero\n", |
|
1791 |
conf.period.hertz); |
|
1801 | 1792 |
} |
1793 |
conf.period.ticks = 1; |
|
1794 |
} else { |
|
1795 |
conf.period.ticks = ticks_per_sec / conf.period.hertz; |
|
1802 | 1796 |
} |
1803 |
else { |
|
1804 |
qemu_del_timer (s->ts); |
|
1805 |
return NULL; |
|
1797 |
|
|
1798 |
e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); |
|
1799 |
if (!e) { |
|
1800 |
dolog ("warning: Could not register change state handler\n" |
|
1801 |
"(Audio can continue looping even after stopping the VM)\n"); |
|
1806 | 1802 |
} |
1807 | 1803 |
|
1808 | 1804 |
LIST_INIT (&s->card_head); |
Also available in: Unified diff