[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7] audio/pwaudio.c: Add Pipewire audio backend for QEMU
From: |
Christian Schoenebeck |
Subject: |
Re: [PATCH v7] audio/pwaudio.c: Add Pipewire audio backend for QEMU |
Date: |
Tue, 14 Mar 2023 12:11:38 +0100 |
On Monday, March 13, 2023 8:06:15 PM CET Dorinda Bassey wrote:
> >
> > Are you sure about sizeof(n_bytes) here? That's 4. ;-)
> >
> my bad!
>
> >
> > Volker's point was that "silence" is the center of the wave range. With
> > signed
> > range that's zero, yes, but with unsigned range that's 2^(bitdepth) / 2.
> >
> > So you need to memset() the correct value to generate "silence".
> >
> I understand now, Thanks. I guess it should work for signed range, so I
> would do:
>
> @@ -117,7 +117,9 @@ playback_on_process(void *data)
> }
>
> if (avail == 0) {
> - memset(p, 0, n_bytes);
> + memset(p, 0, (int32_t) n_bytes);
No, that would not fix anything. You are actually making several false
assumptions here.
Anyway, in audio/audio.c there is a function which does it correctly:
audio_pcm_info_clear_buf(struct audio_pcm_info *info, void *buf, int len)
So you probably just want to call this function instead to generate silence
correctly. Keep in mind though that it's `len` argument is in sample points,
not in bytes.
- Re: [PATCH v7] audio/pwaudio.c: Add Pipewire audio backend for QEMU, (continued)
Re: [PATCH v7] audio/pwaudio.c: Add Pipewire audio backend for QEMU, Volker Rümelin, 2023/03/12
Re: [PATCH v7] audio/pwaudio.c: Add Pipewire audio backend for QEMU, Volker Rümelin, 2023/03/13