[ont.micro.mac] StartSound

info-mac@utcsrgv.UUCP (info-mac) (06/26/84)

Date: Mon, 25 Jun 84 11:24:09 pdt
From: Bill Croft <uw-beaver!croft@safe>
To: pallas@Pescadero
Subject: Re:  StartSound
Cc: croft@SUMEX-AIM.ARPA, info-mac@sumex, sumacc@sumex

  Date: Mon, 25 Jun 84 09:15:25 pdt
  From: Joseph I. Pallas <pallas@Pescadero>
  Subject: StartSound
  To: croft@safe
  
  The assembly implementation of StartSound (both the Apple version and yours)
  has the ASYNC flag commented out.  The effect of this seems to be that calls
  to StartSound do not return until the specified duration has passed.  I
  assume that you were just translating what was there, but do you have any
  idea why the ASYNC was commented out?  Is there a known problem mentioned in
  some document, or should I try changing it and see what happens?
  
  joe

Usually when one does ASYNC IO, several buffers are used so that you can
be filling one while the OS empties the other.  Since there is only one
buffer declared in the StartSound assembly helper,  Apple probably wanted
to reduce confusion and made the Write call synchronous.  Otherwise they
probably would have had to have a "TestSoundDone" routine and/or a 
"WaitSoundDone", etc.

If you want to do ASYNC IO, then setup your own ParamBlocks and use the
PBWrite call directly.  There is probably an example of this in the
SoundLab sample program.

info-mac@utcsrgv.UUCP (info-mac) (06/26/84)

Date: Mon, 25 Jun 84 12:37:43 pdt
From: Joseph I. Pallas <uw-beaver!pallas@Pescadero>
Subject: Re:  StartSound
To: croft@safe
Cc: info-mac@sumex, sumacc@sumex

	  From: Joseph I. Pallas <pallas@Pescadero>
	  Subject: StartSound
	  To: croft@safe
	  
	  The assembly implementation of StartSound (both the Apple
	  version and yours) has the ASYNC flag commented out.  The
	  effect of this seems to be that calls to StartSound do not
	  return until the specified duration has passed.
	

	From: Bill Croft <croft@safe>
	Subject: Re:  StartSound

	Since there is only one buffer declared in the StartSound
	assembly helper,  Apple probably wanted to reduce confusion and
	made the Write call synchronous.  Otherwise they probably would
	have had to have a "TestSoundDone" routine and/or a
	"WaitSoundDone", etc.

	If you want to do ASYNC IO, then setup your own ParamBlocks and
	use the PBWrite call directly.  There is probably an example of
	this in the SoundLab sample program.

Alas, the SoundLab program is the question, not the answer.  As an
exercise, I transliterated SoundLab into C.  The result works fine
(well, almost), except that SoundLab calls StartSound and expects it to
work asynchronously.  SoundLab, in fact, does implement a sort of
WaitSoundDone (very kludgily) by setting the duration to 1 and doing a
delay loop.  There's no question that the author of SoundLab believed
StartSound was asynchronous.  I'm willing to believe that someone
decided to change that after SoundLab was written, given that the last
date in its code is Jan. 1983; I just wondered whether there was any
explanation for the change.

joe