Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Apr 1999 09:42:38 -0400
From:      Randall Hopper <aa8vb@ipass.net>
To:        Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
Cc:        Luigi Rizzo <luigi@labinfo.iet.unipi.it>, freebsd-multimedia@FreeBSD.ORG
Subject:   Re: Reason why fxtv can't capture audio with Luigi's sound code...
Message-ID:  <19990417094238.A3349@ipass.net>
In-Reply-To: <19990412082119.A91030@internal>; from Andre Albsmeier on Mon, Apr 12, 1999 at 08:21:19AM %2B0200
References:  <19990412082119.A91030@internal>

next in thread | previous in thread | raw e-mail | index | archive | help
     Hi.  Yes, in the Voxware world, the way to test whether the soundcard
supported an audio format was to try to activate it, and verify that the
return value of the ioctl matched what you passed in.  If it didn't, then
it wasn't supported.  This is why Fxtv does this check for these sound
driver ioctls:

     SNDCTL_DSP_SETFRAGMENT
     SNDCTL_DSP_SETFMT
     SOUND_PCM_WRITE_CHANNELS
     SOUND_PCM_WRITE_RATE

     It looks like this is just a small compatibility wrinkle in Luigi's
drivers that hopefully is easy to smooth out.  Given that the change you
described below got it working, then SNDCTL_DSP_SETFMT is the only one of
the four ioctl's not returning the requested value if the request succeeds
(for the format you're trying to establish at least).
  
     (Ccing Luigi in case he missed your post.)

Randall

Andre Albsmeier:
 |I am using fxtv-0.48 together with an AWE32 soundcard and Luigi's snd
 |code (pcm1). When trying to capture audio data, this fails with the msg:
 |
 |	Selected sample format not supported (on this soundcard).
 |
 |I assumed this was wrong and applied the following patch to tvaudio.c
 |so the case that parm != parm_new is simply ignored:
 |
 |--- tvaudio.c.orig	Sat May 30 17:47:07 1998
 |+++ tvaudio.c	Mon Apr 12 08:02:42 1999
 |@@ -293,12 +293,14 @@
 |         error = True;
 |         goto RETURN;
 |     }
 |+#if 0
 |     if ( parm != parm_new ) {
 |         sprintf( S_error_msg, "Selected sample format not supported (on "
 |                               "this soundcard)." );
 |         error = True;
 |         goto RETURN;
 |     }
 |+#endif
 | 
 |     parm_new = parm = snd->stereo ? 2 : 1;
 |     if ( ioctl( *dsp_fd, SOUND_PCM_WRITE_CHANNELS, &parm_new ) < 0 ) {
 |
 |
 |Now audio capturing worked without any problems.
 |
 |If I understand the code fragment above correctly, it tries to verify
 |that the recording settings selected by the user have been accepted
 |by the kernel/soundcard. This is done by assuming that the call 
 |ioctl( *dsp_fd, SNDCTL_DSP_SETFMT, &parm_new ) returns the new
 |settings in parm_new. Either this assumption is wrong (then the above
 |code should simply be removed from fxtv) or the returned value is not
 |correct. If the latter is correct, the error might be in the following
 |part of /sys/i386/isa/snd/sound.c:
 |
 |
 |    case SNDCTL_DSP_SETFMT:	/* sets _one_ format */
 |	/*
 |	 * when some card (SB16) is opened RDONLY or WRONLY,
 |	 * only one of the fields is set, the other becomes 0.
 |	 * This makes it possible to select DMA channels at runtime.
 |	 */
 |	if (d->play_fmt)
 |	    d->play_fmt = *(int *)arg ;
 |	if (d->rec_fmt)
 |	    d->rec_fmt = *(int *)arg ;
 |	splx(s);
 |	if (ask_init(d))
 |	    *(int *)arg = d->play_fmt ;
 |	break ;
 |
 |
 |Shouldn't this honor d->rec_fmt also in the case for returning
 |the value? E.g.:
 |
 |        if (ask_init(d)) {
 |	    if (d->play_fmt)
 |	        *(int *)arg = d->play_fmt ;
 |	    if (d->rec_fmt)
 |	        *(int *)arg = d->rec_fmt ;
 |        }


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message




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