Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Oct 2005 12:46:50 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-multimedia@freebsd.org
Cc:        Alexander Leidinger <Alexander@leidinger.net>, skywizard@mybsd.org.my
Subject:   Re: uaudio and Digigram UAX220
Message-ID:  <200510291246.51699.hselasky@c2i.net>
In-Reply-To: <20051027133448.vptim01kwoco8wcw@netchild.homeip.net>
References:  <4358CB6F.2080901@intersonic.se> <20051027.040902.343165902.kazuhito@ph.noda.tus.ac.jp> <20051027133448.vptim01kwoco8wcw@netchild.homeip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 27 October 2005 13:34, Alexander Leidinger wrote:
> Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp> wrote:
> > I had a patch which make USB audio device treat 24-bit on FreeBSD.
> > It was attached to this mail.
> > But cyclic noise will interrupt,
> > though FreeBSD sound system can play/record sound source.
> > It may result from USB system in FreeBSD,
> > and the patch in (http://home.c2i.net/hselasky/isdn4bsd/privat/usb/)
> > will resolve this noise problem.
>
> I don't think we will use the new USB stack if NetBSD/OpenBSD doesn't use
> it too. Apart from that, the patch looks nice. If nobody beats me, I try to
> commit it at the weekend (no promises, I'm moving and the PC will be moved
> at the weekend...).
>
> Some comments inline.
>
> > --- uaudio.c.orig Thu Apr 28 02:16:27 2005
> > +++ uaudio.c Tue Sep  6 23:10:09 2005
> >
> > @@ -3876,7 +3900,7 @@ uaudio_query_formats(device_t dev, u_int
> >    }
> >   }
> >
> > -  if ((pn > 8*2) || (rn > 8*2))
> > +  if ((pn > 12*2) || (rn > 12*2))
> >    break;
> >  }
> >  pfmt[pn] = 0;
> > --- uaudio_pcm.c.orig Thu Apr 28 02:16:27 2005
> > +++ uaudio_pcm.c Tue Sep  6 23:10:32 2005
> > @@ -51,13 +51,13 @@ struct ua_info {
> >  struct ua_chinfo pch, rch;
> > };
> >
> > -static u_int32_t ua_playfmt[8*2+1]; /* 8 format * (stereo or mono) +
> > endptr */
> > +static u_int32_t ua_playfmt[12*2+1]; /* 8 format * (stereo or mono)
> > + endptr */
>
> Wouldn't it be better to use a named constant instead of the hardcoded
> value? We would only have to change one place instead of several in case we
> need to change it. Additionally it is more descriptive for the casual
> reader.
>
> Note: you forgot to change the number in the comments... in the recording
> part too.
>
> > -static struct pcmchan_caps ua_playcaps = {8000, 48000, ua_playfmt, 0};
> > +static struct pcmchan_caps ua_playcaps = {8000, 96000, ua_playfmt, 0};
>
> You also enhanced the capabilities for playing and recording. I'm not very
> familiar with this (sound system capabilities handling and the USB audio
> standard), but isn't this a property of the underlying hardware and should
> be probed?

I have some comments. The current USB sound driver only uses one isochronous 
buffer, that is restarted when it is completed. This will lead to a short 
period of time, +1ms, where no sound data is sent to the external USB device. 
Depending on the load of your computer, this can be as much as 50ms. So the 
USB sound driver must use 2 isochronous transfers. At the beginning one will 
queue both. Then these are restarted on completion. This will result in a 
constant-rate data stream to the external sound device, a minimum sound 
buffer equal to the size of the isochronous buffer, and possibly the sound 
will reach your ears with less delay. Little delay is a result of constant 
data rate. Currently only my USB driver will support that. If one tries that 
with the USB driver in *BSD, then it will crash at the first moment one gets 
a buffer underrun.

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510291246.51699.hselasky>