summaryrefslogtreecommitdiff
path: root/audio
AgeCommit message (Collapse)Author
2021-12-21audio: add "dbus" audio backendMarc-André Lureau
Add a new -audio backend that accepts D-Bus clients/listeners to handle playback & recording, to be exported via the -display dbus. Example usage: -audiodev dbus,in.mixing-engine=off,out.mixing-engine=off,id=dbus -display dbus,audiodev=dbus Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2021-10-14configure, meson: move audio driver detection to MesonPaolo Bonzini
This brings a change that makes audio drivers more similar to all other modules. All drivers are built by default, while --audio-drv-list only governs the default choice of the audio driver. Meson options are added to disable the drivers, and the next patches will fix the help messages and command line options, and especially make the non-default drivers available via -audiodev. Cc: Gerd Hoffman <kraxel@redhat.com> Cc: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20211007130630.632028-4-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-10-14audio: remove CONFIG_AUDIO_WIN_INTPaolo Bonzini
Ever since winwaveaudio was removed in 2015, CONFIG_AUDIO_WIN_INT is only set if dsound is in use, so use CONFIG_AUDIO_DSOUND directly. Cc: Gerd Hoffman <kraxel@redhat.com> Cc: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20211007130630.632028-3-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-08-10audio: Never send migration sectionDr. David Alan Gilbert
The audio migration vmstate is empty, and always has been; we can't just remove it though because an old qemu might send it us. Changes with -audiodev now mean it's sometimes created when it didn't used to be, and can confuse migration to old qemu. Change it so that vmstate_audio is never sent; if it's received it should still be accepted, and old qemu's shouldn't be too upset if it's missing. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Tested-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20210809170956.78536-1-dgilbert@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-07-09modules: add audio module annotationsGerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jose R. Ziviani <jziviani@suse.de> Message-Id: <20210624103836.2382472-9-kraxel@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-23coreaudio: Lock only the bufferAkihiko Odaki
On macOS 11.3.1, Core Audio calls AudioDeviceIOProc after calling an internal function named HALB_Mutex::Lock(), which locks a mutex in HALB_IOThread::Entry(void*). HALB_Mutex::Lock() is also called in AudioObjectGetPropertyData, which is called by coreaudio driver. Therefore, a deadlock will occur if coreaudio driver calls AudioObjectGetPropertyData while holding a lock for a mutex and tries to lock the same mutex in AudioDeviceIOProc. audioDeviceIOProc, which implements AudioDeviceIOProc in coreaudio driver, requires an exclusive access for the device configuration and the buffer. Fortunately, a mutex is necessary only for the buffer in audioDeviceIOProc because a change for the device configuration occurs only before setting up AudioDeviceIOProc or after stopping the playback with AudioDeviceStop. With this change, the mutex owned by the driver will only be used for the buffer, and the device configuration change will be protected with the implicit iothread mutex. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-id: 20210622201740.38005-1-akihiko.odaki@gmail.com Message-Id: <20210622201740.38005-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-06-17coreaudio: Fix output stream format settingsAkihiko Odaki
Before commit 7d6948cd98cf5ad8a3458a4ce7fdbcb79bcd1212, it was coded to retrieve the initial output stream format settings, modify the frame rate, and set again. However, I removed a frame rate modification code by mistake in the commit. It also assumes the initial output stream format is consistent with what QEMU expects, but that expectation is not in the code, which makes it harder to understand and will lead to breakage if the initial settings change. This change explicitly sets all of the output stream settings to solve these problems. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210616141721.54091-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-06-17audio: Fix format specifications of debug logsAkihiko Odaki
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-id: 20210616141411.53892-1-akihiko.odaki@gmail.com Message-Id: <20210616141411.53892-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-06-17jackaudio: avoid that the client name contains the word (NULL)Volker Rümelin
Currently with jackaudio client name and qemu guest name unset, the JACK client names are out-(NULL) and in-(NULL). These names are user visible in the patch bay. Replace the function call to qemu_get_vm_name() with a call to audio_application_name() which replaces NULL with "qemu" to have more descriptive names. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20210517194604.2545-4-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-06-17audio: move code to audio/audio.cVolker Rümelin
Move the code to generate the pa_context_new() application name argument to a function in audio/audio.c. The new function audio_application_name() will also be used in the jackaudio backend. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20210517194604.2545-3-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-06-17paaudio: remove unused stream flagsVolker Rümelin
In current code there are no calls to pa_stream_get_latency() or pa_stream_get_time() to receive latency or time information. Remove the flags PA_STREAM_INTERPOLATE_TIMING and PA_STREAM_AUTO_TIMING_UPDATE which instruct PulseAudio to calculate this information in regular intervals. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20210517194604.2545-2-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-06-17alsaaudio: remove #ifdef DEBUG to avoid bit rotVolker Rümelin
Merge the #ifdef DEBUG code with the if statement a few lines above to avoid bit rot. Suggested-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20210517194604.2545-1-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-06-02docs: fix references to docs/devel/tracing.rstStefano Garzarella
Commit e50caf4a5c ("tracing: convert documentation to rST") converted docs/devel/tracing.txt to docs/devel/tracing.rst. We still have several references to the old file, so let's fix them with the following command: sed -i s/tracing.txt/tracing.rst/ $(git grep -l docs/devel/tracing.txt) Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210517151702.109066-2-sgarzare@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2021-03-16coreaudio: Handle output device changeAkihiko Odaki
An output device change can occur when plugging or unplugging an earphone. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210311151512.22096-3-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-16coreaudio: Extract device operationsAkihiko Odaki
This change prepare to support dynamic device changes, which requires to perform device initialization/deinitialization multiple times. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20210311151512.22096-2-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-16coreaudio: Drop support for macOS older than 10.6Akihiko Odaki
Mac OS X 10.6 was released in 2009. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20210311151512.22096-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-03-09sysemu: Let VMChangeStateHandler take boolean 'running' argumentPhilippe Mathieu-Daudé
The 'running' argument from VMChangeStateHandler does not require other value than 0 / 1. Make it a plain boolean. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20210111152020.1422021-3-philmd@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-01-15audio: space prohibited between function name and parenthesis'('Zhang Han
Delete spaces between function name and open parenthesis'(' Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-id: 20210115012431.79533-1-zhanghan64@huawei.com Message-Id: <20210115012431.79533-8-zhanghan64@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: Suspect code indent for conditional statementsZhang Han
Fix code indent. Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-id: 20210115012431.79533-1-zhanghan64@huawei.com Message-Id: <20210115012431.79533-7-zhanghan64@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: Don't use '%#' in format stringsZhang Han
Use '0x' prefix instead of '%#' Signed-off-by: Zhang Han <zhanghan64@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20210115012431.79533-1-zhanghan64@huawei.com Message-Id: <20210115012431.79533-6-zhanghan64@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: Fix lines over 90 charactersZhang Han
Fix the line width of code. Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-id: 20210115012431.79533-1-zhanghan64@huawei.com Message-Id: <20210115012431.79533-5-zhanghan64@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: foo* bar" should be "foo *bar".Zhang Han
transfer "foo* " to "foo *" Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-id: 20210115012431.79533-1-zhanghan64@huawei.com Message-Id: <20210115012431.79533-4-zhanghan64@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: Add spaces around operator/delete redundant spacesZhang Han
Fix problems about spaces: -operator needs spaces around it, add them. -somespaces are redundant, remove them. Signed-off-by: Zhang Han <zhanghan64@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20210115012431.79533-1-zhanghan64@huawei.com Message-Id: <20210115012431.79533-3-zhanghan64@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: Add braces for statements/fix braces' positionZhang Han
Fix problems about braces: -braces are necessary for all arms of if/for/while statements -else should follow close brace '}' Signed-off-by: Zhang Han <zhanghan64@huawei.com> Message-id: 20210115012431.79533-1-zhanghan64@huawei.com Message-Id: <20210115012431.79533-2-zhanghan64@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15dsoundaudio: fix log messageVolker Rümelin
There is a mismatch between message and used argument. Change the argument from frequency to format. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-23-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15dsoundaudio: enable f32 audio sample formatVolker Rümelin
Enable the f32 audio sample format for the DirectSound backend. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-22-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15dsoundaudio: rename dsound_open()Volker Rümelin
Rename dsound_open() to dsound_set_cooperative_level(). The only task of that function is to set the cooperative level for DirectSound. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-21-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15dsoundaudio: replace GetForegroundWindow()Volker Rümelin
GetForegroundWindow() doesn't necessarily return the own window handle. It just returns a handle to the currently active window and can even return NULL. At the time dsound_open() gets called the active window is most likely the shell window and not the QEMU window. Replace GetForegroundWindow() with GetDesktopWindow() which always returns a valid window handle, and at the same time replace the DirectSound buffer flag DSBCAPS_STICKYFOCUS with DSBCAPS_GLOBALFOCUS where Windows only expects a valid window handle for DirectSound function SetCooperativeLevel(). The Microsoft online docs for IDirectSound::SetCooperativeLevel recommend this in the remarks. This fixes a bug where you can't hear sound from the guest. To reproduce start qemu with -machine pcspk-audiodev=audio0 -device intel-hda -device hda-duplex,audiodev=audio0 -audiodev dsound,id=audio0,out.mixing-engine=off from a shell and start audio playback with the hda device in the guest. The guest will be silent. To hear guest audio you have to activate the shell window once. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-20-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15paaudio: send recorded data in smaller chunksVolker Rümelin
Tell PulseAudio to send recorded audio data in smaller chunks than timer_period, so there's a good chance that qemu can read recorded audio data every time it looks for new data. PulseAudio tries to send buffer updates at a fragsize / 2 rate. With fragsize = timer_period / 2 * 3 the update rate is 75% of timer_period. The lower limit for the recording buffer size maxlength is fragsize * 2. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-19-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15paaudio: limit minreq to 75% of audio timer_rateVolker Rümelin
Currently with the playback buffer attribute minreq = -1 and flag PA_STREAM_EARLY_REQUESTS PulseAudio uses minreq = tlength / 4. To improve audio playback with larger PulseAudio server side buffers, limit minreq to a maximum of 75% of audio timer_rate. That way there is a good chance qemu receives a stream buffer size update before it tries to write data to the playback stream. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-18-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15paaudio: comment bugs in functions qpa_init_*Volker Rümelin
The audio buffer size in audio/paaudio.c is typically larger than expected. Just comment the bugs in qpa_init_in() and qpa_init_out() for now. Fixing these bugs may break glitch free audio playback with fine tuned user audio settings. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-17-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15paaudio: remove unneeded codeVolker Rümelin
Commit baea032ec7 "audio/paaudio: fix ignored buffer_length setting" added code to handle buffer_length defaults. This was unnecessary because the audio_buffer_* functions in audio/audio.c already handle this. Remove the unneeded code. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-16-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15paaudio: wait until the playback stream is readyVolker Rümelin
Don't call pa_stream_writable_size() in qpa_get_buffer_out() before the playback stream is ready. This prevents a lot of the following pulseaudio error messages. pulseaudio: pa_stream_writable_size failed pulseaudio: Reason: Bad state To reproduce start qemu with -parallel none -device gus,audiodev=audio0 -audiodev pa,id=audio0 Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-15-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15paaudio: wait for PA_STREAM_READY in qpa_write()Volker Rümelin
Don't call pa_stream_writable_size() in qpa_write() before the playback stream is ready. This prevents a lot of the following pulseaudio error messages. pulseaudio: pa_stream_writable_size failed pulseaudio: Reason: Bad state To reproduce start qemu with -parallel none -device gus,audiodev=audio0 -audiodev pa,id=audio0,out.mixing-engine=off Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-14-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15paaudio: avoid to clip samples multiple timesVolker Rümelin
The pulseaudio backend currently converts, clips and copies audio playback samples in the mixing-engine sample buffer multiple times. In qpa_get_buffer_out() the function pa_stream_begin_write() returns a rather large buffer and this allows audio_pcm_hw_run_out() in audio/audio.c to copy all samples in the mixing-engine buffer to the pulse audio buffer. Immediately after copying, qpa_write() notices with a call to pa_stream_writable_size() that pulse audio only needs a smaller part of the copied samples and ignores the rest. This copy and ignore process happens several times for each audio sample. To fix this behaviour, call pa_stream_writable_size() in qpa_get_buffer_out() to limit the number of samples audio_pcm_hw_run_out() will convert. With this change the pulseaudio pcm_ops functions put_buffer_out and write are no longer identical and a separate qpa_put_buffer_out is needed. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-13-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: remove remaining unused plive codeVolker Rümelin
Commit 73ad33ef7b "audio: remove plive" forgot to remove this code. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-12-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15sdlaudio: enable (in|out).mixing-engine=offVolker Rümelin
Enable the SDL2 backend options -audiodev sdl,out.mixing- engine=off,in.mixing-engine=off. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-11-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: break generic buffer dependency on mixing-engineVolker Rümelin
Break the unnecessary dependency of the generic buffer management code on mixing-engine. This is required for the next patch. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-10-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15sdlaudio: add recording functionsVolker Rümelin
Add audio recording functions. SDL 2.0.5 or later is required to use the recording functions. Playback continues to work with earlier SDL 2.0 versions. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-9-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: split pcm_ops function get_buffer_inVolker Rümelin
Split off pcm_ops function run_buffer_in from get_buffer_in and call run_buffer_in before get_buffer_in. The next patch only needs the generic buffer management part from audio_generic_get_buffer_in(). Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-8-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15sdlaudio: replace legacy functions with modern onesVolker Rümelin
With the modern audio functions it's possible to add new features like audio recording. As a side effect this patch fixes a bug where SDL2 can't be used on Windows. This bug was reported on the qemu-devel mailing list at https://lists.nongnu.org/archive/html/qemu-devel/2020-01/msg04043.html Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-7-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15sdlaudio: fill remaining sample buffer with silenceVolker Rümelin
Fill the remaining sample buffer with silence. To fill it with zeroes is wrong for unsigned samples because this is silence with a DC bias. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-6-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15sdlaudio: always clear the sample bufferVolker Rümelin
Always fill the remaining audio callback buffer with silence. SDL 2.0 doesn't initialize the audio callback buffer. This was an incompatible change compared to SDL 1.2. For reference read the SDL 1.2 to 2.0 migration guide. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-5-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15sdlaudio: don't start playback in init routineVolker Rümelin
Every emulated audio device has a way to enable audio playback. Don't start playback until the guest enables the audio device. This patch keeps the SDL2 device pause state in sync with hw->enabled. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Thomas Huth <thuth@redhat.com> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-4-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15sdlaudio: add -audiodev sdl,out.buffer-count optionVolker Rümelin
Currently there is a crackling noise with SDL2 audio playback. Commit bcf19777df: "audio/sdlaudio: Allow audio playback with SDL2" already mentioned the crackling noise. Add an out.buffer-count option to give users a chance to select sane settings for glitch free audio playback. The idea was taken from the coreaudio backend. The in.buffer-count option will be used with one of the next patches. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Acked-by: Markus Armbruster <armbru@redhat.com> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-3-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15audio: fix bit-rotted codeVolker Rümelin
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-2-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-15sdlaudio: remove leftover SDL1.2 codeVolker Rümelin
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de Message-Id: <20210110100239.27588-1-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-12-18qdev: Move softmmu properties to qdev-properties-system.hEduardo Habkost
Move the property types and property macros implemented in qdev-properties-system.c to a new qdev-properties-system.h header. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20201211220529.2290218-16-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-12-15audio: add sanity checkGerd Hoffmann
Check whenever we actually found the spiceaudio driver before flipping the can_be_default field. Fixes: f0c4555edfdd ("audio: remove qemu_spice_audio_init()") Buglink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977301 Reported-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20201215081151.20095-1-kraxel@redhat.com>
2020-12-15audio: Simplify audio_bug() removing old codePhilippe Mathieu-Daudé
This code (introduced in commit 1d14ffa97ea, Oct 2005) is likely unused since years. Time to remove it. If the condition is true, simply call abort(). Suggested-by: Gerd Hoffmann <gerd@kraxel.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20201210223506.263709-1-philmd@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>