[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Playing a "snd " resource f
- To: info-mcl@cambridge.apple.com
- Subject: Re: Playing a "snd " resource f
- From: lynch@ils.nwu.edu
- Date: Wed, 6 Oct 93 15:49:20 CDT
> Subject: Time:5:24 PM
> OFFICE MEMO Playing a "snd " resource from disk Date:10/5/1993
>Can anyone clue me into why this attempt to use SndStartFilePlay doesn't work?
>When I use SndPlay instead of SndStartFilePlay, it works fine. I ultimately
>need to allow other stuff to process while the sound is playing.
>
>(defun play-sound-resource (resourceID)
> (rlet ((channel :pointer)
> (sndChannel :sndChannel))
> (setf (%get-ptr channel) sndChannel)
> (#_SndNewChannel channel 0 0 (%null-ptr))
> (#_SndStartFilePlay
> (%get-ptr channel)
> 0
> resourceID
> (#_SizeResource (#_GetResource "snd " resourceID))
> (%null-ptr)
> (%null-ptr)
> (%null-ptr)
> nil)
> (#_SndDisposeChannel (%get-ptr channel) nil)))
Well, one thing for sure, you're trashing the channel before the sound ever
has a chance...
You need to delay the last line until the sound is done...
Either create a sound channel at startup for use throughout the program, or
register the channel and its start time somewhere and periodically check:
time has elapsed from start time so the sound has started AND
that the channel is not busy
--
--
-- "TANSTAAFL" Rich lynch@ils.nwu.edu