home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / next / programm / 7094 < prev    next >
Encoding:
Text File  |  1992-11-08  |  2.5 KB  |  69 lines

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