home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!pageworks.com!world!eff!sol.ctr.columbia.edu!usc!zaphod.mps.ohio-state.edu!swrinde!network.ucsd.edu!news!cod!frantzen
- From: frantzen@nosc.mil (Louise E. Frantzen)
- Subject: Strange things afoot with SndPlay
- Message-ID: <1992Nov17.211757.16475@nosc.mil>
- Keywords: SndPlay sound THINK C Sound Manager
- Organization: Naval Ocean Systems Center, San Diego, CA
- Date: Tue, 17 Nov 1992 21:17:57 GMT
- Lines: 51
-
-
- Hello everyone,
-
- I am wondering if someone can explain to me why the following call to SndPlay is not
- working. I am programming in THINK C 5.0 on a IIci running 7.1. The following
- is a part of my program.
-
- main()
- {
- SndChannelPtr chan_ptr;
- SoundHeader Header;
- Handle GaussHndl;
- OSErr myErr;
- other generic declarations as needed in program
-
- GaussHndl = NewHandleClear(442);
-
- calculations for 400 bytes of sound data
-
- myErr = SetupSndHeader(GaussHndl, NUM_CHANNELS,SAMPLE_RATE,SAMPLE_SIZE,COMP
- BASE_FREQ,400,HEADER_LEN_PTR);
-
- code to put 400 bytes of sound data starting at *(*GaussHndl + 42) = 1st data
- (which I've checked and everything gets put in its proper place)
-
- iRsrc = UniqueID( 'snd ');
- AddResource( GaussHndl, 'snd ', iRsrcID, "\pGaussian Noise" );
-
- MoveHHi (GaussHndl);
- HLock (GaussHndl);
- myErr = SndPlay( nil, GaussHndl, TRUE ); /* program BOMBS right here */
- HUnlock (GaussHndl);
-
- DisposHandle( GaussHndl);
- } /* end */
-
- My question is why does SndPlay not behave? According to IM VI p. 22-35,
- this is all I should have to do to play a sound resource. I have tried
- other options which do not make the program bomb directly but don't play
- the sound, either. Many times the program won't bomb, say if I've allocated
- my own channel instead of passing SndPlay nil, but then I try to run it
- again and get "Out of memory" error from THINK C or even a system error.
-
- I am really getting to the end of my inventiveness, here, even after looking
- at all the sample code I can get my hands on. Please help!
-
- -------------------------------------------------------------------------
- --
- Louise E. Frantzen NRaD, San Diego CA "And if you try to cut me down
- frantzen@nosc.mil I know that you'll succeed "
- (619) 553-7863 - A. Lennox
-