Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Oct 2005 04:09:02 +0900 (JST)
From:      Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
To:        peo@intersonic.se
Cc:        freebsd-multimedia@freebsd.org, grattier@digigram.com, skywizard@MyBSD.org.my
Subject:   Re: uaudio and Digigram UAX220
Message-ID:  <20051027.040902.343165902.kazuhito@ph.noda.tus.ac.jp>
In-Reply-To: <435B4EBE.5030502@intersonic.se>
References:  <4358CB6F.2080901@intersonic.se> <20051021235357.0c169e05.skywizard@MyBSD.org.my> <435B4EBE.5030502@intersonic.se>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello,

> http://people.freebsd.org/~ariff/snd_RELENG_5_20051009_054.tar.gz

Though FreeBSD sound system came to be able 
to treat 24-bit sound stream with this patch,
USB audio device can't do yet.
On the other hand, UAX220 may be unable to play/record 8-bit 
and 16-bit sound stream directly, may be able to do 24-bit only.
I expect that it caused that problem.

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.
(Usage of this patch was written in http://docs.freebsd.org/cgi/getmsg.cgi?fetch=42785+0+archive/2005/freebsd-multimedia/20050904.freebsd-multimedia)

Sincerely yours,
Kazuhito HONDA

--- uaudio.c.orig	Thu Apr 28 02:16:27 2005
+++ uaudio.c	Tue Sep  6 23:10:09 2005
@@ -3690,7 +3690,7 @@ uaudio_init_params(struct uaudio_softc *
 	if ((sc->sc_playchan.pipe != NULL) || (sc->sc_recchan.pipe != NULL))
 		return (-1);
 
-	switch(ch->format & 0x0000FFFF) {
+	switch(ch->format & 0x000FFFFF) {
 	case AFMT_U8:
 		enc = AUDIO_ENCODING_ULINEAR_LE;
 		ch->precision = 8;
@@ -3723,6 +3723,22 @@ uaudio_init_params(struct uaudio_softc *
 		enc = AUDIO_ENCODING_ULINEAR_BE;
 		ch->precision = 16;
 		break;
+	case AFMT_S24_LE:
+		enc = AUDIO_ENCODING_SLINEAR_LE;
+		ch->precision = 24;
+		break;
+	case AFMT_S24_BE:
+		enc = AUDIO_ENCODING_SLINEAR_BE;
+		ch->precision = 24;
+		break;
+	case AFMT_U24_LE:
+		enc = AUDIO_ENCODING_ULINEAR_LE;
+		ch->precision = 24;
+		break;
+	case AFMT_U24_BE:
+		enc = AUDIO_ENCODING_ULINEAR_BE;
+		ch->precision = 24;
+		break;
 	default:
 		enc = 0;
 		ch->precision = 16;
@@ -3828,6 +3844,8 @@ uaudio_query_formats(device_t dev, u_int
 				fmt = AFMT_U8;
 			} else if (prec == 16) {
 				fmt = AFMT_U16_LE;
+			} else if (prec == 24) {
+				fmt = AFMT_U24_LE;
 			}
 			break;
 		case AUDIO_ENCODING_SLINEAR_LE:
@@ -3835,16 +3853,22 @@ uaudio_query_formats(device_t dev, u_int
 				fmt = AFMT_S8;
 			} else if (prec == 16) {
 				fmt = AFMT_S16_LE;
+			} else if (prec == 24) {
+				fmt = AFMT_S24_LE;
 			}
 			break;
 		case AUDIO_ENCODING_ULINEAR_BE:
 			if (prec == 16) {
 				fmt = AFMT_U16_BE;
+			} else if (prec == 24) {
+				fmt = AFMT_U24_BE;
 			}
 			break;
 		case AUDIO_ENCODING_SLINEAR_BE:
 			if (prec == 16) {
 				fmt = AFMT_S16_BE;
+			} else if (prec == 24) {
+				fmt = AFMT_S24_BE;
 			}
 			break;
 		case AUDIO_ENCODING_ALAW:
@@ -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 */
 
-static struct pcmchan_caps ua_playcaps = {8000, 48000, ua_playfmt, 0};
+static struct pcmchan_caps ua_playcaps = {8000, 96000, ua_playfmt, 0};
 
-static u_int32_t ua_recfmt[8*2+1]; /* 8 format * (stereo or mono) + endptr */
+static u_int32_t ua_recfmt[12*2+1]; /* 8 format * (stereo or mono) + endptr */
 
-static struct pcmchan_caps ua_reccaps = {8000, 48000, ua_recfmt, 0};
+static struct pcmchan_caps ua_reccaps = {8000, 96000, ua_recfmt, 0};
 
 #define UAUDIO_DEFAULT_BUFSZ		16*1024
 



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