Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!tank!fri0 From: fri0@tank.uchicago.edu (Christian E. Fritze) Newsgroups: comp.sys.mac.programmer Subject: SndNewChannel crashes my program! Keywords: c, Sound, snd, code Message-ID: <7605@tank.uchicago.edu> Date: 13 Feb 90 02:05:10 GMT Distribution: usa Organization: University of Chicago Lines: 38 Dear Netters! I'm a beginning Mac programmer trying to use the sound manager routines to play some sampled sound. Why does the following code (an excerpt from my THINK C 4.0 program) break my Mac at the indicated function call? Odd address, says the debugger; sound doesn't play. IMV says that passing a NIL pointer to SndNewChannel tells SndNewChannel to allocate a channel for you and return it. In fact, my code is almost identical to a Pascal sample I found on GEnie. What's going on here? ========================================================================= #include #define NULL 0L main() { SndChannelPtr soundPtr; Handle soundHndl; OsErr Check; soundHndl = GetResource('snd ',16658); /*This call does it... */ Check=SndNewChannel(&soundPtr,sampledSynth,initSRate22k,NULL); SndPlay(&soundPtr,soundHndl,TRUE); SndDisposeChannel(&soundPtr,FALSE); DisposPtr(soundPtr); DisposHandle(soundHndl); } Thanks for any help. Hope this isn't a really STUPID question. (Running SE, 4MB, Sys 6.0.2)