From: jazz@netcom.com (David C. Navas)
Subject: Re: Audio HARDWARE bug?
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Mon, 14 Dec 1992 20:41:23 GMT

In article <Bz9Arr.5vF@cck.coventry.ac.uk> csg019@cch.coventry.ac.uk (-~=Zaphod=~-) writes:
>I had this problem for some time, the sound system generates interupts
>WHEN THE DMA REGISTERS HAVE BEEN LOADED. *Not when a sample finishes.
>Apparently they are copied to hidden  backup registers.

Yep, this I know.

>The way to tell if your samples has finished is to load a zero length sample
>after loading the address of the first sample.

I've actually been loading a four-byte length sample -- is it legal to load a
zero length sample?  Hmm, interesting idea....  Loading a 2byte sample, oddly
enough, gave me VERY BAD results....  Probably too many interrupts (I replayed
this sample endlessly -- if I had gotten the stuff I'm about to explain
working, I would have just poked the output and left it at that....).
Missing interrupts is bad for my state machine....

OKAY.  Let's try this again.  I absolutely, positively want to be interrupted
when my sample starts.  I've designed my state machine to anticipate it....
Audio state preconditions:  dma off, interrupts off.  I won't guarantee
how long they've been off, but they are off.  The rest of the state is the
same as whatever state audio.device leaves the audio in when the channel
is allocated.  BTW -- I've installed my own interrupt routine as well, of
course.

load data ptr, length, period, volume.
Turn interrupts on.
Clear intreq of audio intreqs (just in case!)
Turn dma on.

SUBSEQUENT to dma being turned on AND before the VPrintf that immediately
follows the instruction I receive two interrupts. -sometimes-.  If I clear
the intreq at the END of my interrupt routine instead of the beginning it's
about 1 out of 9.  Otherwise it's about 1 out of three.

I can Delay() as long as you'd like before turning dma back on (I tried half
a second, which seems long enough to me!) without effecting the problem.

So far I've gotten the following email:
	1) Audio is hosed (2)
	2) There's nothing wrong with the audio (1)
	3) You're supposed to receive two interrupts -- one at the start
		one at the end (1)

I remain confused why it is when I poke one bloody register I get two
bloody interrupts....  It seems a number of other people could use some
real expert advice on the audio hardware as well.  Oh Mike Sinz!?!

BTW -- whoever designed the audio h/w shutdown/restart stuff should be shot.
My opinion :)

>This drove me crazy for about 3 months, before someone at Argonought
>software told me how to do it.

I've got until Jan. 26th to get something to work.  Preferrably I'd like
to be writing other modules and solving some other conflicts as well
(DICE vs. SASC 6.x)

>****\\\X//********Steven Haggerty**csg019@uk.ac.cov.cck ok?*****\\\X//*********

Thanks for responding, however.  Hopefully this will lead to a public
discussion about the audio hardware, which, to my limited knowledge, hasn't
happened yet -- at least, it's different from the RTG discussions that are
going on ;)

-- 
David Navas                                   	jazz@netcom.com
						dnavas@oracle.com
"If it wasn't for the fact that I worked so hard, I'd be a very lazy person."