Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!rochester!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!jp57+ From: jp57+@andrew.cmu.edu (Jefferson Provost) Newsgroups: comp.sys.mac.programmer Subject: Re: Simultaneous Sampled Sounds w/ System 7 Message-ID: Date: 3 May 91 18:15:13 GMT References: <8c7M7sW00WBNE1N7Fv@andrew.cmu.edu>, <13295@goofy.Apple.COM> Organization: Carnegie Mellon, Pittsburgh, PA Lines: 46 In-Reply-To: <13295@goofy.Apple.COM> On 02-May-91 in Re: Simultaneous Sampled So.. user Jim Reekes@applelink.app writes: >I'm probably going to start a controversy with this, but I don't think you >should use SndPlayDoubleBuffer. It was written to support playing sound >from disk. If you have something that is very similar, then SndPlayDoubleBuffer >might work out for you. Otherwise, I recommend just using bufferCmds. The >limitations of SndPlayDoubleBuffer make it less than you might expect. It's >no more "low level" than a bufferCmd. One thing SndPlayDoubleBuffer cannot >handle is different sample rates. Once you start a sound, you have to stick >with that sample rate. If you just sent a set of bufferCmds, this would not >be a limitation. Under normal circumstances I would just use bufferCmds, but in this case only SndPlayDoubleBuffer has been able to give me what I need on systems 6.0.7 and beyond. I don't need to change the sample rate in the middle of a sound. I _do_, however, need to know, as precisely and accurately as possible, the time at which the sound started. With regular bufferCmds on system 6.0.7, I was unable to do this. Sending a bufferCmd with SndDoImmediate and marking the time just before callind SndDoImmediate, I found that the delay to the start of the sound was anywhere from 8 to 20ms, even with the network disconnected. Using SndPlayDoubleBuffer, I've managed to get it down to a constant 2ms. In order to do this, I make the first of the double buffers null, and make the second buffer contain the entire sound that I want to play, and set its flags to dbLastBuffer. All the DoubleBackProc does is mark the time when it's called. My feeling all along has been that by trying to mix sounds, I would lose accuracy or precision or both in marking the starting time of the sound that begins second. I decided to at least try, however. So what's the verdict? Can it be done with SndPlayDoubleBuffer or not? Jeff +-------------------------------------------+ |Jefferson Provost | jp57+@andrew.cmu.edu| | Psychology | (412) 268-3139 | | Carnegie Mellon |---------------------| | Pittsburgh, PA 15213|-=-=-=-=-=-=-=-=-=-=-| +-------------------------------------------+