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 / afQuery.z / afQuery
Encoding:
Text File  |  1998-10-20  |  23.1 KB  |  397 lines

  1.  
  2.  
  3.  
  4. aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))                                                      aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      afQuery, afQueryLong, afQueryDouble, afQueryPointer - retrieve static
  10.      parameters associated with the Audio File Library formats
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      """"####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiiooooffffiiiilllleeee....hhhh>>>>""""
  14.  
  15.      AAAAUUUUppppvvvvlllliiiisssstttt aaaaffffQQQQuuuueeeerrrryyyy((((iiiinnnntttt qqqquuuueeeerrrryyyyttttyyyyppppeeee,,,, iiiinnnntttt aaaarrrrgggg1111,,,, iiiinnnntttt aaaarrrrgggg2222,,,,
  16.                       iiiinnnntttt aaaarrrrgggg3333,,,, iiiinnnntttt aaaarrrrgggg4444))))
  17.  
  18.      lllloooonnnngggg aaaaffffQQQQuuuueeeerrrryyyyLLLLoooonnnngggg((((iiiinnnntttt qqqquuuueeeerrrryyyyttttyyyyppppeeee,,,, iiiinnnntttt aaaarrrrgggg1111,,,, iiiinnnntttt aaaarrrrgggg2222,,,,
  19.                       iiiinnnntttt aaaarrrrgggg3333,,,, iiiinnnntttt aaaarrrrgggg4444))))
  20.  
  21.      ddddoooouuuubbbblllleeee aaaaffffQQQQuuuueeeerrrryyyyDDDDoooouuuubbbblllleeee((((iiiinnnntttt qqqquuuueeeerrrryyyyttttyyyyppppeeee,,,, iiiinnnntttt aaaarrrrgggg1111,,,, iiiinnnntttt aaaarrrrgggg2222,,,,
  22.                           iiiinnnntttt aaaarrrrgggg3333,,,, iiiinnnntttt aaaarrrrgggg4444))))
  23.  
  24.      vvvvooooiiiidddd**** aaaaffffQQQQuuuueeeerrrryyyyPPPPooooiiiinnnntttteeeerrrr((((iiiinnnntttt qqqquuuueeeerrrryyyyttttyyyyppppeeee,,,, iiiinnnntttt aaaarrrrgggg1111,,,, iiiinnnntttt aaaarrrrgggg2222,,,,
  25.                           iiiinnnntttt aaaarrrrgggg3333,,,, iiiinnnntttt aaaarrrrgggg4444))))
  26.  
  27. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR
  28.      _q_u_e_r_y_t_y_p_e      is an integer value token representing the type of query
  29.                     being made.
  30.  
  31.      _a_r_g_1,..._a_r_g_4   are integer value tokens representing the query selectors
  32.                     and/or subtypes.  The number of meaningful arguments to
  33.                     the aaaaffffQQQQuuuueeeerrrryyyy routines varies with the _q_u_e_r_y_t_y_p_e.
  34.  
  35. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  36.      Each of the four aaaaffffQQQQuuuueeeerrrryyyy(((()))) variants returns the requested information via
  37.      the return value, which may be of type AUpvlist, long, double, or void *,
  38.      depending on the variant.  aaaaffffQQQQuuuueeeerrrryyyyPPPPooooiiiinnnntttteeeerrrr(((())))'s return value will usually
  39.      be cast by the application to the appropriate pointer type (i.e., char*
  40.      for strings, int* for id arrays).  If the query represents a character
  41.      string (AF_QUERY_LABEL, AF_QUERY_NAME, AF_QUERY_DESC), the pointer should
  42.      not and must not be free()'d by the application;  in all other cases it
  43.      must be free()'d to avoid memory leakage.
  44.  
  45.      If the return value represents a quantity such as the number of loops
  46.      supported by a file format's inst chunks, the special return value
  47.      AAAAFFFF____NNNNUUUUMMMM____UUUUNNNNLLLLIIIIMMMMIIIITTTTEEEEDDDD indicates that there is no hard limit on the quantity.
  48.  
  49.      If an error occurs, aaaaffffQQQQuuuueeeerrrryyyyLLLLoooonnnngggg(((()))) and aaaaffffQQQQuuuueeeerrrryyyyDDDDoooouuuubbbblllleeee(((()))) will return -1, and
  50.      aaaaffffQQQQuuuueeeerrrryyyyPPPPooooiiiinnnntttteeeerrrr(((()))) will return NULL.
  51.  
  52. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  53.      aaaaffffQQQQuuuueeeerrrryyyy(((()))) and its associated routines are designed to allow an
  54.      application to query the audio file library for information about its
  55.      supported features.  These features include such things as the names,
  56.      descriptions, labels, default values, ID counts, and implementation
  57.      status of the instrument parameters, file formats, compression algorithms
  58.      and parameters, and miscellaneous chunks read from and stored into
  59.      headers. Which routine should be used depends on the data type of the
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))                                                      aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74.      parameter to be queried.  For example, to retrieve a character string,
  75.      use aaaaffffQQQQuuuueeeerrrryyyyPPPPooooiiiinnnntttteeeerrrr and cast the return value to (char *).
  76.  
  77.      The rule for placement of arguments is as follows:  _q_u_e_r_y_t_y_p_e is always
  78.      the AF_QUERYTYPE desired.  _a_r_g_1 is always the first sub-selector, such as
  79.      AF_QUERY_TYPE or AF_QUERY_NAME.  _a_r_g_2 will sometimes be an additional
  80.      sub-selector, such as AF_QUERY_DEFAULT, and will sometimes be the target
  81.      of the query, such as the file format or the compression type.  The
  82.      target of the query will always be the _f_i_n_a_l _n_o_n-_z_e_r_o _a_r_g_u_m_e_n_t to
  83.      aaaaffffQQQQuuuueeeerrrryyyy(((()))).  All subsequent arguments must be set to 0.
  84.  
  85.      Possible _q_u_e_r_y_t_y_p_e values (defined in <dmedia/audiofile.h>), and their
  86.      appropriate selectors and subtypes:
  87.  
  88.      AAAAFFFF____QQQQUUUUEEEERRRRYYYYTTTTYYYYPPPPEEEE____IIIINNNNSSSSTTTT
  89.  
  90.      Queries about the support and quantity of inst chunks by a given file
  91.      format.  _a_r_g_1 may be one of the following:
  92.  
  93.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____SSSSUUUUPPPPPPPPOOOORRRRTTTTEEEEDDDD   Boolean value, 1 if the file format specified in
  94.                           _a_r_g_2 supports an inst chunk, 0 otherwise.
  95.  
  96.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDD____CCCCOOOOUUUUNNNNTTTT    Request the total number of inst chunks supported by
  97.                           the format specified in _a_r_g_2.  This is usually 1 or
  98.                           0, but may be any value.
  99.  
  100.      AAAAFFFF____QQQQUUUUEEEERRRRYYYYTTTTYYYYPPPPEEEE____IIIINNNNSSSSTTTTPPPPAAAARRRRAAAAMMMM
  101.  
  102.      Instrument parameters associated with the INST chunk for formats which
  103.      support an INST.  _a_r_g_1 may be one of the following:
  104.  
  105.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____SSSSUUUUPPPPPPPPOOOORRRRTTTTEEEEDDDD   Boolean value, 1 if the file format in _a_r_g_2 supports
  106.                           instrument parameters in its inst chunk, 0
  107.                           otherwise.
  108.  
  109.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDD____CCCCOOOOUUUUNNNNTTTT    Request the total number of inst params supported by
  110.                           this format's inst.  This can be any value -- not
  111.                           just the number supported by AIFF/AIFF-C files.
  112.  
  113.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDDSSSS         Request an integer array of the available inst param
  114.                           token values
  115.  
  116.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____TTTTYYYYPPPPEEEE        With the file format as _a_r_g_2 and a particular inst
  117.                           param id as _a_r_g_3, this will return the param type of
  118.                           the param.  This will be one of AAAAUUUU____PPPPVVVVTTTTYYYYPPPPEEEE____LLLLOOOONNNNGGGG,
  119.                           AAAAUUUU____PPPPVVVVTTTTYYYYPPPPEEEE____DDDDOOOOUUUUBBBBLLLLEEEE, or AAAAUUUU____PPPPVVVVTTTTYYYYPPPPEEEE____PPPPTTTTRRRR.  See
  120.                           aaaaffffGGGGeeeettttIIIInnnnssssttttPPPPaaaarrrraaaammmmssss(3dm) for more information.
  121.  
  122.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____NNNNAAAAMMMMEEEE        With the file format as _a_r_g_2 and a particular inst
  123.                           param id as _a_r_g_3, this will return the param type of
  124.                           the param as a character string.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))                                                      aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))
  137.  
  138.  
  139.  
  140.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____DDDDEEEEFFFFAAAAUUUULLLLTTTT     With the file format as _a_r_g_2 and a particular inst
  141.                           param id as _a_r_g_3, this will return default value of
  142.                           the param based on the type as returned via
  143.                           AAAAFFFF____QQQQUUUUEEEERRRRYYYY____TTTTYYYYPPPPEEEE
  144.  
  145.      AAAAFFFF____QQQQUUUUEEEERRRRYYYYTTTTYYYYPPPPEEEE____LLLLOOOOOOOOPPPP
  146.  
  147.      Queries about the support and quantity of loops (in inst chunks) in a
  148.      given file format.  _a_r_g_1 may be one of the following:
  149.  
  150.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____SSSSUUUUPPPPPPPPOOOORRRRTTTTEEEEDDDD   Boolean value, 1 if the file format specified in
  151.                           _a_r_g_2 supports inst chunks with loops in them, 0
  152.                           otherwise.
  153.  
  154.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDD____CCCCOOOOUUUUNNNNTTTT    Request the total number of loops supported by the
  155.                           insts in the format specified in _a_r_g_2.  This may be
  156.                           any value.
  157.  
  158.      AAAAFFFF____QQQQUUUUEEEERRRRYYYYTTTTYYYYPPPPEEEE____FFFFIIIILLLLEEEEFFFFMMMMTTTT
  159.  
  160.      Parameters associated with the various file formats supported by the
  161.      library.  _a_r_g_1 may be one of the following:
  162.  
  163.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____LLLLAAAABBBBEEEELLLL               Request a 4-character label for the format,
  164.                                   e.g., "aiff"
  165.  
  166.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____NNNNAAAAMMMMEEEE                Request a short name for the format, e.g.,
  167.                                   "MS RIFF WAVE"
  168.  
  169.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____DDDDEEEESSSSCCCC                Request a longer, more descriptive name for
  170.                                   the format, e.g., "Audio Interchange File
  171.                                   Format"
  172.  
  173.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIMMMMPPPPLLLLEEEEMMMMEEEENNNNTTTTEEEEDDDD         Request a boolean value; 1 if format is
  174.                                   implemented for read/write in the Audio File
  175.                                   Library, otherwise 0.
  176.  
  177.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDD____CCCCOOOOUUUUNNNNTTTT            Request the total number of formats
  178.                                   currently implemented
  179.  
  180.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDDSSSS                 Request an integer array of the implemented
  181.                                   format id token values
  182.  
  183.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____CCCCOOOOMMMMPPPPRRRREEEESSSSSSSSIIIIOOOONNNN____TTTTYYYYPPPPEEEESSSS   Used with selector AAAAFFFF____QQQQUUUUEEEERRRRYYYY____VVVVAAAALLLLUUUUEEEE____CCCCOOOOUUUUNNNNTTTT in
  184.                                   _a_r_g_2, it returns a long integer containing
  185.                                   the number of compression schemes supported
  186.                                   by the format in _a_r_g_3.  Used with selector
  187.                                   AAAAFFFF____QQQQUUUUEEEERRRRYYYY____VVVVAAAALLLLUUUUEEEESSSS, it returns a pointer to an
  188.                                   integer array containing the compression ids
  189.                                   of the compression types supported by format
  190.                                   specified in _a_r_g_3.
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))                                                      aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))
  203.  
  204.  
  205.  
  206.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____SSSSAAAAMMMMPPPPLLLLEEEE____FFFFOOOORRRRMMMMAAAATTTTSSSS      Used with selector in AAAAFFFF____QQQQUUUUEEEERRRRYYYY____DDDDEEEEFFFFAAAAUUUULLLLTTTT in
  207.                                   _a_r_g_2, it returns the default sample format
  208.                                   for the format specified in _a_r_g_3.
  209.  
  210.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____SSSSAAAAMMMMPPPPLLLLEEEE____SSSSIIIIZZZZEEEESSSS        Used with selector AAAAFFFF____QQQQUUUUEEEERRRRYYYY____DDDDEEEEFFFFAAAAUUUULLLLTTTT in _a_r_g_2,
  211.                                   it returns the default sample width for the
  212.                                   format specified in _a_r_g_3.
  213.  
  214.      AAAAFFFF____QQQQUUUUEEEERRRRYYYYTTTTYYYYPPPPEEEE____CCCCOOOOMMMMPPPPRRRREEEESSSSSSSSIIIIOOOONNNN
  215.  
  216.      Parameters associated with the various compression schemes supported by
  217.      the library.  _a_r_g_1 may be one of the following:
  218.  
  219.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____LLLLAAAABBBBEEEELLLL              Request a 4-character label for the
  220.                                  compression, e.g., "g722"
  221.  
  222.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____NNNNAAAAMMMMEEEE               Request a short name for the compression,
  223.                                  e.g., "Aware MultiRate"
  224.  
  225.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____DDDDEEEESSSSCCCC               Request a longer, more descriptive name for
  226.                                  the compression, e.g., "SGI CCITT G.711 u-
  227.                                  law"
  228.  
  229.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDD____CCCCOOOOUUUUNNNNTTTT           Request the total number of compression
  230.                                  schemes currently implemented by the Audio
  231.                                  File Library.
  232.  
  233.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDDSSSS                Request an integer array of the implemented
  234.                                  compression scheme id token values
  235.  
  236.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____NNNNAAAATTTTIIIIVVVVEEEE____SSSSAAAAMMMMPPPPFFFFMMMMTTTT     Request the native sample format, i.e., the
  237.                                  format of the data before compression and/or
  238.                                  after decompression, e.g.,
  239.                                  AAAAFFFF____SSSSAAAAMMMMPPPPFFFFMMMMTTTT____TTTTWWWWOOOOSSSSCCCCOOOOMMMMPPPP
  240.  
  241.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____NNNNAAAATTTTIIIIVVVVEEEE____SSSSAAAAMMMMPPPPWWWWIIIIDDDDTTTTHHHH   Request the native format's sample width in
  242.                                  bits, e.g., '16' for short integer sample
  243.                                  data
  244.  
  245.      AAAAFFFF____QQQQUUUUEEEERRRRYYYYTTTTYYYYPPPPEEEE____CCCCOOOOMMMMPPPPRRRREEEESSSSSSSSIIIIOOOONNNNPPPPAAAARRRRAAAAMMMM
  246.  
  247.      Queries concerning the compression parameters supported by various
  248.      compression schemes.  _a_r_g_1 may be one of the following:
  249.  
  250.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDD____CCCCOOOOUUUUNNNNTTTT
  251.           Request the total number of compression parameters currently
  252.           supported by the compression scheme supplied in _a_r_g_2.
  253.  
  254.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____IIIIDDDDSSSS
  255.           Request an integer array of the supported compression parameter id
  256.           token values for the compression scheme supplied in _a_r_g_2.
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))                                                      aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))
  269.  
  270.  
  271.  
  272.      AAAAFFFF____QQQQUUUUEEEERRRRYYYYTTTTYYYYPPPPEEEE____MMMMIIIISSSSCCCC
  273.  
  274.      Parameters associated with the MISC chunks that can be stored by the
  275.      various file formats.  _a_r_g_1 may be one of the following:
  276.  
  277.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____LLLLAAAABBBBEEEELLLL             Request the four-character label for the misc
  278.                                 chunk, e.g., "COPY".
  279.  
  280.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____NNNNAAAAMMMMEEEE              Request the name of the misc chunk, e.g.,
  281.                                 "copyright".
  282.  
  283.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____DDDDEEEESSSSCCCC              Request a short description of the misc chunk,
  284.                                 e.g., "Copyright string".
  285.  
  286.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____TTTTYYYYPPPPEEEE____CCCCOOOOUUUUNNNNTTTT        Request the number of misc chunk types
  287.                                 supported by a given file format.
  288.  
  289.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____TTTTYYYYPPPPEEEESSSS             Request an integer array of the misc chunk
  290.                                 types supported by a given file format, as
  291.                                 supplied via _a_r_g_2.  The array is returned as a
  292.                                 pointer, and will be null if no misc types are
  293.                                 supported by the given file format.
  294.  
  295.      AAAAFFFF____QQQQUUUUEEEERRRRYYYY____MMMMAAAAXXXX____NNNNUUUUMMMMBBBBEEEERRRR        Request the maximum number of allowed misc
  296.                                 chunks of a given type for a given file
  297.                                 format, as supplied via _a_r_g_2  If the number is
  298.                                 unlimited, 0 is returned for backwards
  299.                                 compatibility rather than AF_NUM_UNLIMITED.
  300.                                 If the misc type is not supported, -1 is
  301.                                 returned but no error is generated.
  302.  
  303. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  304.      To query and print the name of a given audio file format:
  305.  
  306.          AFfilehandle handle = afOpenFile("somefile.aiff", "r", NULL);
  307.          char* formatstring;
  308.          int fileformat = afGetFileFormat(handle, NULL);
  309.  
  310.          formatstring = afQueryPointer(AF_QUERYTYPE_FILEFMT,
  311.                                        AF_QUERY_NAME,
  312.                                        fileformat,
  313.                                        0,
  314.                                        0);
  315.  
  316.          printf("The file format name is %s0, formatstring);
  317.  
  318.      To query a list of supported compression type ids:
  319.  
  320.          AFfilehandle handle = afOpenFile("somefile.aifc", "r", NULL);
  321.          int fileformat = afGetFileFormat(handle, NULL);
  322.          long numCompressionTypes;
  323.          int *compressionIDs = NULL;
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))                                                      aaaaffffQQQQuuuueeeerrrryyyy((((3333ddddmmmm))))
  335.  
  336.  
  337.  
  338.          /* first get the total number */
  339.  
  340.          numCompressionTypes = afQueryLong(AF_QUERYTYPE_FILEFMT,
  341.                                            AF_QUERY_COMPRESSION_TYPES,
  342.                                            AF_QUERY_VALUE_COUNT,
  343.                                            fileformat,
  344.                                            0);
  345.  
  346.          /* if number is not zero, retrieve the array of IDs */
  347.  
  348.          if(numCompressionTypes > 0) {
  349.              compressionIDs = (int *) afQueryPointer(AF_QUERYTYPE_FILEFMT,
  350.                                                      AF_QUERY_COMPRESSION_TYPES,
  351.                                                      AF_QUERY_VALUES,
  352.                                                      fileformat,
  353.                                                      0);
  354.  
  355.              /* here you would do whatever you wished with these IDs */
  356.  
  357.          }
  358.  
  359.          /* free the array memory */
  360.  
  361.          if(compressionIDs != NULL)
  362.              free(compressionIDs);
  363.  
  364.  
  365. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  366.      afOpenFile(3dm), afGetFileFormat(3dm), afInitCompression(3dm)
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.