[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound p
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect |
Date: |
Mon, 26 Oct 2015 11:00:54 +0000 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Fri, Oct 16, 2015 at 09:54:12AM -0400, Programmingkid wrote:
>
> On Oct 16, 2015, at 8:15 AM, Stefan Hajnoczi wrote:
>
> > On Tue, Sep 22, 2015 at 07:32:01PM -0400, Programmingkid wrote:
> >> The USB audio card would not play audio well because its buffer was too
> >> small.
> >> Increasing it made it play perfectly. All the crackling and dropouts are
> >> gone.
> >>
> >> Signed-off-by: John Arbuckle <address@hidden>
> >>
> >> ---
> >> This patch was tested on qemu-system-ppc running Linux and qemu-system-i386
> >> running Windows XP. Windows XP sound output thru the USB audio card sounded
> >> perfect. Linux did improve in sound quality, but it still wasn't perfect. I
> >> think there are problems with the hcd-ohci.c file. The Mac OS 10.2 guest
> >> in
> >> qemu-system-ppc did not play sound due to USB issues unrelated to this
> >> patch.
> >>
> >> hw/usb/dev-audio.c | 3 ++-
> >> 1 files changed, 2 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c
> >> index f092bb8..e4e4989 100644
> >> --- a/hw/usb/dev-audio.c
> >> +++ b/hw/usb/dev-audio.c
> >> @@ -88,6 +88,7 @@ static const USBDescStrings usb_audio_stringtable = {
> >> #define USBAUDIO_PACKET_SIZE 192
> >> #define USBAUDIO_SAMPLE_RATE 48000
> >> #define USBAUDIO_PACKET_INTERVAL 1
> >> +#define BUFFER_MULTIPLIER 32
> >>
> >> static const USBDescIface desc_iface[] = {
> >> {
> >> @@ -664,7 +665,7 @@ static const VMStateDescription vmstate_usb_audio = {
> >> static Property usb_audio_properties[] = {
> >> DEFINE_PROP_UINT32("debug", USBAudioState, debug, 0),
> >> DEFINE_PROP_UINT32("buffer", USBAudioState, buffer,
> >> - 8 * USBAUDIO_PACKET_SIZE),
> >> + BUFFER_MULTIPLIER * USBAUDIO_PACKET_SIZE),
> >
> > I'm not familiar with the code but I guess this also increases audio
> > latency by a factor of 4 (8 -> 32).
>
> Didn't hear any problems. When I tried it out.
8 buffers * 192 bytes / 3 byte (24-bit) mono samples = 512 samples
32 buffers * 192 bytes / 3 byte (24-bit) mono samples = 2048 samples
At 48 kHz sample rate that is 10.6 milliseconds vs 42.6 milliseconds
latency.
I have never tried real-time audio processing under QEMU but when I use
Linux for guitar effects it becomes noticable when latency is above
around 12 milliseconds. ~5 milliseconds latency with USB audio is
achievable on bare metal.
So this change would make real-time audio feel laggy. Unless Gerd has a
strong feeling that it's an improvement for QEMU, I wouldn't merge this
change.
Stefan
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Stefan Hajnoczi, 2015/10/16
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Programmingkid, 2015/10/16
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Peter Maydell, 2015/10/16
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect,
Stefan Hajnoczi <=
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Gerd Hoffmann, 2015/10/26
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Programmingkid, 2015/10/26
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Stefan Hajnoczi, 2015/10/28
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Gerd Hoffmann, 2015/10/28
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Programmingkid, 2015/10/28
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Stefan Hajnoczi, 2015/10/29
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Programmingkid, 2015/10/29
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Gerd Hoffmann, 2015/10/30
- Re: [Qemu-devel] [PATCH] hw/usb/dev-audio.c: make USB audio card sound perfect, Programmingkid, 2015/10/26