All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: "Volker Rümelin" <vr_qemu@t-online.de>,
	qemu-devel@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@gmail.com>,
	kraxel@redhat.com, armbru@redhat.com, pbonzini@redhat.com,
	wtaymans@redhat.com, "Dorinda Bassey" <dbassey@redhat.com>
Subject: Re: [PATCH v7] audio/pwaudio.c: Add Pipewire audio backend for QEMU
Date: Tue, 14 Mar 2023 12:11:38 +0100	[thread overview]
Message-ID: <2477546.FPcbO7chfY@silver> (raw)
In-Reply-To: <CACzuRyz39A0ptHGY=8LNf=mXEkiTDD3OQ2a8gnk1_dbEn72YPw@mail.gmail.com>

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.





  reply	other threads:[~2023-03-14 11:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 17:10 [PATCH v7] audio/pwaudio.c: Add Pipewire audio backend for QEMU Dorinda Bassey
2023-03-07 14:41 ` Marc-André Lureau
2023-03-07 16:21   ` Dorinda Bassey
2023-03-08 10:39 ` Marc-André Lureau
2023-03-08 21:15   ` Volker Rümelin
2023-03-09 13:24   ` Dorinda Bassey
2023-03-10  6:42 ` Volker Rümelin
2023-03-11 12:08   ` [PATCH] DO-NOT-MERGE: pipewire sample code Volker Rümelin
2023-03-11 16:19     ` Volker Rümelin
2023-03-13 12:28       ` Dorinda Bassey
2023-03-13 20:05         ` Volker Rümelin
2023-03-14 11:50           ` Dorinda Bassey
2023-03-14 19:26             ` Volker Rümelin
2023-03-12  8:01 ` [PATCH v7] audio/pwaudio.c: Add Pipewire audio backend for QEMU Volker Rümelin
2023-03-13 13:11   ` Dorinda Bassey
2023-03-13 13:31     ` Christian Schoenebeck
2023-03-13 19:06       ` Dorinda Bassey
2023-03-14 11:11         ` Christian Schoenebeck [this message]
2023-03-13 19:22     ` Volker Rümelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2477546.FPcbO7chfY@silver \
    --to=qemu_oss@crudebyte.com \
    --cc=armbru@redhat.com \
    --cc=dbassey@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vr_qemu@t-online.de \
    --cc=wtaymans@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.