Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!iuvax!silver!sl161022 From: sl161022@silver.bacs.indiana.edu Newsgroups: comp.sys.mac.programmer Subject: How to play snds? Message-ID: <99000002@silver> Date: 24 Jan 89 17:15:00 GMT Organization: Indiana University CSCI, Bloomington Lines: 51 Nf-ID: #N:silver:99000002:000:2321 Nf-From: silver.bacs.indiana.edu!sl161022 Jan 24 12:15:00 1989 "There is no need for anyone to have a computer in their home." -- Ken Olsen, president of Digital, 1977 I program the Mac in assembly language, and appear to be the only person in all of Bloomington to do so. Thus, I have no recourse but to seek experienced programmers elsewhere. I've heard that the Inside Mac Volume V description of the Sound Manager is badly written and self-contradictory. After immersing myself in it these past few days, I have no trouble believing this. ALL I WANT TO DO is play a particular type 2 'snd ' resource, which is a digitally-sampled sound. No fancy pitch changes. No frills. Just play the damn thing as recorded! The 'snd ' is loaded into memory. It's not going anywhere. I'm willing to allocate my own section of memory for the SndChannel record. I know where that is too. My program has already been loaded into a nice cozy spot in the system heap, and I've redirected a trap to call my routine first, which calls the original trap and then returns to play the sound. I.e., whenever this particular trap gets called, my 'snd ' is to be played. The above routine is working just fine as it is. Right now, it merely does a _SysBeep whenever this trap is activated. But how in hell do you get the Sound Manager to play the sound? Any guidance on this question would be dearly appreciated. As a side question: I want this sound to be played whenever the user hits a key, but ONLY when TextEdit is active. When the user is in the Finder or anywhere else where keystrokes do not produce characters on the screen, I do NOT want my sound to be played. The way I'm doing this now is by redirecting the trap _TEKey. I haven't tested it in many different applications yet, but this seems to work as I want it too. Can anyone else think of a different, perhaps better, way? (Just for more options to consider.) Be seeing you... __________________________________________________________________ "May the forces of evil become confused on the way to your house." -- George Carlin Sincerely, Phaedrus (aka Colin Klipsch) sl161022@silver.bacs.indiana.edu Indiana University at Bloomington