Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!umich!caen.engin.umich.edu!mingin!news From: billkatt@mondo.engin.umich.edu (billkatt) Newsgroups: comp.sys.mac.programmer Subject: Re: Need help with the new sound manager! Message-ID: <1990Mar11.174934.19476@caen.engin.umich.edu> Date: 11 Mar 90 17:49:00 GMT References: <900004@hpvcfs1.HP.COM> Sender: news@caen.engin.umich.edu (USENET News System) Reply-To: billkatt@mondo.engin.umich.edu (billkatt) Organization: Computer Aided Engineering Network (CAEN), University of Michigan Lines: 41 In article <900004@hpvcfs1.HP.COM> stevem@hpvcfs1.HP.COM (Steve Miller) writes: > >OK boys and girls, I'm about at my wits end on the subject of playing 'snd ' >resources on the Mac. I'm trying to use snd's in a simple game where the >sounds are played asynchronously while arcade style animation is occuring. >I'm using Think Pascal 2.01 under system 6.02 (finder 6.1) and my code is >structured like this: > [sorry, code deleted] > >What happens is that the sounds start out playing fine. After the first 3 to 6 >instances of the sound, it will stop playing them. Occasionally they will >start up again for 1 or 2 instances before permanently failing to play. > >Then the system will crash with an address error or with an >"internal error 4023" inside SndDisposeChannel at the end of the game: > >error := SndDisposeChannel(channel_ptr,TRUE); > > >If the sounds are played sychronously then everything is OK. I've tried many >variations on the above scheme with exactly the same results (not flushing >the commands, letting the system allocate the channel pointer, etc...) Since >I already found one bug in volume 5 of Inside Mac pertaining to the new >sound manager's use of Async. sound, I feel there might be something else I'm >missing. > Well, digitized sounds are [type 1, type 2 insert correct one here] sounds, and they not only have a "BufferCmd" in their structure to play the sound, but they also have a c ommand to add the sampled sounds synthesizer to the channel so it can play it. Each time you do a SndPlay it installs another copy of the sampled sound synthesizer in the channel. there are three ways to fix this: 1. dispose the channel and allocate another one before you play the sound. 2. remove the synthesizer from the SND resource and install one yourself (once) 3. Use a "SndDoCommand" with a BufferCmd to play just the sampled sound but not execute the synthesizer install. -Steve