home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3dm / audiofile / afInitDataOffset.z / afInitDataOffset
Encoding:
Text File  |  1998-10-20  |  6.4 KB  |  133 lines

  1.  
  2.  
  3.  
  4. aaaaffffIIIInnnniiiittttDDDDaaaattttaaaaOOOOffffffffsssseeeetttt((((3333ddddmmmm))))                                    aaaaffffIIIInnnniiiittttDDDDaaaattttaaaaOOOOffffffffsssseeeetttt((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      afInitDataOffset, afInitFrameCount - initialize the audio data byte
  10.      offset / frame count in an AAAAFFFFffffiiiilllleeeesssseeeettttuuuupppp for a specified raw-format audio
  11.      track
  12.  
  13. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiiooooffffiiiilllleeee....hhhh>>>>
  15.  
  16.      vvvvooooiiiidddd aaaaffffIIIInnnniiiittttDDDDaaaattttaaaaOOOOffffffffsssseeeetttt((((AAAAFFFFffffiiiilllleeeesssseeeettttuuuupppp sssseeeettttuuuupppp,,,, iiiinnnntttt ttttrrrraaaacccckkkk,,,, AAAAFFFFffffiiiilllleeeeooooffffffffsssseeeetttt ooooffffffffsssseeeetttt))))
  17.  
  18.      vvvvooooiiiidddd aaaaffffIIIInnnniiiittttFFFFrrrraaaammmmeeeeCCCCoooouuuunnnntttt((((AAAAFFFFffffiiiilllleeeesssseeeettttuuuupppp sssseeeettttuuuupppp,,,, iiiinnnntttt ttttrrrraaaacccckkkk,,,, AAAAFFFFffffrrrraaaammmmeeeeccccoooouuuunnnntttt ccccoooouuuunnnntttt))))
  19.  
  20. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR
  21.      _s_e_t_u_p    is an AAAAFFFFffffiiiilllleeeesssseeeettttuuuupppp structure, previously created by a call to
  22.               aaaaffffNNNNeeeewwwwFFFFiiiilllleeeeSSSSeeeettttuuuupppp(3dm).
  23.  
  24.      _t_r_a_c_k    is an integer which identifies an audio track in _s_e_t_u_p.
  25.  
  26.               Since all currently supported file formats contain only one
  27.               audio track, the value AAAAFFFF____DDDDEEEEFFFFAAAAUUUULLLLTTTT____TTTTRRRRAAAACCCCKKKK should always be used
  28.               here.
  29.  
  30.      _o_f_f_s_e_t   is a positive value which specifies the offset in bytes for the
  31.               audio data associated with _t_r_a_c_k.  The data type AAAAFFFFffffiiiilllleeeeooooffffffffsssseeeetttt is
  32.               large enough to hold any data offset allowed by the filesystem.
  33.  
  34.      _c_o_u_n_t    is a positive value which specifies the number of frames of
  35.               audio data to be associated with _t_r_a_c_k.  The data type
  36.               AAAAFFFFffffrrrraaaammmmeeeeccccoooouuuunnnntttt is large enough to hold any frame count allowed by
  37.               the filesystem.
  38.  
  39. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  40.      aaaaffffIIIInnnniiiittttDDDDaaaattttaaaaOOOOffffffffsssseeeetttt(((()))) initializes the audio data offset in an AAAAFFFFffffiiiilllleeeesssseeeettttuuuupppp
  41.      structure for an audio track.
  42.  
  43.      aaaaffffIIIInnnniiiittttFFFFrrrraaaammmmeeeeCCCCoooouuuunnnntttt(((()))) initializes the audio frame count in an AAAAFFFFffffiiiilllleeeesssseeeettttuuuupppp
  44.      structure for an audio track.
  45.  
  46.      When a file is opened for reading or writing by passing _s_e_t_u_p to
  47.      aaaaffffOOOOppppeeeennnnFFFFiiiilllleeee(3dm), the track will be configured to read or write data using
  48.      the data offset and/or frame count specified.  These routines may only be
  49.      used when reading or writing raw (headerless) audio files. All non-raw
  50.      audio formats have a fixed data offset determined by their headers.
  51.      These routines are also useful for reading audio file formats which are
  52.      not supported by the Audio File Library, but whose format is known to a
  53.      particular application.  If the application can supply all the necessary
  54.      parameters (data offset, frame count, sample format, rate, and channel
  55.      count), then the file can be read as a raw file via aaaaffffRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss(((()))).
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. aaaaffffIIIInnnniiiittttDDDDaaaattttaaaaOOOOffffffffsssseeeetttt((((3333ddddmmmm))))                                    aaaaffffIIIInnnniiiittttDDDDaaaattttaaaaOOOOffffffffsssseeeetttt((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74. EXAMPLE
  75.      Attempt to read a raw audio file with a known data offset of 60 bytes and
  76.      a known frame count of 1000.  All other parameters default to the default
  77.      AAAAIIIIFFFFFFFF(4) file values: 16-bit 2's complement, 1 channel, 44.1kz rate.
  78.  
  79.      #include <dmedia/audiofile.h>
  80.  
  81.      main()
  82.      {
  83.          AFfilesetup setup;
  84.          AFfilehandle inHandle;
  85.          short buf[1024];
  86.          AFframeoffset fileOffset = 60;
  87.          AFframecount frameCount = 1000;
  88.  
  89.          /* create setup */
  90.  
  91.          setup = afNewFileSetup();
  92.  
  93.          /* configure as raw file with given offset and frame count */
  94.  
  95.          afInitFileFormat(setup, AF_FILE_RAWDATA);
  96.          afInitDataOffset(setup, AF_DEFAULT_TRACK, fileOffset);
  97.          afInitFrameCount(setup, AF_DEFAULT_TRACK, frameCount);
  98.  
  99.          /* open the file */
  100.  
  101.          inHandle = afOpenFile("myrawsoundfile", "r", setup);
  102.  
  103.          /* read all the frames */
  104.  
  105.          afReadFrames(inHandle, AF_DEFAULT_TRACK, buf, frameCount);
  106.      }
  107.  
  108. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  109.      afNewFileSetup(3dm), afOpenFile(3dm), afWriteFrames(3dm),
  110.      afSetVirtualSampleFormat(3dm), afGetVirtualSampleFormat(3dm),
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.