home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!news.u.washington.edu!uw-beaver!uw-coco!nwnexus!mouthers!slugg
- From: (slugg jello)
- Newsgroups: comp.sys.next.programmer
- Subject: Problems with Sound's didPlay: method (delegate), Sound optimization
- Message-ID: <1992Nov8.174353.950@mouthers.nwnexus.wa.com>
- Date: 8 Nov 92 17:43:53 GMT
- Article-I.D.: mouthers.1992Nov8.174353.950
- Sender: slugg@mouthers.nwnexus.wa.com
- Reply-To: slugg@mouthers.wa.com
- Organization: Mouthing Flowers
- Lines: 56
-
- orion@proxima.cc.colorado.edu writes:
-
- > I am working on a Juke Box program and am having a couple of problems.
- >
- > First, I do not always receive the didPlay: message that should be sent by
- > a sound when it stops playing. This causes my program to stop, and not play
- > the next song. This behavior is erratic, i.e. sometimes I get the message,
- > sometimes I don't. The more I am doing elsewhere (the more in the background
- > the program is) the less likely it is to get the message).
- >
- > Second, I am getting a lot of drop outs when I play the songs. This may be
- >
- > unavoidable as the songs are stored in compressed format on a NFS mounted
- > drive, but any suggestions would be appreciated.
- >
-
- I've had similar problems to yours. My repeated sounds were receiving TIMEOUT
- errors after a few repeats. The problem for me seem to occur only with sounds
- I recorded using the microphone. I discovered a solution by looking at the 3.0
- release notes (/NextLibrary/Documentation/NextDev/ReleaseNotes/Sound.rtf) where
- it says:
-
- "Compressed soundfiles must have either 22 kHz or 44 kHz sampling rates in
- order to be playable without first decompressing. In particular, an 8 kHz
- CODEC file (such as from the built-in microphone) must be first resampled to 22
- kHz (e.g., by SNDConvertSound()) before compressing. Since ATC format
- discards empty portions of the sound spectrum, upsampling does not increase the
- file size as you might expect."
-
- I have fixed the problem by converting those sounds (at runtime) to a different
- format before playing them:
-
- if ([mySound samplingRate] < SND_RATE_LOW)
- {
- int err;
-
- err = [mySound convertToFormat
- :SND_FORMAT_LINEAR_16
- samplingRate:SND_RATE_LOW
- channelCount:2];
- #ifdef DEBUG
- fprintf(stderr,"Converted? %s\n",SNDSoundError(err));
- #endif
-
- }
-
- Performance still does not seem as good as with sounds that don't need to be
- converted. I wonder whether some shenanegans are occuring where the main
- processor is being used instead of the DSP.
-
- But this does seems to fix the main problem.
-
-
- --
- Doug Kent
- slugg@mouthers.wa.com
-