2fmlcalls@kuhub.cc.ukans.edu (04/30/91)
In article <8c7M7sW00WBNE1N7Fv@andrew.cmu.edu>, jp57+@andrew.cmu.edu (Jefferson Provost) writes: > > > Hi, > > Have any of you had any success with getting two sampled sounds to be > mixed and played together with system 7.0? <deleted> > Thanx, > > Jeff I have had it working for a couple months now with 6.07 and System 7. I'm afraid I do it on a higher level however. I just allocate two sound channels with two different vars. One of them I call with SndPlay, but the other I send buffer commands to. Despite the inconvenience of the sound volumes dropping when both sounds are playing, everything seems to work without hitch. john calhoun
jp57+@andrew.cmu.edu (Jefferson Provost) (04/30/91)
Hi, Have any of you had any success with getting two sampled sounds to be mixed and played together with system 7.0? The new Sound Manager docs claim that the new sound manager has the ability to play multiple channels of sampled sound simultaneously, but I can't seem to get it to work. I allocate a channel and play a sound, and then, while it is still playing, I allocate another channel and play another sound, but the second channel seems to overide the first channel and the first sound gets cut off. I'm playing the sounds with SndPlayDoubleBuffer() (I need low level control), and I've tried various initializations for the sound channels (initSRate22k, initNoSRC). I've also tried the first sound in the right stereo channel and the second sound in the left stereo channel with the same result. Has anyone gotten this to work, or found some convincing proof that it definitely doesn't work? Thanx, Jeff +-------------------------------------------+ |Jefferson Provost | jp57+@andrew.cmu.edu| | Psychology | (412) 268-3139 | | Carnegie Mellon |---------------------| | Pittsburgh, PA 15213|-=-=-=-=-=-=-=-=-=-=-| +-------------------------------------------+
dawg6844@uxa.cso.uiuc.edu (Dan Walkowski) (05/01/91)
jp57+@andrew.cmu.edu (Jefferson Provost) writes: >and then, while it is still playing, I allocate another channel and play >another sound, but the second channel seems to overide the first channel >and the first sound gets cut off. I'm playing the sounds with >Has anyone gotten this to work, or found some convincing proof that it >definitely doesn't work? I can give you proof that it does work. Get Diamonds 1.5 from sumex-aim. Masterful use of sound. (Though the music does get a bit old after a while) -- _______________________________________________________________________________ Dan Walkowski | To understand recursion, Univ. of Illinois, Dept. of Comp. Sci. | you must first understand recursion. walkowsk@cs.uiuc.edu |
jmunkki@hila.hut.fi (Juri Munkki) (05/01/91)
In article <8c7M7sW00WBNE1N7Fv@andrew.cmu.edu> jp57+@andrew.cmu.edu (Jefferson Provost) writes: >The new Sound Manager docs claim that the new sound manager has the >ability to play multiple channels of sampled sound simultaneously, but I >can't seem to get it to work. I allocate a channel and play a sound, >and then, while it is still playing, I allocate another channel and play >another sound, but the second channel seems to overide the first channel >and the first sound gets cut off. I'm playing the sounds with >SndPlayDoubleBuffer() (I need low level control), and I've tried various >initializations for the sound channels (initSRate22k, initNoSRC). I've >also tried the first sound in the right stereo channel and the second >sound in the left stereo channel with the same result. I use one channel with SndPlayDoubleBuffer and if another application uses SysBeep, the beep is clearly audible, although both sounds drop 50% in volume. My guess is that either your program has bugs, or the sound manager doesn't support two channels of SndPlayDoubleBuffer. Try your program with just one channel of double buffered sound and one normal channel to see if it works. If it does, you can suspect the sound manager feature. If it doesn't work, then your code must be at fault. As long as you are using SndPlayDoubleBuffer, why don't you mix your sounds yourself using just one SndPlayDoubleBuffer? That's what I'm doing to get two sound channels. Your routines will probably be much faster than the more general sound manager mixing routines. ____________________________________________________________________________ / Juri Munkki / Helsinki University of Technology / Wind / Project / / jmunkki@hut.fi / Computing Center Macintosh Support / Surf / STORM / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REEKES@applelink.apple.com (Jim Reekes) (05/03/91)
In article <8c7M7sW00WBNE1N7Fv@andrew.cmu.edu>, jp57+@andrew.cmu.edu (Jefferson Provost) writes: > > > > Hi, > > Have any of you had any success with getting two sampled sounds to be > mixed and played together with system 7.0? > > The new Sound Manager docs claim that the new sound manager has the > ability to play multiple channels of sampled sound simultaneously, but I > can't seem to get it to work. I allocate a channel and play a sound, > and then, while it is still playing, I allocate another channel and play > another sound, but the second channel seems to overide the first channel > and the first sound gets cut off. I'm playing the sounds with > SndPlayDoubleBuffer() (I need low level control), and I've tried various > initializations for the sound channels (initSRate22k, initNoSRC). I've > also tried the first sound in the right stereo channel and the second > sound in the left stereo channel with the same result. The sound manager does support multiple channels of sampled sounds on all Macs running System 6.0.7 or later, except for the Plus, SE, and Classic. 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. Also, the only init param that makes a difference is initNoInterp. All of the other params are overridden by the bufferCmd you send. Jim Reekes E.O., Macintosh Toolbox Engineering
jp57+@andrew.cmu.edu (Jefferson Provost) (05/04/91)
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|-=-=-=-=-=-=-=-=-=-=-| +-------------------------------------------+