[comp.sys.mac.programmer] Help with SndPlay being slow...

hellerst@husc7.HARVARD.EDU (Joe Hellerstein) (05/07/90)

Could somebody out there help me out with this?  I've read IM-V, the
Sound Manager Update, etc, and I'm out of luck.

I want to write a very simple application that will let you type in text and 
will play a (different) sound for each key you press, as it displays the 
text on the screen.

	What I'd like to do is have some of the sounds be synchronous (for
the vowel keys) and have the rest of the sounds get cut off by the 
next sound (if they're not done already.)  The "Sound Master" cdev/INIT cuts
things off like this.

	I've got it all working, except that the 
'SndPlay(chan, sndhandle, TRUE)' call seems to chew up a lot of CPU time
before it returns.  If I hold down a non-vowel key with a long sound 
associated, the sound *does* get cut off, but the repeat rate is like .5 secs.
It's not just the repeat rate, though -- if I type different keys very quickly,
the sounds (and the text) only come a litle while later.

	If I comment out the SndPlay call, the text appears on the screen as
quickly as usual, so that's certainly the cause of it.  Am I doing
something wrong with the 'snd ' resources?  I've got their "Preload"
and "Locked" bits set.  Is SoundMaster faster because it uses FSSD
files, rather than 'snd ' resources?  Or because it's an INIT?

	I'm using THINK C 4.0 on a MacPlus with 2.5 meg, and have tried
it with only GateKeeper and GateKeeper Aid INITs.

	Much thanks in advance to anyone who helps out with this.
The program, BTW, is part of a composition for an electronic music class...


Please send e-mail, as I don't read this newsgroup regularly.

Joe Helerstein