Thread View: comp.sys.next.programmer
1 messages
1 total messages
Started by slugg jello
Sun, 08 Nov 1992 17:43
Problems with Sound's didPlay: method (delegate), Sound optimization
Author: slugg jello
Date: Sun, 08 Nov 1992 17:43
Date: Sun, 08 Nov 1992 17:43
56 lines
2653 bytes
2653 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads