home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 14162 < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.9 KB  |  42 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!rutgers!psinntp!psinntp!iscnvx!enterprise!news
  2. From: merrick@aic.lockheed.com (Darrell Merrick)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: AIFF and 'extended' type
  5. Message-ID: <1992Aug18.155902.29962@enterprise.rdd.lmsc.lockheed.com>
  6. Date: 18 Aug 92 15:59:02 GMT
  7. Sender: news@enterprise.rdd.lmsc.lockheed.com
  8. Organization: Lockheed Artificial Intelligence Center
  9. Lines: 30
  10. Nntp-Posting-Host: philippines.rdd.lmsc.lockheed.com
  11.  
  12. In article <1992Aug17.204116.11424@nosc.mil>, frantzen@nosc.mil (Louise E. Frantzen) writes:
  13. > I have a question regarding the AIFF file format and the 'extended' type
  14. > which is used for the SampleRate.  I am using THINK C 5.0.  I have been
  15. > studying the info on AIFF in IM Vol VI and am stumped on this one.  On 
  16. > page 22-49 of IM VI, in listing 22-13, the hex value "400DADDD1745D145826B"
  17. > is given as "AIFFSampleRate (22kHz in extended type)".  I have looked through
  18. > Types.h and do not understand how the above hex value translates into the
  19. > sample rate of 22254.5455 Hz.  If anyone can give me some direction on how
  20. > to understand this or tell me what other documentation to look at I would
  21. > be very appreciative.
  22.  
  23. I usually try to avoid dealing with such data types (Fixed, extended, etc) 
  24. directly and use conversion functions instead.  For AIFF files you can define 
  25. sampleRate as a long and use the Long2Fix function to convert it within the 
  26. SetupAIFFHeader call (the SetupAIFFHeader function is looking for a sample 
  27. rate of type Fixed):
  28.  
  29. #include <SoundInput.h>
  30. #include <AIFF.h>
  31. #include <FixMath.h>
  32.  
  33. long sampleRate = 44100;
  34. oSError = SetupAIFFHeader(file, numChannels, Long2Fix(sampleRate), sampleSize, NoneType, 
  35.                              soundSize, numFrames);
  36.  
  37.  
  38. Also, if you want to know the low-level details of handling extended and Fixed data 
  39. types, the Apple Numerics manual covers such things. 
  40.