qemu-e2k/audio
Volker Rümelin a806f95904 audio: copy playback stream in sequential order
Change the code to copy the playback stream in sequential order.
The advantage can be seen in the next patches where the stream
copy operation effectively becomes a write through operation.

The following diagram shows the average buffer fill level and
the stream copy sequence. ### represents a timer_period sized
chunk. The rest of the buffer sizes are not to scale.

With current code:
         |--------| |#####111| |---#####|
          sw->buf    mix_buf    backend buffer
  1. clip
         |--------| |---#####| |111##222|
          sw->buf    mix_buf    backend buffer
  2. write to audio device
  333 -> |--------| |---#####| |---111##| -> 222
          sw->buf    mix_buf    backend buffer
  3a. sw device write
         |-----333| |---#####| |---111##|
          sw->buf    mix_buf    backend buffer
  3b. resample and mix
         |--------| |333#####| |---111##|
          sw->buf    mix_buf    backend buffer

With this patch:
  111 -> |--------| |---#####| |---#####|
          sw->buf    mix_buf    backend buffer
  1a: sw device write
         |-----111| |---#####| |---#####|
          sw->buf    mix_buf    backend buffer
  1b. resample and mix
         |--------| |111##222| |---#####|
          sw->buf    mix_buf    backend buffer
  2. clip
         |--------| |---111##| |222##333|
          sw->buf    mix_buf    backend buffer
  3. write to audio device
         |--------| |---111##| |---222##| -> 333
          sw->buf    mix_buf    backend buffer

The effective total playback buffer size is reduced by
timer_period.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20220301191311.26695-7-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-03-04 11:05:13 +01:00
..
alsaaudio.c alsaaudio: remove #ifdef DEBUG to avoid bit rot 2021-06-17 11:54:09 +02:00
audio.c audio: copy playback stream in sequential order 2022-03-04 11:05:13 +01:00
audio.h qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
audio_int.h audio: replace open-coded buffer arithmetic 2022-03-04 11:05:13 +01:00
audio_legacy.c sdlaudio: add -audiodev sdl,out.buffer-count option 2021-01-15 11:25:22 +01:00
audio_template.h audio: add "dbus" audio backend 2021-12-21 10:50:22 +04:00
audio_win_int.c dsoundaudio: fix log message 2021-01-15 11:25:22 +01:00
audio_win_int.h Windows Waveform Audio driver (no ADC support yet) 2009-10-10 01:18:24 +04:00
coreaudio.c audio: replace open-coded buffer arithmetic 2022-03-04 11:05:13 +01:00
dbusaudio.c audio: add "dbus" audio backend 2021-12-21 10:50:22 +04:00
dsound_template.h dsoundaudio: replace GetForegroundWindow() 2021-01-15 11:25:22 +01:00
dsoundaudio.c dsoundaudio: fix crackling audio recordings 2022-01-13 10:47:52 +01:00
jackaudio.c jackaudio: use more jack audio buffers 2022-03-04 11:05:13 +01:00
meson.build audio: add "dbus" audio backend 2021-12-21 10:50:22 +04:00
mixeng.c audio: Let audio_sample_to_uint64() use const samples argument 2020-05-26 08:29:30 +02:00
mixeng.h audio: proper support for float samples in mixeng 2020-02-06 14:35:57 +01:00
mixeng_template.h audio: fix saturation nonlinearity in clip_* functions 2020-03-16 10:18:07 +01:00
noaudio.c audio: split pcm_ops function get_buffer_in 2021-01-15 11:25:22 +01:00
ossaudio.c audio: Add braces for statements/fix braces' position 2021-01-15 11:49:26 +01:00
paaudio.c paaudio: increase default latency to 46ms 2022-03-04 11:05:13 +01:00
rate_template.h audio: use size_t where makes sense 2019-08-21 09:13:37 +02:00
sdlaudio.c audio: replace open-coded buffer arithmetic 2022-03-04 11:05:13 +01:00
spiceaudio.c modules: add audio module annotations 2021-07-09 18:20:27 +02:00
trace-events audio: add "dbus" audio backend 2021-12-21 10:50:22 +04:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
wavaudio.c audio: fix bug 1858488 2020-01-31 08:48:03 +01:00
wavcapture.c monitor: Use getter/setter functions for cur_mon 2020-10-09 07:08:19 +02:00