From owner-freebsd-multimedia  Tue Mar 26 04:20:03 1996
Return-Path: owner-multimedia
Received: (from root@localhost)
          by freefall.freebsd.org (8.7.3/8.7.3) id EAA01368
          for multimedia-outgoing; Tue, 26 Mar 1996 04:20:03 -0800 (PST)
Received: from central.picker.com (central.picker.com [144.54.31.2])
          by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id EAA01305
          for <freebsd-multimedia@freebsd.org>; Tue, 26 Mar 1996 04:19:57 -0800 (PST)
Received: from ct.picker.com by central.picker.com with smtp
	(Smail3.1.28.1 #3) id m0u1Xc9-0004ruC; Tue, 26 Mar 96 07:12 EST
Received: from elmer.picker.com ([144.54.52.5]) by ct.picker.com (4.1/SMI-4.1)
	id AA27127; Tue, 26 Mar 96 07:11:57 EST
Received: by elmer.picker.com (SMI-8.6/SMI-SVR4)
	id HAA27753; Tue, 26 Mar 1996 07:16:01 -0500
From: rhh@ct.picker.com (Randall Hopper)
Message-Id: <199603261216.HAA27753@elmer.picker.com>
Subject: Speak Freely v6.0 on VoxWare/FreeBSD/Linux (was speak-freely-digest V1 #16)
To: speak-freely@fourmilab.ch
Date: Tue, 26 Mar 1996 07:16:01 -0500 (EST)
Cc: haver@harding.et.tudelft.nl, freebsd-multimedia@freebsd.org,
        linux-sound@vger.rutgers.edu
In-Reply-To: <199603252311.AAA20952@throop.fourmilab.ch> from "owner-speak-freely-digest@fourmilab.ch" at Mar 26, 96 00:11:13 am
Reply-To: rhh@ct.picker.com
Organization:  Picker International, CT Division
X-Mailer: ELM [version 2.4 PL24 PGP3 *ALPHA*]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Sender: owner-multimedia@freebsd.org
X-Loop: FreeBSD.org
Precedence: bulk

 >From: Bert Haverkamp <haver@harding.et.tudelft.nl>
 >Date: Wed, 20 Mar 1996 09:26:44 +0100
 >Subject: Re: speak-freely-digest V1 #16
 >
 >Hello SF-users,
 >
 >I'm a starting SF'er and am running speakfreely 6.0 both under windows
 >3.1 and Linux 1.2.13. The linux part is giving me some trouble. I have
 >compiled the files succesfully, but sfspeaker isn't able to give me
 >any sound. I tried it a few times with an echostation, using the debug
 >option -d I saw sound comming in (It didn't get to the speaker
 >though!), only once. After that, sfspeaker didn't recieve any more messages.
 >
 >I'm using a soundblaster compatible card, that works fine with the
 >voxware 3.0.1 sounddriver I installed.
 >Does anyone know what I'm doing wrong? suggestions are welcome.
 >The output of sfspeaker -d is the folowing:
 >
 >>sfspeaker -d
 >sfspeaker: opening audio device.
 >sfspeaker: playing 332 GSM compressed bytes from throop.fourmilab.ch.
 >Tick: 10.00...
 >sfspeaker: releasing audio device.
 >Tick: 10.00...
 >Tick: 10.00...
 >Tick: 10.00...
 >Tick: 10.00...

     I had similar problems on FreeBSD 2.1.0 (VoxWare 3.0-beta-950506) with
a Sound Blaster 32.  These are the two main patches I had to make to Speak
Freely to get it to work for me (from memory as I'm not on my PC now):

1) Comment out the setting to put the device in non-blocking mode
   (soundbyte.c):

            if (ioctl(audiof, SNDCTL_DSP_NONBLOCK, NULL) < 0) {
                perror("SNDCTL_DSP_NONBLOCK");
                return FALSE;

   This was causing soundbyte.c:soundplay to hang trying to write the first
   buffer to the audio device.  It appears that the DMA transfer to the
   card isn't even being initiated in non-blocking mode, and the write()
   request returns having written 0 bytes of the buffer to the sound card,
   resulting in an infinite loop.  The "Tick" message is just caused by the
   signal handler, and your sfspeaker is essentially hung.

2) As I recall, the other problem I had was caused by the first hack. 
   soundbyte.c:soundflush's read() was blocking.  Commented that out and
   wasn't any the worse for it.  Seemed to work fine.

     One other strange problem I observed though.  The last DMA transfer to
the card wasn't being flushed until the close() to the audio device was
issued when the release timer expired.  Not being real familiar with
Voxware workings, I don't know what the right fix for this is.  I shortened
the timer to 2 seconds which helps but of course doesn't fix it.  I'll go
back to looking at better solutions to the Speak Freely/Voxware hacks once
I get the UDP-over-proxy-TCP tunnel utility I'm writing done (hate this
idea, but I'll take what I can get).

     I'd be interested in hearing from the FreeBSD/Linux mailing lists
whether there are more reasonable fixes given the 3.0beta and the current
Voxware drivers.

                                                Randall Hopper
                                                rhh@ct.picker.com