Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!agate!math.berkeley.edu!chopp From: chopp@math.berkeley.edu Newsgroups: comp.sys.mac.programmer Subject: Asynchronous sound help? Message-ID: <1990Aug14.061951.25766@agate.berkeley.edu> Date: 14 Aug 90 06:19:51 GMT Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44) Reply-To: chopp@math.berkeley.edu () Organization: Math Dept., UC Berkeley Lines: 29 I would like to play a sound asyncronously. I have Inside Mac V in my lap and have written the following code using TC 4.0. Two things are wrong. First, control is not returned to the program immediately (i.e. not played asynchronously). Second, the SndDisposeChannel call causes a bomb. Here's the code: #include void CSoundPane::DoClick(Point hitPt, short modifierKeys, long when) { Handle theSound; SndChannelPtr chan; theSound = GetResource('snd ', 2214); chan = NULL; SndNewChannel(&chan, sampledSynth, initSRate22k, NULL); SndPlay(chan, theSound, TRUE); /* Drawing stuff */ SndDisposeChannel(chan, FALSE); ReleaseResource(theSound); } Thanks in advance, Dave Chopp chopp@math.berkeley.edu