Commit Graph

269 Commits

Author SHA1 Message Date
Peter Maydell 6086a565b0 audio: Clean up includes
Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453138432-8324-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-02-02 13:57:31 +01:00
Markus Armbruster 7e274652e4 audio: Clean up inappropriate and unreachable use of hw_error()
audio_init() should not use hw_error(), because dumping CPU registers
is unhelpful there, and aborting is wrong, because it can be called
called from an audio device's realize() method.

The two uses of hw_error() come from commit 0d9acba:

* When qemu_new_timer() fails.  It couldn't fail back then, and it
  can't fail now.  Drop the unreachable error handling.

* When no_audio_driver can't be initialized.  It couldn't fail back
  then, and it can't fail now.  Replace the error handling by an
  assertion.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
2016-01-13 15:16:16 +01:00
Peter Maydell 2f79a18fdd audio/coreaudio.c: Avoid deprecated AudioDeviceAdd/RemoveIOProc APIs
The AudioDeviceAddIOProc() and AudioDeviceRemoveIOProc() functions were
deprecated in OSX 10.5. Since we don't support any earlier versions of
OSX, we can simply replace them with the new APIs
AudioDeviceCreateIOProcID() and AudioDeviceRemoveIOProcID().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1448747724-15572-6-git-send-email-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-12-15 11:08:12 +01:00
Peter Maydell 2d99f6299b audio/coreaudio.c: Use new-in-OSX-10.6 APIs when available
Use the new-in-OSX 10.6 API AudioObjectGetPropertyData() instead
of the deprecated AudioDeviceGetProperty() and AudioDeviceSetProperty()
functions when possible.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1448747724-15572-5-git-send-email-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-12-15 11:08:12 +01:00
Peter Maydell 95a860f62e audio/coreaudio.c: Factor out uses of AudioDeviceGet/SetProperty
The CoreAudio APIs AudioDeviceGetProperty and AudioDeviceSetProperty are
deprecated from OSX 10.6, so factor out our calls to them so we can
provide versions which use the replacement APIs on OSX newer than 10.5.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1448747724-15572-4-git-send-email-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-12-15 11:08:11 +01:00
Peter Maydell 624d1fc30f audio/coreaudio.c: Use new-in-OSX-10.6 API for getting default voice
If we're building for OSX 10.6 or better, use the new API
AudioObjectGetPropertyData for getting the default voice.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1448747724-15572-3-git-send-email-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-12-15 11:08:11 +01:00
Peter Maydell 88a0f8300b audio/coreaudio.c: Factor out use of AudioHardwareGetProperty
The CoreAudio function AudioHardwareGetProperty has been deprecated
starting with OSX 10.6, so factor out our call to it so we can
provide an equivalent with the new APIs when they exist.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1448747724-15572-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-12-15 11:08:11 +01:00
Gonglei 2828a30723 ossaudio: fix memory leak
Variable "conf" going out of scope leaks the storage
it points to in line 856.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <1435021270-7768-1-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-08 13:11:01 +02:00
Markus Armbruster d49b683644 qerror: Move #include out of qerror.h
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-06-22 18:20:40 +02:00
Kővágó, Zoltán d95d7d802c ossaudio: use trace events instead of debug config flag
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán fbb7ef56d5 alsaaudio: use trace events instead of verbose
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán 6dd35fd81e dsoundaudio: remove primary buffer
Enabling this option just creates a playback buffer with the specified settings,
and then ignores it. It's probably some outdated hack to set audio formats on
windows. (The first created stream dictates all other streams settings, at least
on some Windows versions). Setting DAC_FIXED_SETTINGS should have the same
effect as setting (the now removed) primary buffer.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán 2762955f72 dsoundaudio: remove *_retries kludges
According to MSDN this may happen when the window is not in the foreground, but
the default is 1 since a long time (which means no retries), so it should be ok.
I've found no problems during testing it on Windows 7 and wine, so this was
probably only the case with some old Windows versions.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán 73ad33ef7b audio: remove plive
It was useless even 3 years ago, so it can probably safely go away:
https://lists.nongnu.org/archive/html/qemu-devel/2012-03/msg02427.html

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán 06ac27f683 audio: remove LOG_TO_MONITOR along with default_mon
Setting QEMU_AUDIO_LOG_TO_MONITOR=1 can crash qemu (if qemu tries to log
to the monitor before it's being initialized), and also nothing else in
qemu logs to the monitor.

This log to monitor feature was the last thing that used the default_mon
variable, so I removed it too (as using it can cause problems).

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán 81ebb07c56 sdlaudio: do not allow multiple instances
Since SDL uses a lot of global data, we can't create independent
instances of sdl audio backend.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán d1f52a1d70 coreaudio: do not use global variables where possible
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán 191e1f0acd dsoundaudio: do not use global variables
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán 49dd6d0d33 paaudio: fix possible resource leak
qpa_audio_init did not clean up resources properly if the initialization
failed. This hopefully fixes it.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:48 +02:00
Kővágó, Zoltán f2dcc6cec2 wavaudio: do not use global variables
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:47 +02:00
Kővágó, Zoltán 4045a85ad1 ossaudio: do not use global variables
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:47 +02:00
Kővágó, Zoltán 765b37da3f alsaaudio: do not use global variables
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:47 +02:00
Kővágó, Zoltán 9a644c4b4d paaudio: do not use global variables
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:47 +02:00
Kővágó, Zoltán 5706db1deb audio: expose drv_opaque to init_out and init_in
Currently the opaque pointer returned by audio_driver's init is only
exposed to the driver's fini, but not to audio_pcm_ops. This way if
someone wants to share a variable with the driver and the pcm, he must
use global variables. This patch fixes it by adding a third parameter to
audio_pcm_op's init_out and init_in.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 12:42:47 +02:00
Kővágó, Zoltán 3cec7cc22f audio: remove winwave audio driver
DirectSound should be a superior choice on Windows.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 10:50:31 +02:00
Kővágó, Zoltán 14382605da audio: remove fmod backend
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 10:50:31 +02:00
Kővágó, Zoltán 0bac111167 audio: remove esd backend
ESD is no longer developed and replaced by PulseAudio.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-15 10:50:31 +02:00
Fam Zheng b027a538c6 oss: Remove unused error handling of qemu_set_fd_handler
The function cannot fail, so the check is superfluous.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-11-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-06-12 13:26:21 +01:00
Fam Zheng be93f21627 alsaaudio: Remove unused error handling of qemu_set_fd_handler
The function cannot fail, so the check is superfluous.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1433400324-7358-10-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-06-12 13:26:21 +01:00
Peter Maydell b28fb27b5e audio: Don't free hw resources until after hw backend is stopped
When stopping an audio voice, call the audio backend's fini
method before calling audio_pcm_hw_free_resources_ rather than
afterwards. This allows backends which use helper threads (like
pulseaudio) to terminate those threads before the conv_buf or
mix_buf are freed and avoids race conditions where the helper
may access a NULL pointer or freed memory.

Cc: qemu-stable@nongnu.org
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1418406239-9838-1-git-send-email-peter.maydell@linaro.org
2014-12-22 23:12:25 +00:00
Markus Armbruster fb7da626c0 audio: Drop superfluous conditionals around g_free()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-13 12:34:54 +02:00
Le Tan 69e995040c audio: replace fprintf(stderr, ...) with error_report() in audio
Replace fprintf(stderr,...) with error_report() in files audio/*.
The trailing "\n"s of the @fmt argument have been removed
because @fmt of error_report() should not contain newline.

Signed-off-by: Le Tan <tamlokveer@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-05-26 10:41:21 +04:00
Juan Quintela 35d08458a9 savevm: Remove all the unneeded version_minimum_id_old (rest)
After previous Peter patch, they are redundant.  This way we don't
assign them except when needed.  Once there, there were lots of case
where the ".fields" indentation was wrong:

     .fields = (VMStateField []) {
and
     .fields =      (VMStateField []) {

Change all the combinations to:

     .fields = (VMStateField[]){

The biggest problem (appart from aesthetics) was that checkpatch complained
when we copy&pasted the code from one place to another.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2014-05-14 15:24:51 +02:00
Michael Tokarev 849d8284c5 build: convert some obj-specific CFLAGS to use new foo.o-cflags syntax
Current Makefile system allows using foo.o-cflags variables to store
object-specific CFLAGS.  Convert some usages of old syntax
(using QEMU_CFLAGS += construct) to the new syntax.

Do not touch multifile modules for now, as build system isn't ready for this.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-05-08 15:27:49 +02:00
Jeremy White 795ca114d3 Add the ability to vary Spice playback and record rates, to facilitate Opus support.
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-02-03 11:05:15 +01:00
Gerd Hoffmann 0e8ae611bd audio: adjust pulse to 100Hz wakeup rate
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-09 09:19:26 +01:00
Hans de Goede 40a814b0b1 audio: Lower default wakeup rate to 100 times / second
This is more then plenty to keep audio card fifos filles / emptied.

This drops host cpu-load for audio playback inside a linux vm from
13% to 9%.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-09 09:19:26 +01:00
Gerd Hoffmann 73204cffe5 ossaudio: check for oss support in oss_audio_init
Check whenever the device path (/dev/dsp by default) exists and qemu is
allowed to access it.  Return NULL if it isn't, so ossaudio will not
be used on systems wihtout oss support (increasinly common on modern
linux systems).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-07 12:26:00 +01:00
Gerd Hoffmann 926de75432 Revert "ossaudio: do not enable by default"
This reverts commit c905c5012a.

There is a better fix for the issue at hand.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-07 12:26:00 +01:00
Anthony Liguori c905c5012a ossaudio: do not enable by default
Modern Linux's no longer support /dev/dsp so enabling it by
default causes audio failures on newer Linux distros.

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
Tested-by: Andreas Färber <afaerber@suse.de>
Message-id: 1383497154-9271-1-git-send-email-aliguori@amazon.com
2013-11-05 08:40:36 -08:00
Anthony Liguori ef5cfe5bbd Merge remote-tracking branch 'mjt/trivial-patches' into staging
* mjt/trivial-patches:
  audio/mixeng_template.h: fix inline declaration
  misc: Spelling and grammar fixes in comments
  docs/ccid.txt: fix the typo
  qapi: fix documentation example
  .gitignore: ignore qmp-commands.txt
  misc: New spelling fixes in comments
  configure: create fsdev/ directory

Message-id: 1382779887-15971-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-10-31 17:01:43 +01:00
Alex Bligh 203cea22a3 audio/mixeng_template.h: fix inline declaration
Fix error: ‘inline’ is not at beginning of declaration
[-Werror=old-style-declaration]

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-10-26 13:09:34 +04:00
Hans de Goede b4350deed6 audio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* second
Now that we no longer have MIN_REARM_TIMER_NS a bug in the audio subsys has
clearly shown it self by trying to make a timer fire every nano second.

Note we have a similar problem in 1.6, 1.5 and older but there
MIN_REARM_TIMER_NS limits the wakeups caused by audio being active to
4000 times / second. This still causes a host cpu load of 50 % for simply
playing audio, where as with this patch git master is at 13%, so we should
backport this to 1.5 and 1.6 too.

Note this will not apply to 1.5 and 1.6 as is.

Cc: qemu-stable@nongnu.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-10-23 10:37:27 +02:00
Bandan Das 19b0dfc19c audio: remove CONFIG_MIXEMU configure option
Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-24 10:29:34 +02:00
Alex Bligh bc72ad6754 aio / timers: Switch entire codebase to the new timer API
This is an autogenerated patch using scripts/switch-timer-api.

Switch the entire code base to using the new timer API.

Note this patch may introduce some line length issues.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-08-22 19:14:24 +02:00
Stefan Weil 87e613ea9e audio: Replace static functions in header file by macros, remove GCC_ATTR
Using macros instead of static functions for dolog and for ldebug
simplifies the code and can also reduce the total code size.

GCC_ATTR was only used in audio_int.h, so it is now unused and
the definition can be removed from compiler.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-21 22:52:50 +04:00
Brad Smith 4f6ab397b6 Remove OSS support for OpenBSD
Remove the OSS support for OpenBSD. The OSS API has not been usable
for quite some time.

Signed-off-by: Brad Smith <brad@comstyle.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-05-26 11:14:52 +00:00
Michael Tokarev 997aba8e25 remove some double-includes
Some source files #include the same header more than
once for no good reason.  Remove second #includes in
such cases.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-18 16:35:12 +04:00
Stefan Weil 457b654327 audio: Replace non-portable asprintf in debug code by g_strdup_printf
sw->name already uses the correct g_free to free the allocated memory.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-16 12:03:26 -06:00
Paolo Bonzini 9c17d615a6 softmmu: move include files to include/sysemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:32:45 +01:00