home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pageworks.com!world!eff!sol.ctr.columbia.edu!spool.mu.edu!olivea!charnel!rat!zeus!joule.elee.calpoly.edu!tjohnson
- From: tjohnson@joule.elee.calpoly.edu (Todd Johnson)
- Newsgroups: comp.sys.mac.programmer
- Subject: Problems with sound (again)
- Message-ID: <1993Jan24.192848.159533@zeus.calpoly.edu>
- Date: 24 Jan 93 19:28:48 GMT
- Sender: news@zeus.calpoly.edu
- Distribution: na
- Organization: California Polytechnic State University, San Luis Obispo
- Lines: 38
-
- Newsgroups: comp.sys.mac.programmer
- Subject: Another sound problem
- Summary: System 6 barfs
- Followup-To:
- Distribution: na
- Organization: California Polytechnic State University, San Luis Obispo
- Keywords: snd, System 6
-
- I use the following function to play sounds:
-
- void play_sound(short res_id)
- {
- SndChannelPtr aChannel;
- OSErr err;
- Handle itsSound;
-
- itsSound = GetResource('snd ', res_id);
- if (itsSound != NULL)
- {
- aChannel = NULL;
- err = SndNewChannel(&aChannel, sampledSynth, initMono, NULL);
- if (err == noErr)
- SndPlay(aChannel, itsSound, FALSE);
- SndDisposeChannel(aChannel, FALSE);
- ReleaseResource(itsSound);
- }
- }
-
- This works fine as long as I run it under System 7. However, when I
- compile and run under System 6, it crashes the machine. Ideally, I
- would like to have a function to play sounds that works under both
- operating systems. What am I doing wrong?
-
-
- Todd Johnson tjohnson@joule.elee.calpoly.edu
- ####################################################################
- I love to go to the park and watch the kids run around and scream.
- Of course, they don't know I'm using blanks. Emo Phillips
-