Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!zaphod.mps.ohio-state.edu!think.com!yale!eagle.wesleyan.edu!rcook From: rcook@eagle.wesleyan.edu Newsgroups: comp.sys.mac.programmer Subject: tough Sound Manager questions Message-ID: <1991Apr29.163227.42312@eagle.wesleyan.edu> Date: 29 Apr 91 21:32:26 GMT Organization: Wesleyan University Lines: 44 Inside Mac and the tech notes say that you should only hold on to a channel while it is making a sound. This seems reasonable; you just put a callback in that sets a flag to delete the channel at the next available opportunity. Nevertheless, I have some questions about this method. (I am only concerned with sampled sounds, though that really shouldn't matter, should it?) 1) What happens if you are playing a long sound and your program decides to call sysBeep? Since before 6.0.7 you can only have one channel open, does your channel get trashed? If it does get trashed, what happens when your callback comes along and tries to dispose of your channel? 2) Suppose you are clever and somehow make sure that your program newver calls SysBeep when it has a channel going. What if some sort of background task uses the all powerful Notification Manager to flash the apple menu and make a sound while one of yours is playing? 3) What if you are writing a game where you need to play a sound after just about every keystroke, and even in between keystrokes, so that you need to play a new sound before the last one is finished? Do you use SndDoImmediate commands, SndDoCommand, or just SndPlay? Could you possibly have more than one callbackCmd in the queue at the same time? I looked at the Sound Manager source code example on Apple.com and it uses SndPlay (and works a hell of a lot better than my attempt :-), though once it did manage to go silent for a few seconds, but then sprang back to life, with no problems since. This source code I mention is very well commented and quite valuable to the Mac programming community, but when you play a new sampled sound when an old one is still playing, the old one stops and the new one starts immediately. In my case, this is what I wanted, but what if you wanted the first one to finish before starting the second? Do you have to remove the call back command that is (I assume) sitting in the queue before you put a new buffer command in the queue followed by a new call back command? Will IM-VI explain all this accurately, unambiguously, and clearly? I don't think these are easy questions to answer. I hope someone out there can. If you want, I'll post back the most informative of the e-mail I receive on the subject. Thanks. rc ------------------------ Randall Cook rcook@eagle.wesleyan.edu ------------------------