Commit Graph

239 Commits

Author SHA1 Message Date
Anthony Liguori 7267c0947d Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20 23:01:08 -05:00
Andreas Färber 744d364418 coreaudio: Fix OSStatus format specifier
OSStatus type is defined as SInt32. That's signed int on __LP64__ and
signed long otherwise.
Since it is an explicit 32-bit-width type, cast to corresponsing POSIX type
and use PRId32 format specifier. This avoids a warning on ppc64.

Cc: malc <av1474@comtv.ru>
Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
Signed-off-by: malc <av1474@comtv.ru>
2011-06-23 18:56:58 +04:00
Andreas Färber cbc36cb05d coreaudio: Avoid formatting UInt32 type
coreaudioVoiceOut's audioDevicePropertyBufferFrameSize is defined as UInt32
and is being used by reference for AudioDevice{Get,Set}Property().
UInt32 is unsigned int on __LP64__ but unsigned long otherwise.

Cast to POSIX type and use PRIu32 format specifier to hide the details.
This avoids a warning on ppc64.

Cc: malc <av1474@comtv.ru>
Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
Signed-off-by: malc <av1474@comtv.ru>
2011-06-23 18:56:50 +04:00
Alexandre Raymond d9cbb0f3ed Fix compilation warning due to incorrectly specified type
In audio/coreaudio.c, a variable named "str" was assigned "const char" values,
which resulted in the following warnings:

-----8<-----
audio/coreaudio.c: In function ‘coreaudio_logstatus’:
audio/coreaudio.c:59: warning: initialization discards qualifiers from pointer target type
audio/coreaudio.c:63: warning: assignment discards qualifiers from pointer target type
(...)
-----8<-----

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Acked-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
2011-06-14 03:08:56 +02:00
Alexandre Raymond 9bf0960a9a Fix compilation warning due to missing header for sigaction (followup)
This patch removes all references to signal.h when qemu-common.h is included
as they become redundant.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-08 09:04:29 +01:00
Juha Riihim?ki 578c7b2ca8 audio: fix integer overflow expression
Fix an integer overflow that can happen for signed 32 bit types
when using FLOAT_MIXENG. (Note that at the moment this is only true
when using the MacOSX coreaudio audio driver.)

Signed-off-by: Juha Riihim?ki <juha.riihimaki@nokia.com>
[Peter Maydell: Removed unnecessary casts]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: malc <av1474@comtv.ru>
2011-06-01 00:14:07 +04:00
Stefan Weil 4ff9786c67 Fix trivial "endianness bugs"
Replace endianess -> endianness.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-03 21:42:57 +02:00
Paolo Bonzini 7447545544 change all other clock references to use nanosecond resolution accessors
This was done with:

    sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \
        $(git grep -l 'qemu_get_clock\>' )
    sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \
        $(git grep -l 'qemu_new_timer\>' )

after checking that get_clock and new_timer never occur twice
on the same line.  There were no missed occurrences; however, even
if there had been, they would have been caught by the compiler.

There was exactly one false positive in qemu_run_timers:

     -    current_time = qemu_get_clock (clock);
     +    current_time = qemu_get_clock_ns (clock);

which is of course not in this patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21 09:23:23 +01:00
Gerd Hoffmann bf1064b587 pulseaudio: tweak config
Zap unused divisor field.
Raise the buffer size default.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2011-01-25 19:56:53 +03:00
Gerd Hoffmann e6d16fa439 pulseaudio: setup buffer attrs
Request reasonable buffer sizes from pulseaudio.  Without this
pa_simple_write() can block quite long and lead to dropouts,
especially with guests which use small audio ring buffers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2011-01-25 19:56:47 +03:00
Gerd Hoffmann 6315633b25 pulseaudio: process 1/4 buffer max at once
Limit the size of data pieces processed by the pulseaudio worker
threads.  Never ever process more than 1/4 of the buffer at once.

Background: The buffer area currently processed by the pulseaudio thread
is blocked, i.e. the main thread (or iothread) can't fill in more data
there.  The buffer processing time is roughly real-time due to the
pa_simple_write() call blocking when the output queue to the pulse
server is full.  Thus processing big chunks at once means blocking
a large part of the buffer for a long time.  This brings high latency
and can lead to dropouts.

When processing the buffer in smaller chunks the rpos handling becomes a
problem though.  The thread reads hw->rpos without knowing whenever
qpa_run_out has already seen the last (small) chunk processed and
updated rpos accordingly.  There is no point in reading hw->rpos though,
pa->rpos can be used instead.  We just need to take care to initialize
pa->rpos before kicking the thread.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2011-01-25 19:56:35 +03:00
Michael Walle 00e076795f audio: split sample conversion and volume mixing
Refactor the volume mixing, so it can be reused for capturing devices.
Additionally, it removes superfluous multiplications with the nominal
volume within the hardware voice code path.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: malc <av1474@comtv.ru>
2011-01-12 18:36:22 +03:00
Michael Walle d66bddd7a4 alsaaudio: add endianness support for VoiceIn
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: malc <av1474@comtv.ru>
2011-01-09 03:06:08 +03:00
Michael Walle b6c9c9401c ossaudio: add endianness support for VoiceIn
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: malc <av1474@comtv.ru>
2011-01-09 03:05:24 +03:00
Michael Walle 8a7d0890ac noaudio: correctly account acquired samples
This will fix the return value of the function which otherwise returns too
many samples because sw->total_hw_samples_acquired isn't correctly
accounted.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: malc <av1474@comtv.ru>
2011-01-04 03:53:47 +03:00
Michael Walle 85882c71a9 noaudio: fix return value for read()
Read should return bytes instead of samples.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: malc <av1474@comtv.ru>
2010-12-10 05:25:35 +03:00
Stefan Weil ab9de3692e audio: Use GCC_FMT_ATTR (format checking)
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-04 20:51:18 +00:00
malc 39deb1e496 audio: Only use audio timer when necessary
Originally proposed by Gerd Hoffmann.

Signed-off-by: malc <av1474@comtv.ru>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-18 14:30:31 +03:00
Gerd Hoffmann cf2c1839a9 add copyright to spiceaudio
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-11 17:59:25 +03:00
Gerd Hoffmann 3e31375378 spice: add audio
Add support for the spice audio interface.  With this patch applied
audio can be forwarded over the network from/to the spice client.  Both
recording and playback is supported.

The driver is first in the driver list, but the can_be_default flag is
set only in case spice is active.  So if you have the spice protocol
enabled the spice audio driver is the default one, otherwise whatever
comes first after spice in the list.  Overriding the default using
QEMU_AUDIO_DRV works in any case.

[ v2: audio codestyle: add spaces before open parenthesis ]
[ v2: add const to silence array ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: malc <av1474@comtv.ru>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 23:39:30 +03:00
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
malc b4f763b86d alsa: Use proper value when testing returned events in alsa_poll_handler
Signed-off-by: malc <av1474@comtv.ru>
2009-09-14 03:55:42 +04:00
malc 6ebfda13a6 alsa/oss: Remove fd transfer handlers before closing oss/alsa fd/handle
Signed-off-by: malc <av1474@comtv.ru>
2009-09-14 03:55:42 +04:00
Jan Kiszka 0a90e344f0 audio: Fix typo that broke QEMU_AUDIO_ADC_TRY_POLL
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: malc <av1474@comtv.ru>
2009-09-13 22:50:33 +04:00
malc 54762b7339 oss: Simplify mmap code
Signed-off-by: malc <av1474@comtv.ru>
2009-09-13 11:15:32 +04:00
malc 0b3652bc70 oss: OSS v4 support
a. Use SNDCTL_DSP_POLICY instead of SNDCTL_DSP_SETFRAGMENT
b. Add ability to open device in exclusive mode, thus bypassing vmix

Signed-off-by: malc <av1474@comtv.ru>
2009-09-13 11:15:32 +04:00
Blue Swirl 72cf2d4f0e Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc923584,
f40d753718,
96555a96d7 and
3990d09adf but the fixes were fragile.

Solution: Avoid the conflict entirely by renaming the functions and the
file. Revert the previous hacks.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-12 07:36:22 +00:00
malc 057fa65c5d audio: remove lsbindex/popcount in favour of host-utils's ctz32
Signed-off-by: malc <av1474@comtv.ru>
2009-09-12 02:50:58 +04:00
malc 8b438ba3f5 alsa: poll mode handling
Signed-off-by: malc <av1474@comtv.ru>
2009-09-12 02:50:58 +04:00
malc dd8a56494d oss: poll mode handling
Signed-off-by: malc <av1474@comtv.ru>
2009-09-12 02:50:58 +04:00
malc 713a98f8f1 audio: poll mode infrastructure
Signed-off-by: malc <av1474@comtv.ru>
2009-09-12 02:50:58 +04:00
malc 2182349d73 oss: Unbreak mmaping the ability to mmap oss fd on Linux
Signed-off-by: malc <av1474@comtv.ru>
2009-09-12 02:50:58 +04:00
Juan Quintela 6ee093c907 Unexport ticks_per_sec variable. Create get_ticks_per_sec() function
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:52 -05:00
malc 3c854e4770 Remove bit-rotten threshold handling
Thanks to Toshiya Takeda for bringing up an unrelated issue which led
to this.

Signed-off-by: malc <av1474@comtv.ru>
2009-09-10 21:09:09 +04:00
Kirill A. Shutemov f9c7b77c8e Fix warning on x86_64
audio/esdaudio.c: In function 'qesd_thread_out':
audio/esdaudio.c:136: error: format '%d' expects type 'int', but
argument 3 has type 'ssize_t'
audio/esdaudio.c: In function 'qesd_thread_in':
audio/esdaudio.c:366: error: format '%d' expects type 'int', but
argument 3 has type 'ssize_t'

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: malc <av1474@comtv.ru>
2009-09-02 16:46:13 +04:00
Consul 15c875a3cd Fix dsound typos
Dsound currently does not compile due to the typos in the code. This
patch makes it compile again.{PATCH}

Signed-off-by: Alex Ivanov <void@aleksoft.net>
Signed-off-by: malc <av1474@comtv.ru>
2009-08-26 13:55:44 +04:00
malc 197bc2196d Fix typo 2009-08-12 23:11:44 +04:00
malc 98f9f48ccb Aesthetics
Reformat to make item borders more visible
Fix cases of stray tabs and vertical misalignments

Signed-off-by: malc <av1474@comtv.ru>
2009-08-11 20:51:24 +04:00
Juan Quintela 1a40d5e235 use C99 initializers for all audio/*
Signed-off-by: Juan Quintela <quintela@redhat.com>
2009-08-11 20:51:24 +04:00
Juan Quintela 1dd3e4d13d use C99 initializers for audio_pcm_ops
Signed-off-by: Juan Quintela <quintela@redhat.com>
2009-08-11 20:51:24 +04:00
Juan Quintela 2700efa323 Use C99 initializers for audio_option
Signed-off-by: Juan Quintela <quintela@redhat.com>
2009-08-11 20:51:23 +04:00
Juan Quintela bee37f32d4 Use proper struct initializers and remove INIT_FIELD() macro
Signed-off-by: Juan Quintela <quintela@redhat.com>
2009-08-11 20:51:23 +04:00
Blue Swirl 660f11be54 Fix Sparse warnings: "Using plain integer as NULL pointer"
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-31 21:16:51 +00:00
Bjørn Mork 866358211d alsa: add host suspend/resume support
Both input and output streams may be in SND_PCM_STATE_SUSPENDED
after the host is suspended and resumed, meaning "Hardware is
suspended".  snd_pcm_readi() and snd_pcm_writei() will return
-ESTRPIPE if called while the stream is in this state.

Call snd_pcm_resume() to enable audio output and capture after
host resume.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: malc <av1474@comtv.ru>
2009-07-30 14:45:50 +04:00
Juan Quintela 2358a4940b Generate config-host.h from config-host.mak
Generate CONFIG_AUDIO_DRIVERS.  Order is important here, because the
first driver in the list is the one used by default.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-27 14:10:55 -05:00
Juan Quintela e2542fe2bc rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIAN
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-27 14:09:21 -05:00
malc aea867478c Fix period initialization
Signed-off-by: malc <av1474@comtv.ru>
2009-07-24 05:16:58 +04:00
Juan Quintela 14658cd151 use struct initializer for audio.c
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-22 10:58:47 -05:00
malc 2637872ba8 Ignore -Waddress for alsaaudio.c
/usr/include/alsa/pcm.h contains:

#define snd_pcm_sw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_sw_params_t *) alloca(snd_pcm_sw_params_sizeof()); memset(*ptr, 0, snd_pcm_sw_params_sizeof()); } while (0)

The assert generates: "error: the address of 'sw_params' will always
evaluate as 'true'" which combined with -Werror prevents alsaaudio.o
from being built with certain versions of GCC.
2009-07-17 05:57:04 +04:00
Jean-Christophe Dubois 5d92886792 fix qemu_alloc/qemu_free for audio subsystem
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
2009-06-19 02:46:14 +04:00
Gerd Hoffmann 97f155ddb7 alsa: fix warning
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-18 22:57:48 +04:00