Commit Graph

169 Commits

Author SHA1 Message Date
Jindrich Makovicka 38cc9b607f issue snd_pcm_start() when capturing audio
snd_pcm_start() starts the capture process and ensures that the events
are delivered to the poll handler. Without the call, capture can be started
only when there is simultaneous playback running.

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-10-18 00:39:06 +04:00
Jindrich Makovicka 22d948a2d9 fix 100% CPU load when idle with ALSA
Playback control function did not disable polling when playback stops.
Caused busy spinning of the main loop due to unprocessed events.

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-10-18 00:39:02 +04:00
Stefan Weil 8b7968f7c4 Use GCC_FMT_ATTR (format checking)
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-03 06:34:51 +00:00
Stefan Weil e5924d8980 Replace most gcc format attributes by macro GCC_FMT_ATTR (format checking)
Since version 4.4.x, gcc supports additional format attributes.
    __attribute__ ((format (gnu_printf, 1, 2)))
should be used instead of
    __attribute__ ((format (printf, 1, 2))
because QEMU always uses standard format strings (even with mingw32).

The patch replaces format attribute printf / __printf__ by macro
GCC_FMT_ATTR which uses gnu_printf if supported.

It also removes an #ifdef __GNUC__ (not needed any longer).

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-03 06:34:36 +00:00
Wu Fengguang fd5723b385 pulse-audio: fix bug on updating rpos
Fix a rpos coordination bug between qpa_run_out() and qpa_thread_out(),
which shows up as playback noises.

	qpa_run_out()
			qpa_thread_out loop N critical section 1
	qpa_run_out()   qpa_thread_out loop N doing pa_simple_write()
	qpa_run_out()	qpa_thread_out loop N doing pa_simple_write()
			qpa_thread_out loop N critical section 2
			qpa_thread_out loop N+1 critical section 1
	qpa_run_out()	qpa_thread_out loop N+1 doing pa_simple_write()

In the above scheme, "qpa_thread_out loop N+1 critical section 1" will
get the same rpos as the one used by "qpa_thread_out loop N critical
section 1". So it will be reading dead samples from the old rpos.

The rpos can only be updated back to qpa_thread_out when there is a
qpa_run_out() run between two qpa_thread_out loops.

normal sequence:
	qpa_thread_out:
			hw->rpos (X0) => local rpos => pa->rpos (X1)
	qpa_run_out:
			pa->rpos (X1) => hw->rpos (X1)
	qpa_thread_out:
			hw->rpos (X1) => local rpos => pa->rpos (X2)

buggy sequence:
	qpa_thread_out:
			hw->rpos (X0) => local rpos => pa->rpos (X1)
	qpa_thread_out:
			hw->rpos (X0) => local rpos => pa->rpos (X1')

Obviously qpa_run_out() shall be called at least once between any two
qpa_thread_out loops (after pa->rpos is set), in order for the new
qpa_thread_out loop to see the updated rpos.

Setting pa->live to 0 does the trick. The next loop will have to wait
for one qpa_run_out() invocation in order to get a non-zero pa->live
and proceed.

Signed-off-by: malc <av1474@comtv.ru>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
2010-09-29 08:24:14 +04:00
malc 575c153f4f audio: Fix memory size for resampling buffer in DAC case
Signed-off-by: malc <av1474@comtv.ru>
2010-09-28 08:56:59 +04:00
Stefan Weil 9c9e7d51bf Move macros GCC_ATTR and GCC_FMT_ATTR to common header file
By moving the definition of GCC_ATTR and GCC_FMT_ATTR
from audio_int.h to qemu-common.h these macros are
now generally available for further patches which add
the gcc format attribute.

Newer gcc versions support format gnu_printf which is
better suited for use in QEMU than format printf
(QEMU always uses standard format strings (even with mingw32)).

V2: Use correct operator '==' (instead of '=')

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-22 20:15:11 +00:00
malc 60592edde4 audio/sdl: return on error
Signed-off-by: malc <av1474@comtv.ru>
2010-08-07 20:04:24 +04:00
malc d087bb3e38 audio/sdl: be more anal about errors
Signed-off-by: malc <av1474@comtv.ru>
2010-08-06 13:15:31 +04:00
malc 4b7c0418c0 audio: make audio_pt_init block all signals
Signed-off-by: malc <av1474@comtv.ru>
2010-08-06 13:15:22 +04:00
Alex Williamson 0be71e324f savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceState
when registering a savevm.  For buses with a get_dev_path()
function, this will allow us to create more unique savevm
id strings.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-06 10:36:28 -05:00
Blue Swirl 0bfcd599e3 Fix %lld or %llx printf format use
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-22 08:02:12 +00:00
Serge Ziryukin 6c557ab975 audio/sdlaudio: remove unused variable
Remove unused 'shift' variable spotted by clang.
Also clean up aud_to_sdlfmt which used to get the value
of shift.

Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-04-22 15:21:53 +04:00
malc 8bb414d2aa audio/alsa: Avoid snd_pcm_format_t vs audfmt_e mixup
Spotted by Serge Ziryukin and based on his patch, thanks.

Signed-off-by: malc <av1474@comtv.ru>
2010-04-21 15:40:23 +04:00
Markus Armbruster 8631b6084a monitor: Separate "default monitor" and "current monitor" cleanly
Commits 376253ec..731b0364 introduced global variable cur_mon, which
points to the "default monitor" (if any), except during execution of
monitor_read() or monitor_control_read() it points to the monitor from
which we're reading instead (the "current monitor").  Monitor command
handlers run within monitor_read() or monitor_control_read().

Default monitor and current monitor are really separate things, and
squashing them together is confusing and error-prone.

For instance, usb_host_scan() can run both in "info usbhost" and
periodically via usb_host_auto_check().  It prints to cur_mon, which
is what we want in the former case: the monitor executing "info
usbhost".  But since that's the default monitor in the latter case, it
periodically spams the default monitor there.

A few places use cur_mon to log stuff to the default monitor.  If we
ever log something while cur_mon points to current monitor instead of
default monitor, the log temporarily "jumps" to another monitor.
Whether that can or cannot happen isn't always obvious.

Maybe logging to the default monitor (which may not even exist) is a
bad idea, and we should log to stderr or a logfile instead.  But
that's outside the scope of this commit.

Change cur_mon to point to the current monitor.  Create new
default_mon to point to the default monitor.  Update users of cur_mon
accordingly.

This fixes the periodical spamming of the default monitor by
usb_host_scan().  It also stops "log jumping", should that problem
exist.
2010-03-16 16:55:05 +01:00
malc ad483a514e audio: fix comment
Signed-off-by: malc <av1474@comtv.ru>
2010-03-11 18:28:44 +03:00
malc d9812b033a audio/alsa: Handle SND_PCM_STATE_SETUP in alsa_poll_handler
Signed-off-by: malc <av1474@comtv.ru>
2010-02-28 18:34:21 +03:00
Vagrant Cascadian f093feb735 audio/alsa: Spelling typo (paramters)
Trivial patch to fix the spelling of "parameters".

Signed-off-by: malc <av1474@comtv.ru>
2010-02-28 18:20:25 +03:00
malc 82584e212d audio: include more information into audio_bug's output
Signed-off-by: malc <av1474@comtv.ru>
2010-01-17 02:03:30 +03:00
malc ff54149906 Revert "sdlaudio: make it suck less"
This reverts commit 4839abe78f.

The commit was badly broken, Gentoo has sdl as the default driver,
consequently 5 gentoo users have hit the breakage and were kind enough
to report, so thank you:

Claes Gyllenswrd
vekin
Chris

But above all thanks to Toralf Foerster who actually provied enough
information to pinpoint the breakage to sdlaudio.

http://bugs.gentoo.org/show_bug.cgi?id=294269
2010-01-17 00:25:29 +03:00
Juergen Lock 72ff25e4e9 Workaround for broken OSS_GETVERSION on FreeBSD, part two
Turns out on those versions of FreeBSD (>= 7.x) that know OSS_GETVERSION
the ioctl doesn't actually work yet (except in the Linuxolator), so if
building on FreeBSD assume the sound drivers are new enough if the ioctl
returns the errno it does currently on FreeBSD.

(Rev 2 after private discussion with malc.)

 Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>

Signed-off-by: malc <av1474@comtv.ru>
2010-01-13 01:59:03 +03:00
malc 3d709fe73a oss: fix fragment setting
Previous patch introduced subtle regression, in cases when
OSS_GETVERSION fails the code wasn't falling back to
SNDCTL_DSP_SETFRAGMENT.

Signed-off-by: malc <av1474@comtv.ru>
2010-01-09 18:07:36 +03:00
malc 6d246526ce oss: issue OSS_GETVERSION ioctl only when needed
Signed-off-by: malc <av1474@comtv.ru>
2010-01-09 17:55:18 +03:00
malc 78d9356d3c oss: refactor code around policy setting
This fixes a problem with a previous patch spotted by Juergen Lock,
thanks to him again.

Signed-off-by: malc <av1474@comtv.ru>
2010-01-09 00:28:59 +03:00
malc e726fe7d60 oss: workaround for cases when OSS_GETVERSION is not defined
Thanks to Juergen Lock.

Signed-off-by: malc <av1474@comtv.ru>
2010-01-08 11:26:31 +03:00
Juan Quintela d959fce9f0 audio: port to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03 09:41:25 -06:00
Juan Quintela a244eb7429 audio: fix compilation of DEBUG_PLIVE
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03 09:41:25 -06:00
malc 7cbb28ed5d audio: Remove conditional around sw which can not be NULL
Noticed by Steve Grubb.

Signed-off-by: malc <av1474@comtv.ru>
2009-11-18 19:22:53 +03:00
malc a58c16dc13 winwave: ADC support
Signed-off-by: malc <av1474@comtv.ru>
2009-10-15 10:43:45 +04:00
malc cb4f03e874 audio: remove last remnants of _t
Signed-off-by: malc <av1474@comtv.ru>
2009-10-15 02:40:17 +04:00
malc bc578fe007 winwave: make error logging more consistent
Signed-off-by: malc <av1474@comtv.ru>
2009-10-15 02:15:42 +04:00
malc 2a117d401d winwave: follow the rules when closing the output device
a. call waveOutReset to drain the queue
b. unprepare headers before freeing underlying memory

Signed-off-by: malc <av1474@comtv.ru>
2009-10-15 02:11:25 +04:00
Michael S. Tsirkin 1a4ea1e34d qemu: allow pulseaudio to be the default
We're seeing various issues with the SDL audio backend and want to
switch to the pulseaudio backend. See e.g.

  https://bugzilla.redhat.com/495964
  https://bugzilla.redhat.com/519540
  https://bugzilla.redhat.com/496627

The pulseaudio backend seems to work well, so we should allow it to be
selected as the default.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2009-10-13 18:14:50 +04:00
malc 6165a4260b winwave: pause/restore playing upon seeing VOICE_DISABLE/ENABLE
Signed-off-by: malc <av1474@comtv.ru>
2009-10-11 06:52:45 +04:00
malc 875ef647b0 winwave: close event handle and delete wait object after closing HWAVEOUT
To avoid possibly being called back and thus racing.

Signed-off-by: malc <av1474@comtv.ru>
2009-10-11 06:38:47 +04:00
malc f4e8d0b737 winwave: remove wait object when finalizing DAC voice
Signed-off-by: malc <av1474@comtv.ru>
2009-10-11 05:39:14 +04:00
malc e0bda367e5 winwave: poll mode
Signed-off-by: malc <av1474@comtv.ru>
2009-10-10 17:16:56 +04:00
malc d56316388d Windows Waveform Audio driver (no ADC support yet)
Signed-off-by: malc <av1474@comtv.ru>
2009-10-10 01:18:24 +04:00
malc a628b869be oss/alsa: Do not invoke UB described in 7.15.1.1 (this time for ADC)
Signed-off-by: malc <av1474@comtv.ru>
2009-10-03 03:30:18 +04:00
malc de2ca4fbb4 alsa: Change default buffer/period size
Increase buffer size but do not rely on ALSA picking up default period
size.

Signed-off-by: malc <av1474@comtv.ru>
2009-10-02 03:19:47 +04:00
malc 301901b56c oss/alsa: Do not invoke UB described in 7.15.1.1
Additional argument (whether to try poll mode) is only passed with
VOICE_ENABLE command.

Thanks to Markus Armbruster for noticing the potential breakage.
2009-10-02 02:37:40 +04:00
malc 4839abe78f sdlaudio: make it suck less
Signed-off-by: malc <av1474@comtv.ru>
2009-09-30 16:34:58 +04:00
malc 155a8ad308 audio: use correct email address
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18 14:04:36 +04:00
malc bdff253c8f audio: internal API change
pcm_ops.run_out now takes number of live samples (which will be always
greater than zero) as a second argument, every driver was calling
audio_pcm_hw_get_live_out anyway with exception of fmod which used
audio_pcm_hw_get_live_out2 for no good reason.

Signed-off-by: malc <av1474@comtv.ru>
2009-09-18 14:04:36 +04:00
malc 3fd7f635cd sdlaudio: use correct function names in sdl_XXX calls
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18 14:04:36 +04:00
malc 9d1689767b oss: use audio_pcm_hw_clip_out
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18 14:04:36 +04:00
malc 541ba4e709 alsa: use audio_pcm_hw_clip_out
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18 14:04:36 +04:00
malc ddabec73e6 audio: introduce audio_pcm_hw_clip_out helper function
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18 14:04:36 +04:00
malc 4f4cc0efde audio: use muldiv64 where it makes sense
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18 14:04:36 +04:00
malc 68f6dc7ebd coreaudio: fix sloppy "posixification" by 1ea879e558
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18 14:04:36 +04:00