summaryrefslogtreecommitdiff
path: root/audio/audio.c
AgeCommit message (Collapse)AuthorFilesLines
2013-12-09audio: Lower default wakeup rate to 100 times / secondHans de Goede1-1/+1
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-10-23audio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* secondHans de Goede1-1/+2
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-08-22aio / timers: Switch entire codebase to the new timer APIAlex Bligh1-3/+3
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-01-16audio: Replace non-portable asprintf in debug code by g_strdup_printfStefan Weil1-2/+3
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>
2012-12-19softmmu: move include files to include/sysemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19monitor: move include files to include/monitor/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-07-16audio: Unbreak capturing in mixemu casemalc1-0/+1
Signed-off-by: malc <av1474@comtv.ru>
2012-05-24audio: Always call fini on exitJan Kiszka1-4/+8
Not only clean up enabled voices but any registered one. Backends like pulsaudio rely on unconditional fini handler invocations. This fixes "Memory pool destroyed but not all memory blocks freed!" warnings on VM shutdowns when pa is used and lockups of QEMU on shutdown as it got stuck on some pa-internal synchronization point. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: malc <av1474@comtv.ru>
2012-04-17audio: don't apply volume effect if backend has VOICE_VOLUME_CAPMarc-André Lureau1-2/+7
If the audio backend is capable of volume control, don't apply software volume (mixeng_volume ()), but instead, rely on backend volume control. This will allow guest to have full range volume control. Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
2012-04-17audio: add VOICE_VOLUME ctlMarc-André Lureau1-0/+12
Add a new PCM control operation to update the stream volume on the audio backend. The argument given is a SWVoiceOut/SWVoiceIn. v4: - verified other backends didn't fail/assert on this new control they randomly return 0 or -1, but we ignore return value. Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
2012-02-25audio: Add some fall through commentsStefan Weil1-0/+3
Static code analysers expect these comments for case statements without a break statement. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: malc <av1474@comtv.ru>
2011-12-14Fix spelling in comments, documentation and messagesStefan Weil1-1/+1
accidently->accidentally annother->another choosen->chosen consideres->considers decriptor->descriptor developement->development paramter->parameter preceed->precede preceeding->preceding priviledge->privilege propogation->propagation substraction->subtraction throught->through upto->up to usefull->useful Fix also grammar in posix-aio-compat.c Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-15Replace the VMSTOP macros with a proper state typeLuiz Capitulino1-1/+1
Today, when notifying a VM state change with vm_state_notify(), we pass a VMSTOP macro as the 'reason' argument. This is not ideal because the VMSTOP macros tell why qemu stopped and not exactly what the current VM state is. One example to demonstrate this problem is that vm_start() calls vm_state_notify() with reason=0, which turns out to be VMSTOP_USER. This commit fixes that by replacing the VMSTOP macros with a proper state type called RunState. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-15/+15
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-21change all other clock references to use nanosecond resolution accessorsPaolo Bonzini1-2/+2
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-01-12audio: split sample conversion and volume mixingMichael Walle1-5/+6
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>
2010-11-18audio: Only use audio timer when necessarymalc1-14/+10
Originally proposed by Gerd Hoffmann. Signed-off-by: malc <av1474@comtv.ru> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-09spice: add audioGerd Hoffmann1-0/+3
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-07-06savevm: Add DeviceState paramAlex Williamson1-1/+1
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-03-16monitor: Separate "default monitor" and "current monitor" cleanlyMarkus Armbruster1-2/+2
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-01-17audio: include more information into audio_bug's outputmalc1-0/+9
Signed-off-by: malc <av1474@comtv.ru>
2009-12-03audio: port to vmstateJuan Quintela1-17/+9
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-18audio: use correct email addressmalc1-1/+1
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18audio: internal API changemalc1-22/+11
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-18audio: introduce audio_pcm_hw_clip_out helper functionmalc1-0/+22
Signed-off-by: malc <av1474@comtv.ru>
2009-09-18audio: use muldiv64 where it makes sensemalc1-1/+2
Signed-off-by: malc <av1474@comtv.ru>
2009-09-13audio: Fix typo that broke QEMU_AUDIO_ADC_TRY_POLLJan Kiszka1-1/+1
Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: malc <av1474@comtv.ru>
2009-09-12Fix sys-queue.h conflict for goodBlue Swirl1-19/+19
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 15cc9235840a22c289edbe064a9b3c19c5f49896, f40d753718c72693c5f520f0d9899f6e50395e94, 96555a96d724016e13190b28cffa3bc929ac60dc and 3990d09adf4463eca200ad964cc55643c33feb50 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-12audio: remove lsbindex/popcount in favour of host-utils's ctz32malc1-17/+0
Signed-off-by: malc <av1474@comtv.ru>
2009-09-12audio: poll mode infrastructuremalc1-11/+83
Signed-off-by: malc <av1474@comtv.ru>
2009-09-11Unexport ticks_per_sec variable. Create get_ticks_per_sec() functionJuan Quintela1-1/+1
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-12Fix typomalc1-1/+1
2009-08-11Aestheticsmalc1-52/+78
Reformat to make item borders more visible Fix cases of stray tabs and vertical misalignments Signed-off-by: malc <av1474@comtv.ru>
2009-08-11Use C99 initializers for audio_optionJuan Quintela1-40/+53
Signed-off-by: Juan Quintela <quintela@redhat.com>
2009-07-27Generate config-host.h from config-host.makJuan Quintela1-1/+6
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-24Fix period initializationmalc1-1/+1
Signed-off-by: malc <av1474@comtv.ru>
2009-07-22use struct initializer for audio.cJuan Quintela1-26/+26
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-14Remove any pretense that there can be more than one AudioStatemalc1-38/+33
2009-05-12Make AUD_init failure fatalPaul Brook1-24/+20
Failure to initialize the audio subsystem is not handled consistently. Where it is handled it has guest visible effects, which is wrong. We already have a "nosound" audio driver as a last resort, so trying to proceed without an audio backend seems pointless. Also protect against multiple calls to AUD_init so that this can be pushed down into individual devices. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-03-05monitor: Rework API (Jan Kiszka)aliguori1-3/+3
Refactor the monitor API and prepare it for decoupled terminals: term_print functions are renamed to monitor_* and all monitor services gain a new parameter (mon) that will once refer to the monitor instance the output is supposed to appear on. However, the argument remains unused for now. All monitor command callbacks are also extended by a mon parameter so that command handlers are able to pass an appropriate reference to monitor output services. For the case that monitor outputs so far happen without clearly identifiable context, the global variable cur_mon is introduced that shall once provide a pointer either to the current active monitor (while processing commands) or to the default one. On the mid or long term, those use case will be obsoleted so that this variable can be removed again. Due to the broad usage of the monitor interface, this patch mostly deals with converting users of the monitor API. A few of them are already extended to pass 'mon' from the command handler further down to internal functions that invoke monitor_printf. At this chance, monitor-related prototypes are moved from console.h to a new monitor.h. The same is done for the readline API. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-18Avoid running audio ctl's when vm is not runningmalc1-2/+9
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6627 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05audio: remove error handling from qemu_malloc() callers (Avi Kivity)aliguori1-15/+8
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6528 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-22Rework vm_state_change notifiers (Jan Kiszka)aliguori1-1/+2
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6402 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-22Use the ARRAY_SIZE() macro where appropriate.malc1-4/+4
Change from v1: Avoid changing the existing coding style in certain files. Signed-off-by: Stuart Brady <stuart.brady@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6120 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-03Make audio violate POSIX lessmalc1-13/+13
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5864 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-16Attached patch fixes a series of this warningblueswir11-2/+2
when compiling on NetBSD: warning: array subscript has type 'char' Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5727 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-12Rename hz to hertz to keep AIX happymalc1-6/+6
The issue was first noticed/addressed by Laurent Vivier in his QEMU on AIX patches. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5712 c046a42c-6fe2-441c-8c8c-71466251a162
2008-11-04Set default audio timer period to a sane value (otherwise qemu becomes ↵malc1-1/+1
unusable if -icount N is specified) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5623 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-28Fix more r5087 breakagemalc1-4/+1
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5337 c046a42c-6fe2-441c-8c8c-71466251a162