Subject: auich and mpg123 (was Re: uaudio success)
To: Mihai Chelaru <mihai@romtelenet.org>
From: enami tsugutomo <enami@but-b.or.jp>
List: current-users
Date: 01/12/2002 10:13:05
> bash-2.04# ls -l audio
> lrwx------  1 root  wheel  6 Aug 19 00:32 audio -> audio0
> bash-2.04# rm audio
> bash-2.04# ln -s sound0 audio
> bash-2.04# audioctl -w play=44100,2,16,slinear_le
> audioctl: set failed: Invalid argument

As someone noted, you can't set auich's sampling rate other than 48000
(and default isn't).  So, the above audioctl failed.

The reason that you need to use /dev/sound instead of /dev/audio is
the latter trys to reset parameters to default value (8000 for
sampling rate) on device open.

Also, you need to set record sampling rate since MI open routine trys
to set both play and record sampling rate even the device is opend
only for write.

Finally, there was a bug in auich.c rev. 1.5 or former that inhibits
encoding query which mpg123 does.

So, first make sure your kenrel have auich.c of rev. 1.6 (or, apply
attached patch).  Then, do

% audioctl -w play=48000,2,16,slinear_le
% audioctl -w record=48000,2,16,slinear_le
% mpg123 -a /dev/sound0 -r 48000 your-mp3-file.mp3

enami.

Index: auich.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/auich.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- auich.c	2001/11/13 07:48:41	1.5
+++ auich.c	2002/01/12 00:13:42	1.6
@@ -467,14 +467,17 @@
 int
 auich_query_encoding(void *v, struct audio_encoding *aep)
 {
-	switch (aep->index) {
+
 #if 0 /* XXX Not until we emulate it. */
+	switch (aep->index) {
 	case 0:
 		strcpy(aep->name, AudioEulinear);
 		aep->encoding = AUDIO_ENCODING_ULINEAR;
 		aep->precision = 8;
 		aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
 		return (0);
+#else
+	switch (aep->index + 1) {
 #endif
 	case 1:
 		strcpy(aep->name, AudioEmulaw);