Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!tut.cis.ohio-state.edu!cica!iuvax!bsu-cs!mithomas From: mithomas@bsu-cs.bsu.edu (Michael Thomas Niehaus) Newsgroups: comp.sys.mac.programmer Subject: Re: Playing sounds async: help Message-ID: <8013@bsu-cs.bsu.edu> Date: 30 Jun 89 20:31:24 GMT References: <7975@bsu-cs.bsu.edu> <2587@internal.Apple.COM> Organization: CS Dept, Ball St U, Muncie, IN, USA Lines: 41 In article <2587@internal.Apple.COM>, lsr@Apple.COM (Larry Rosenstein) writes: > > 2. Right now, I am allocating a new channel, then doing the SndPlay. I > > sound is done, and if it is then dispose the channel. But how can I > > find out if it is finished? > > You need to put a call back command in the channel after you play the > sound, and specify a call back routine when you create the channel. Your > call back routine will get called when the sound finishes. That sounds easy enough -- until you try it. Does anyone have a good example of writing a call-back routine for the Sound Manager? I have attempted it, but it is a shameful piece of work that, well, doesn't work. Ideal would be a little code segment that shows how to set declare/setup the call back routine (function declaration / access to global variables) and how to pass this to SndNewChannel. > Other things to watch out for. > You must lock the snd handle if you are playing it asynchronously SndPlay > will lock it for the duration of the call only, which will be shorter than > the duration of the sound (if you are using async sound). I am fortunate enough not to have run into this problem yet. My program doesn't do much in the line of memory allocation. > Finally, you can look at the sample unit that I wrote, which should be on > Info-Mac. (It also appeared recently on comp.sources.mac.) It was > written in Pascal and shows how to do all these things. I haven't received anything from comp.sources.mac for the last 3 months. And I am stuck on a lowly UUCP site, so if someone would be kind enough to mail it to me... Thanks for all the help. -Michael -- Michael Niehaus UUCP: !{iuvax,pur-ee}!bsu-cs!mithomas Apple Student Rep ARPA: mithomas@bsu-cs.bsu.edu Ball State University AppleLink: ST0374 (from UUCP: st0374@applelink.apple.com)