home *** CD-ROM | disk | FTP | other *** search
/ IRIS Development Option 6.2 / IRIS_Development_Option_6.2_814-0478-001.iso / dist / dmedia_dev.idb / usr / include / dmedia / audiofile.h.z / audiofile.h
C/C++ Source or Header  |  1996-03-14  |  28KB  |  605 lines

  1. #ifndef __INC_AUDIOFILE_H__
  2. #define __INC_AUDIOFILE_H__ 
  3.  
  4. /***************************************************************************
  5.  * SGI Audio File Library
  6.  *
  7.  * audiofile.h
  8.  *    header file for use with /usr/lib/libaudiofile.so
  9.  ***************************************************************************
  10.  * 
  11.  * Copyright 1992, Silicon Graphics, Inc.
  12.  * All Rights Reserved.
  13.  *
  14.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  15.  * the contents of this file may not be disclosed to third parties, copied or
  16.  * duplicated in any form, in whole or in part, without the prior written
  17.  * permission of Silicon Graphics, Inc.
  18.  *
  19.  * RESTRICTED RIGHTS LEGEND:
  20.  * Use, duplication or disclosure by the Government is subject to restrictions
  21.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  22.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  23.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  24.  * rights reserved under the Copyright Laws of the United States.
  25.  *
  26.  ****************************************************************************/
  27.  
  28. #include <dmedia/dm_audio.h>    /* depend on DM_AUDIO_ for SAMPFMT #defines */
  29. #include <sys/types.h>        /* needed for off_t type */
  30.  
  31. #ident "$Revision: 1.47 $"
  32.  
  33. #define LIBAUDIOFILE_VERSION 2
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. /* macros to allow backwards-compatibility */
  40.  
  41. #ifndef __AF_NO_BACKWARDS_COMPAT__
  42.  
  43. #define AFseterrorhandler        afSetErrorHandler
  44. #define AFquery                afQuery
  45. #define AFquerylong            afQueryLong
  46. #define AFquerydouble            afQueryDouble
  47. #define AFqueryptr            afQueryPointer
  48. #define AFnewfilesetup            afNewFileSetup
  49. #define AFfreefilesetup            afFreeFileSetup
  50. #define AFidentifyfd            afIdentifyFD
  51. #define AFopenfile            afOpenFile
  52. #define AFopenfd            afOpenFD
  53. #define AFgetfd                afGetFD
  54. #define AFsavefilepos            afSaveFilePosition
  55. #define AFrestorefilepos        afRestoreFilePosition
  56. #define AFsyncfile            afSyncFile
  57. #define AFclosefile            afCloseFile
  58. #define AFinitfilefmt            afInitFileFormat
  59. #define AFgetfilefmt            afGetFileFormat
  60. #define AFinittrackids            afInitTrackIDs
  61. #define AFgettrackids            afGetTrackIDs
  62. #define AFreadframes            afReadFrames
  63. #define AFwriteframes            afWriteFrames
  64. #define AFseekframe            afSeekFrame
  65. #define AFtellframe            afTellFrame
  66. #define AFgetframesize            afGetFrameSize
  67. #define AFgetvirtualframesize        afGetVirtualFrameSize
  68. #define AFinitaeschanneldata        afInitAESChannelData
  69. #define AFinitaeschanneldatato        afInitAESChannelDataTo
  70. #define AFgetaeschanneldata        afGetAESChannelData
  71. #define AFsetaeschanneldata        afSetAESChannelData
  72. #define AFinitbyteorder            afInitByteOrder
  73. #define AFgetbyteorder            afGetByteOrder
  74. #define AFsetvirtualbyteorder        afSetVirtualByteOrder
  75. #define AFgetvirtualbyteorder        afGetVirtualByteOrder
  76. #define AFinitchannels            afInitChannels
  77. #define AFgetchannels            afGetChannels
  78. #define AFsetvirtualchannels        afSetVirtualChannels
  79. #define AFgetvirtualchannels        afGetVirtualChannels
  80. #define AFsetchannelmatrix            afSetChannelMatrix
  81. #define AFinitsampfmt            afInitSampleFormat
  82. #define AFgetsampfmt            afGetSampleFormat
  83. #define AFsetvirtualsampfmt        afSetVirtualSampleFormat
  84. #define AFgetvirtualsampfmt        afGetVirtualSampleFormat
  85. #define AFinitrate            afInitRate
  86. #define AFgetrate            afGetRate
  87. #define AFinitcompression        afInitCompression
  88. #define AFinitcompressionparams        afInitCompressionParams
  89. #define AFgetcompression        afGetCompression
  90. #define AFgetcompressionparams        afGetCompressionParams
  91. #define AFgetcompressionname        afGetCompressionName
  92. #define AFinitpcmmapping        afInitPCMMapping
  93. #define AFgetpcmmapping            afGetPCMMapping
  94. #define AFsettrackpcmmapping        afSetTrackPCMMapping
  95. #define AFsetvirtualpcmmapping        afSetVirtualPCMMapping
  96. #define AFgetvirtualpcmmapping        afGetVirtualPCMMapping
  97. #define AFinitdataoffset        afInitDataOffset
  98. #define AFgetdataoffset            afGetDataOffset
  99. #define AFinitframecnt            afInitFrameCount
  100. #define AFgetframecnt            afGetFrameCount
  101. #define AFinitinstids            afInitInstIDs
  102. #define AFgetinstids            afGetInstIDs
  103. #define AFsetinstparams            afSetInstParams
  104. #define AFgetinstparams            afGetInstParams
  105. #define AFsetinstparamlong        afSetInstParamLong
  106. #define AFgetinstparamlong        afGetInstParamLong
  107. #define AFinitloopids            afInitLoopIDs
  108. #define AFgetloopids            afGetLoopIDs
  109. #define AFsetloopmode            afSetLoopMode
  110. #define AFgetloopmode            afGetLoopMode
  111. #define AFsetloopstart            afSetLoopStart
  112. #define AFgetloopstart            afGetLoopStart
  113. #define AFsetloopend            afSetLoopEnd
  114. #define AFgetloopend            afGetLoopEnd
  115. #define AFsetlooptrack            afSetLoopTrack
  116. #define AFgetlooptrack            afGetLoopTrack
  117. #define AFinitmarkids            afInitMarkIDs
  118. #define AFgetmarkids            afGetMarkIDs
  119. #define AFsetmarkpos            afSetMarkPosition
  120. #define AFgetmarkpos            afGetMarkPosition
  121. #define AFinitmarkname            afInitMarkName
  122. #define AFgetmarkname            afGetMarkName
  123. #define AFinitmiscids            afInitMiscIDs
  124. #define AFgetmiscids            afGetMiscIDs
  125. #define AFinitmisctype            afInitMiscType
  126. #define AFgetmisctype            afGetMiscType
  127. #define AFinitmiscsize            afInitMiscSize
  128. #define AFgetmiscsize            afGetMiscSize
  129. #define AFwritemisc            afWriteMisc
  130. #define AFreadmisc            afReadMisc
  131. #define AFseekmisc            afSeekMisc
  132.  
  133. #endif
  134.  
  135. /*
  136.  * basic data structures
  137.  */
  138.  
  139. typedef struct _AFfilesetup  *AFfilesetup;  
  140. typedef struct _AFfilehandle *AFfilehandle;
  141. typedef void (*AFerrfunc)(long,const char*);
  142.  
  143. /*
  144.  * types for frame count (in frames) and file offset (in bytes)
  145.  */
  146.  
  147. typedef off_t AFframecount;
  148. typedef off_t AFfileoffset;
  149.  
  150. #define AF_NULL_FILESETUP ((struct _AFfilesetup *)0)
  151. #define AF_NULL_FILEHANDLE  ((struct _AFfilehandle *)0)
  152.  
  153. /*
  154.  * Audio Utility Library parameter-value lists
  155.  */
  156. #include <audioutil.h>
  157.  
  158. /*
  159.  * for now, use this as the track id in all AF library
  160.  * calls - all audio file formats supported by the current library 
  161.  * contain exactly one audio sample data chunk
  162.  */
  163. #define AF_DEFAULT_TRACK 1001
  164. /*
  165.  * for now, use this value wherever an instrument id is required
  166.  *   as an argument to one of the library functions below
  167.  */
  168. #define AF_DEFAULT_INST 2001
  169.  
  170. /* global routines */
  171. extern AFerrfunc  afSetErrorHandler(AFerrfunc efunc);
  172. extern AUpvlist afQuery        (int querytype, 
  173.                  int arg1, int arg2, int arg3, int arg4);
  174. extern long     afQueryLong    (int querytype, 
  175.                  int arg1, int arg2, int arg3, int arg4);
  176. extern double   afQueryDouble    (int querytype, 
  177.                                  int arg1, int arg2, int arg3, int arg4);
  178. extern void *   afQueryPointer    (int querytype, 
  179.                  int arg1, int arg2, int arg3, int arg4);
  180.                            
  181. /* basic operations on filehandle and filesetup */
  182. extern AFfilesetup  afNewFileSetup(void);
  183. extern void afFreeFileSetup(AFfilesetup);
  184. extern int afIdentifyFD(int);
  185. extern int afIdentifyNamedFD(int, const char *filename, int* implemented);
  186.  
  187. extern AFfilehandle afOpenFile    (const char *fileName, const char *mode, 
  188.                                    AFfilesetup fileSetUp);
  189. extern AFfilehandle afOpenFD      (int fd, const char *mode, 
  190.                                    AFfilesetup fileSetUp);
  191. extern AFfilehandle afOpenNamedFD (int fd, const char *mode, 
  192.                                    AFfilesetup fileSetUp,
  193.                    const char *filename);
  194.  
  195. extern int  afGetFD            (AFfilehandle);
  196. extern void afSaveFilePosition        (AFfilehandle);
  197. extern void afRestoreFilePosition   (AFfilehandle);
  198. extern int afSyncFile            (AFfilehandle);
  199. extern int afCloseFile            (AFfilehandle);                 
  200.  
  201. extern void afInitFileFormat        (AFfilesetup, int format);
  202. extern int afGetFileFormat          (AFfilehandle, int *version);
  203.  
  204. /* track */
  205. extern void afInitTrackIDs          (AFfilesetup,  int *trackids, int trackCount);
  206. extern int afGetTrackIDs            (AFfilehandle, int *trackids);
  207.  
  208. /* track data: reading, writing, seeking, sizing frames */
  209. extern int afReadFrames             (AFfilehandle, int track, void *buf, int frameCount);
  210. extern int afWriteFrames            (AFfilehandle, int track, void *buf, int frameCount); 
  211. extern AFframecount afSeekFrame        (AFfilehandle, int track, AFframecount frame);
  212. extern AFfileoffset afTellFrame        (AFfilehandle, int track);
  213. extern AFfileoffset afGetTrackBytes (AFfilehandle, int track);
  214. extern float afGetFrameSize        (AFfilehandle, int track, int stretch3to4);
  215. extern float afGetVirtualFrameSize  (AFfilehandle, int track, int stretch3to4);
  216.  
  217. /* track data: AES data */
  218.  
  219. /* afInitAESChannelData obsolete -- use afInitAESChannelDataTo() */
  220. extern void afInitAESChannelData    (AFfilesetup, int track); /*obsolete*/
  221. extern void afInitAESChannelDataTo  (AFfilesetup, int track, int willBeData);
  222. extern int afGetAESChannelData        (AFfilehandle,int track,unsigned char buf[24]);
  223. extern void afSetAESChannelData        (AFfilehandle,int track,unsigned char buf[24]);
  224.  
  225. /* track data: byte order */
  226. extern void afInitByteOrder        (AFfilesetup, int track, int byteOrder);
  227. extern int afGetByteOrder        (AFfilehandle, int track);
  228. extern int afSetVirtualByteOrder    (AFfilehandle, int track, int byteOrder);
  229. extern int afGetVirtualByteOrder    (AFfilehandle, int track);
  230.  
  231. /* track data: # channels */
  232. extern void afInitChannels        (AFfilesetup, int track, int nchannels);
  233. extern int afGetChannels        (AFfilehandle, int track); 
  234. extern int afSetVirtualChannels     (AFfilehandle, int track, int channelCount);
  235. extern int afGetVirtualChannels     (AFfilehandle, int track);
  236. extern void afSetChannelMatrix        (AFfilehandle, int track, double *matrix);
  237.  
  238. /* track data: sample format and sample width */
  239. extern void afInitSampleFormat        (AFfilesetup, int track, 
  240.                      int sampleFormat, int sampleWidth);
  241. extern void afGetSampleFormat        (AFfilehandle file, int track, 
  242.                      int *sampleFormat, int *sampleWidth);
  243. extern int afSetVirtualSampleFormat (AFfilehandle, int track, 
  244.                      int sampleFormat, int sampleWidth);
  245. extern void afGetVirtualSampleFormat(AFfilehandle, int track, 
  246.                      int *sampleFormat, int *sampleWidth);
  247.  
  248. /* track data: sampling rate */
  249. extern void   afInitRate(AFfilesetup, int track, double rate);
  250. extern double afGetRate (AFfilehandle, int track);
  251.  
  252. /* track data: compression */
  253. extern void afInitCompression        (AFfilesetup, int track, int compression);
  254. extern void afInitCompressionParams    (AFfilesetup, int track, 
  255.                         int compression, 
  256.                         AUpvlist params, int parameterCount);
  257. extern int afGetCompression        (AFfilehandle, int track);
  258. extern void afGetCompressionParams    (AFfilehandle file, int track, 
  259.                         int *compression,
  260.                         AUpvlist params, int parameterCount);
  261. /* this is obsolete--use afQuery() */
  262. extern char *afGetCompressionName    (AFfilehandle, int track);/*obsolete*/
  263.  
  264. /* track data: pcm mapping */
  265. extern void afInitPCMMapping    (AFfilesetup filesetup, int track,
  266.                              double slope, double intercept, 
  267.                              double minClip, double maxClip);
  268. extern void afGetPCMMapping    (AFfilehandle file, int track,
  269.                             double *slope, double *intercept, 
  270.                             double *minClip, double *maxClip);
  271. /* NOTE: afSetTrackPCMMapping() is special--it does not set the virtual     */
  272. /* format; it changes what the AF thinks the track format is! Be careful.   */
  273. extern int afSetTrackPCMMapping(AFfilehandle file, int track,
  274.                                  double slope, double intercept,
  275.                                  double minClip, double maxClip);
  276. /* NOTE: afSetVirtualPCMMapping() is different than afSetTrackPCMMapping(): */
  277. /* see comment for afSetTrackPCMMapping().                                  */
  278. extern int afSetVirtualPCMMapping(AFfilehandle file, int track,
  279.                                    double slope, double intercept,
  280.                                    double minClip, double maxClip);
  281. extern void afGetVirtualPCMMapping(AFfilehandle file, int track,
  282.                                    double *slope, double *intercept, 
  283.                                    double *minClip, double *maxClip);
  284.  
  285. /* track data: data offset within the file (init for raw reading only) */
  286. extern void afInitDataOffset(AFfilesetup, int track, AFfileoffset offset); /*raw read only*/
  287. extern AFfileoffset afGetDataOffset (AFfilehandle, int track);
  288.  
  289. /* track data: count of frames in file (init for raw only) */
  290. extern void afInitFrameCount(AFfilesetup, int track, AFframecount frameCount); /*raw read only*/
  291. extern AFframecount afGetFrameCount (AFfilehandle, int track);
  292.  
  293. /* AIFF instrument data chunk operations */
  294. extern void afInitInstIDs   (AFfilesetup, int *ids, int nids);
  295. extern int afGetInstIDs    (AFfilehandle, int *ids);
  296. extern void afSetInstParams (AFfilehandle, int instrumentID, 
  297.                 AUpvlist params, int parameterCount);
  298. extern void afGetInstParams (AFfilehandle, int instrumentID, 
  299.                 AUpvlist params, int parameterCount);
  300.  
  301. extern void afSetInstParamLong(AFfilehandle, int instrumentID, int paramater, long val);
  302. extern long afGetInstParamLong(AFfilehandle, int instrumentID, int parameter);
  303.  
  304. /* AIFF loop operations */
  305. extern void afInitLoopIDs (AFfilesetup, int instrumentID, int *ids, int nids);
  306. extern int afGetLoopIDs  (AFfilehandle, int instrumentID, int *ids); 
  307. extern void afSetLoopMode (AFfilehandle, int instrumentID, int loop, int mode);
  308. extern int afGetLoopMode (AFfilehandle, int instrumentID, int loop);
  309. extern void afSetLoopStart(AFfilehandle, int instrumentID, int loop, int markerID);
  310. extern int afGetLoopStart(AFfilehandle, int instrumentID, int loop);
  311. extern void afSetLoopEnd  (AFfilehandle, int instrumentID, int loop, int markerID);
  312. extern int afGetLoopEnd  (AFfilehandle, int instrumentID, int loop);
  313. extern void afSetLoopTrack(AFfilehandle, int instrumentID, int loop, int trackid);
  314. extern int afGetLoopTrack(AFfilehandle, int instrumentID, int loop);
  315.  
  316. /* AIFF marker operations */
  317. extern void afInitMarkIDs    (AFfilesetup, int trackID, int *ids, int nids);
  318. extern int afGetMarkIDs     (AFfilehandle, int trackID, int *ids);
  319. extern void afSetMarkPosition(AFfilehandle, int trackID, int marker, AFframecount pos);
  320. extern AFframecount afGetMarkPosition(AFfilehandle, int trackID, int marker);
  321. extern void afInitMarkName   (AFfilesetup, int trackID, int marker, const char *name);
  322. extern char *afGetMarkName   (AFfilehandle, int trackID, int marker);
  323.  
  324. /* AIFF miscellaneous data chunk operations */
  325. extern void afInitMiscIDs (AFfilesetup,  int *ids, int nids);
  326. extern int afGetMiscIDs  (AFfilehandle, int *ids);
  327. extern void afInitMiscType(AFfilesetup,  int miscellaneousID, int type);
  328. extern int afGetMiscType (AFfilehandle, int miscellaneousID);
  329. extern void afInitMiscSize(AFfilesetup,  int miscellaneousID, int size);
  330. extern int afGetMiscSize (AFfilehandle, int miscellaneousID);
  331. extern int afWriteMisc   (AFfilehandle, int miscellaneousID, void *buf, int bytes);
  332. extern int afReadMisc    (AFfilehandle, int miscellaneousID, void *buf, int bytes);
  333. extern int afSeekMisc    (AFfilehandle, int miscellaneousID, int offset);
  334.  
  335. /* sample formats */ 
  336.  
  337. /* Note that these values are pulled from <dmedia/dm_audio.h>. 
  338.  * As new SAMPFMT's are supported, their names will be rolled into
  339.  * DMaudioformat, as defined by dm_audio.h. 
  340.  */
  341. #define AF_SAMPFMT_TWOSCOMP    ((int)DM_AUDIO_TWOS_COMPLEMENT)  /* linear two's complement */
  342. #define AF_SAMPFMT_UNSIGNED    ((int)DM_AUDIO_UNSIGNED)         /* unsigned integer */
  343. #define AF_SAMPFMT_FLOAT       ((int)DM_AUDIO_FLOAT)            /* 32-bit IEEE float */
  344. #define AF_SAMPFMT_DOUBLE      ((int)DM_AUDIO_DOUBLE)           /* 64-bit IEEE double */
  345.  
  346. /* byte orders */
  347. #define AF_BYTEORDER_BIGENDIAN        501  /* big endian, SGI MIPS / Motorola order */
  348. #define AF_BYTEORDER_LITTLEENDIAN   502  /* little endian, Intel order */
  349.  
  350. /* file formats */
  351. #define AF_FILE_UNKNOWN        -1
  352. #define AF_FILE_UNSUPPORTED    -2 /*obsolete and unused*/
  353. #define AF_FILE_RAWDATA        0
  354. #define AF_FILE_AIFFC        1
  355. #define AF_FILE_AIFF        2
  356. #define AF_FILE_NEXTSND        3
  357. #define AF_FILE_WAVE        4
  358. #define AF_FILE_BICSF        5
  359. #define AF_FILE_MPEG1BITSTREAM  6
  360. #define AF_FILE_SOUNDESIGNER1    7
  361. #define AF_FILE_SOUNDESIGNER2    8
  362.  
  363. /* for full compatibility */
  364. #define AF_FILE_IRCAM        AF_FILE_BICSF
  365.  
  366. /* loop modes */
  367. #define AF_LOOP_MODE_NOLOOP    0
  368. #define AF_LOOP_MODE_FORW    1
  369. #define AF_LOOP_MODE_FORWBAKW    2
  370.  
  371. /* instrument parameters */
  372. #define AF_INST_MIDI_BASENOTE      301   
  373. #define AF_INST_NUMCENTS_DETUNE    302   
  374. #define AF_INST_MIDI_LONOTE        303
  375. #define AF_INST_MIDI_HINOTE        304
  376. #define AF_INST_MIDI_LOVELOCITY    305
  377. #define AF_INST_MIDI_HIVELOCITY    306
  378. #define AF_INST_NUMDBS_GAIN        307
  379. #define AF_INST_SUSLOOPID          308 /* loop id for sustain loop */
  380. #define AF_INST_RELLOOPID          309 /* loop id for release loop */
  381.  
  382. /* miscellaneous data sections */
  383. /* AIFF-constants -- for backwards compatibility */
  384. #define AF_MISC_AIFF_UNRECOGNIZED   0  /* unrec. data chunk */ /*obsolete*/
  385. #define AF_MISC_AIFF_COPY         201  /* copyright string */ /*obsolete*/
  386. #define AF_MISC_AIFF_AUTH         202  /* author string */ /*obsolete*/
  387. #define AF_MISC_AIFF_NAME         203  /* name string */ /*obsolete*/
  388. #define AF_MISC_AIFF_ANNO         204  /* annotation string */ /*obsolete*/
  389. #define AF_MISC_AIFF_APPL         205  /* app-specific data */ /*obsolete*/
  390. #define AF_MISC_AIFF_MIDI         206  /* MIDI exclusive data */ /*obsolete*/
  391.  
  392. #define AF_MISC_UNRECOGNIZED      0    /* unrecognized data chunk */
  393. #define AF_MISC_COPY        201  /* copyright string */
  394. #define AF_MISC_AUTH        202  /* author string */
  395. #define AF_MISC_NAME        203  /* name string */
  396. #define AF_MISC_ANNO        204  /* annotation string */
  397. #define AF_MISC_APPL        205  /* application-specific data */
  398. #define AF_MISC_MIDI        206  /* MIDI exclusive data */
  399.  
  400. #define AF_MISC_PCMMAP        207  /* PCM mapping information (future use) */
  401. #define AF_MISC_NeXT        208  /* misc binary data appended to NeXT hdr */
  402. #define AF_MISC_IRCAM_PEAKAMP    209  /* peak amplitude information */
  403. #define AF_MISC_IRCAM_COMMENT    210  /* text comment */
  404.  
  405. /* compression schemes supported by SGI Audio File Library */
  406. #define AF_COMPRESSION_UNKNOWN          -1
  407. #define AF_COMPRESSION_NONE             0
  408. #define AF_COMPRESSION_G722             501
  409. #define AF_COMPRESSION_G711_ULAW        502
  410. #define AF_COMPRESSION_G711_ALAW        503
  411.  
  412. /* Apple proprietary AIFF-C compression schemes: not supported by SGI 
  413.  *     Audio File Library */
  414. #define AF_COMPRESSION_APPLE_ACE2       504
  415. #define AF_COMPRESSION_APPLE_ACE8       505
  416. #define AF_COMPRESSION_APPLE_MAC3       506
  417. #define AF_COMPRESSION_APPLE_MAC6       507
  418.  
  419. #define AF_COMPRESSION_MPEG1            515
  420. #define AF_COMPRESSION_AWARE_MULTIRATE  516
  421.  
  422. /* provided for backwards compatibility with old libaudiofile */
  423. #define AF_COMPRESSION_AWARE_MPEG       AF_COMPRESSION_MPEG1
  424.  
  425. /* handy defaults for afInitCompression */
  426. #define AF_COMPRESSION_DEFAULT_MPEG_I             508
  427. #define AF_COMPRESSION_DEFAULT_MPEG1_LAYERI       AF_COMPRESSION_DEFAULT_MPEG_I
  428. #define AF_COMPRESSION_DEFAULT_MPEG_II            509
  429. #define AF_COMPRESSION_DEFAULT_MPEG1_LAYERII      AF_COMPRESSION_DEFAULT_MPEG_II
  430. #define AF_COMPRESSION_AWARE_DEFAULT_MULTIRATE      513
  431. #define AF_COMPRESSION_AWARE_DEFAULT_LOSSLESS      514
  432.  
  433.  
  434. /* provided for backwards compatibility */
  435. #define AF_COMPRESSION_AWARE_DEFAULT_MPEG_I      AF_COMPRESSION_DEFAULT_MPEG_I
  436. #define AF_COMPRESSION_AWARE_DEFAULT_MPEG1_LAYERI AF_COMPRESSION_DEFAULT_MPEG_I 
  437. #define AF_COMPRESSION_AWARE_DEFAULT_MPEG_II      AF_COMPRESSION_DEFAULT_MPEG_II
  438. #define AF_COMPRESSION_AWARE_DEFAULT_MPEG1_LAYERII AF_COMPRESSION_DEFAULT_MPEG_II
  439.  
  440. /* Compression Parameters for MPEG Compression */
  441.  
  442. #define AF_MPEG_PARAM_LAYER                530000 /* algorithm layer */
  443. #define     AF_MPEG_LAYER_I                530001 /* .. mpeg 1 layer 1 */
  444. #define     AF_MPEG_LAYER_II               530002 /* .. mpeg 1 layer 2 */
  445.  
  446. #define AF_MPEG_PARAM_BITRATE_TARGET       511000 /* bitrate target */
  447.  
  448. #define AF_MPEG_PARAM_CONST_QUAL_NMR       514000 /* const qual NMR */
  449.  
  450. #define AF_MPEG_PARAM_BITRATE_POLICY       517000 /* bitrate policy */
  451. #define     AF_MPEG_FIXED_RATE             517001 /* .. fixed rate */
  452. #define     AF_MPEG_CONST_QUAL             517002 /* .. constant quality */
  453.  
  454. #define AF_MPEG_PARAM_CHANNEL_POLICY       510000 /* channel policy */
  455. #define     AF_MPEG_JOINT_STEREO           510001 /* .. joint stereo */
  456. #define     AF_MPEG_STEREO                 510002 /* .. stereo */
  457. #define     AF_MPEG_INDEPENDENT            510003 /* .. independent */
  458.  
  459. /* Compression Parameters for Aware MultiRate */
  460.  
  461. #define AF_AWARE_PARAM_CHANNEL_POLICY      510000 /* bitrate policy */
  462. #define     AF_AWARE_STEREO                510002 /* .. stereo */
  463. #define     AF_AWARE_INDEPENDENT           510003 /* .. independent */
  464.  
  465. #define AF_AWARE_PARAM_BITRATE_POLICY      517000 /* bitrate policy */
  466. #define     AF_AWARE_CONST_QUAL            517002 /* .. constant quality */
  467. #define     AF_AWARE_LOSSLESS              517003 /* .. lossless */
  468.  
  469.  
  470. /* Not legal for Aware MultiRate; here only for compatibility */
  471. #define AF_AWARE_PARAM_LAYER           AF_MPEG_PARAM_LAYER
  472. #define AF_AWARE_LAYER_I               AF_MPEG_LAYER_I
  473. #define AF_AWARE_LAYER_II              AF_MPEG_LAYER_II
  474. #define AF_AWARE_PARAM_CONST_QUAL_NMR  AF_MPEG_PARAM_CONST_QUAL_NMR
  475. #define AF_AWARE_PARAM_BITRATE_TARGET  AF_MPEG_PARAM_BITRATE_TARGET
  476. #define AF_AWARE_FIXED_RATE            AF_MPEG_FIXED_RATE
  477. #define AF_AWARE_JOINT_STEREO          AF_MPEG_JOINT_STEREO
  478.  
  479. /* Not Yet Supported Compression Parameters for Aware MultiRate */
  480. #define AF_AWARE_PARAM_VERSION         509000 /* version (long) */
  481. #define AF_AWARE_PARAM_NOISE_FLOOR     512000 /* noise floor (double) */
  482. #define AF_AWARE_PARAM_FILTER_ID       513000 /* filter id (long token) */
  483. #define AF_AWARE_DEFAULT_FILTER        513001
  484. #define AF_AWARE_PARAM_PSYCHO_MODEL    515000 /* psycho model (long token) */
  485. #define AF_AWARE_PSYCHO_MODEL_1        515001
  486. /* psycho model 1 alpha (double val) */
  487. #define AF_AWARE_PARAM_PSYCHO_MODEL1_ALPHA    516000 
  488. /* scale parameters (long) */
  489. #define AF_AWARE_PARAM_SCALE_DECIMATION        518000 
  490. #define AF_AWARE_PARAM_SCALE_FILTER_SHAPE    519000
  491. #define AF_AWARE_SCALE_DEFAULT_FILTER_SHAPE    519001
  492. #define AF_AWARE_SCALE_FILTER_SHAPE_1        519002
  493. #define AF_AWARE_SCALE_FILTER_SHAPE_2        519003
  494. #define AF_AWARE_PARAM_SCALE_COMBINE_CHANNELS    520000
  495. #define AF_AWARE_PARAM_FRAMES_PER_BLOCK        521000 /* (long) */
  496. #define AF_AWARE_PARAM_MAX_BYTES_PER_BLOCK    522000 /* (long) */
  497. #define AF_AWARE_PARAM_DECODER_DELAY        523000 /* (long) */
  498. #define AF_AWARE_PARAM_ENCODER_DELAY        524000 /* (long) */
  499.  
  500. /* tokens for afQuery() -- see the man page for instructions */
  501. #define AF_QUERYTYPE_INSTPARAM        500
  502. #define AF_QUERYTYPE_FILEFMT        501
  503. #define AF_QUERYTYPE_COMPRESSION    502
  504. #define AF_QUERYTYPE_COMPRESSIONPARAM    503
  505. #define AF_QUERYTYPE_MISC        504
  506.  
  507. #define AF_QUERY_NAME            600
  508. #define AF_QUERY_DESC            601
  509. #define AF_QUERY_LABEL            602
  510. #define AF_QUERY_TYPE            603
  511. #define AF_QUERY_DEFAULT        604
  512. #define AF_QUERY_ID_COUNT        605
  513. #define AF_QUERY_IDS            606
  514. #define AF_QUERY_IMPLEMENTED        613
  515. #define AF_QUERY_TYPE_COUNT        607
  516. #define AF_QUERY_TYPES            608
  517. #define AF_QUERY_NATIVE_SAMPFMT        609
  518. #define AF_QUERY_NATIVE_SAMPWIDTH   610
  519. #define AF_QUERY_SQUISHFAC        611 /* 1.0 means variable */
  520. #define AF_QUERY_MAX_NUMBER        612
  521.  
  522. /* audio file library error codes */
  523. #define AF_BAD_NOT_IMPLEMENTED  0  /* not implemented yet */
  524. #define AF_BAD_FILEHANDLE       1  /* tried to use invalid filehandle */
  525. #define AF_BAD_OPEN             3  /* unix open failed */
  526. #define AF_BAD_CLOSE            4  /* unix close failed */
  527. #define AF_BAD_READ             5  /* unix read failed */
  528. #define AF_BAD_WRITE            6  /* unix write failed */
  529. #define AF_BAD_LSEEK            7  /* unix lseek failed */
  530. #define AF_BAD_NO_FILEHANDLE    8  /* failed to allocate a filehandle struct */
  531. #define AF_BAD_ACCMODE          10 /* unrecognized audio file access mode */
  532. #define AF_BAD_NOWRITEACC       11 /* file not open for writing */
  533. #define AF_BAD_NOREADACC        12 /* file not open for reading */
  534. #define AF_BAD_FILEFMT          13 /* unrecognized audio file format */
  535. #define AF_BAD_RATE             14 /* invalid sample rate */
  536. #define AF_BAD_CHANNELS         15 /* invalid # channels*/
  537. #define AF_BAD_SAMPCNT          16 /* invalid sample count */
  538. #define AF_BAD_WIDTH            17 /* invalid sample width */
  539. #define AF_BAD_SEEKMODE         18 /* invalid seek mode */
  540. #define AF_BAD_NO_LOOPDATA    19 /* failed to allocate loop struct */
  541. #define AF_BAD_MALLOC           20 /* malloc failed somewhere */
  542. #define AF_BAD_LOOPID           21
  543. #define AF_BAD_SAMPFMT          22 /* bad sample format */
  544. #define AF_BAD_FILESETUP        23 /* bad file setup structure*/
  545. #define AF_BAD_TRACKID          24 /* no track corresponding to id */
  546. #define AF_BAD_NUMTRACKS        25 /*too many or too few tracks for file format */
  547. #define AF_BAD_NO_FILESETUP     26 /* failed to allocate a filesetup struct*/
  548. #define AF_BAD_LOOPMODE         27 /*unrecognized loop mode symbol*/
  549. #define AF_BAD_INSTID           28 /* invalid instrument id */
  550. #define AF_BAD_NUMLOOPS         29 /* bad # loops */
  551. #define AF_BAD_NUMMARKS         30 /* bad # markers */
  552. #define AF_BAD_MARKID           31 /* bad marker id */
  553. #define AF_BAD_MARKPOS          32 /* invalid marker position value */
  554. #define AF_BAD_NUMINSTS         33 /* invalid # instruments */
  555. #define AF_BAD_NOAESDATA        34 
  556. #define AF_BAD_MISCID           35
  557. #define AF_BAD_NUMMISC          36
  558. #define AF_BAD_MISCSIZE         37
  559. #define AF_BAD_MISCTYPE         38
  560. #define AF_BAD_MISCSEEK         39
  561. #define AF_BAD_STRLEN           40 /* invalid string length */
  562. #define AF_BAD_RATECONV         45
  563. #define AF_BAD_SYNCFILE         46
  564. #define AF_BAD_CODEC_CONFIG     47 /* improperly configured codec */
  565. #define AF_BAD_CODEC_STATE      48 /* invalid codec state: can't recover */
  566. #define AF_BAD_CODEC_LICENSE    49 /* no license available for codec */
  567. #define AF_BAD_CODEC_TYPE       50 /* unsupported codec type */
  568.  
  569. #define AF_BAD_COMPRESSION      AF_BAD_CODEC_CONFIG /* for back compat */
  570. #define AF_BAD_COMPTYPE         AF_BAD_CODEC_TYPE   /* for back compat */
  571.  
  572. #define AF_BAD_INSTPTYPE        51 /* invalid instrument parameter type */
  573. #define AF_BAD_INSTPID          52 /* invalid instrument parameter id */
  574.  
  575. #define AF_BAD_BYTEORDER        53
  576. #define AF_BAD_FILEFMT_PARAM    54 /* unrecognized file format parameter */
  577. #define AF_BAD_COMP_PARAM       55 /* unrecognized compression parameter */
  578. #define AF_BAD_DATAOFFSET       56 /* bad data offset */
  579. #define AF_BAD_FRAMECNT         57 /* bad frame count */
  580.  
  581. #define AF_BAD_QUERYTYPE        58 /* bad query type */
  582. #define AF_BAD_QUERY            59 /* bad argument to afQuery() */
  583.  
  584. #define AF_WARNING_CODEC_RATE   60 /* using 8k instead of codec rate 8012 */
  585. #define AF_WARNING_RATECVT      61 /* warning about rate conversion used */
  586.  
  587. #define AF_BAD_HEADER           62 /* failed to parse header */
  588.  
  589. /* AIFF/AIFF-C specific errors when parsing file header */
  590. #define AF_BAD_AIFF_HEADER     108  /* failed to parse chunk header */
  591. #define AF_BAD_AIFF_FORM       109  /* failed to parse FORM chunk */
  592. #define AF_BAD_AIFF_SSND       110  /* failed to parse SSND chunk */
  593. #define AF_BAD_AIFF_CHUNKID    111  /* unrecognized AIFF/AIFF-C chunk id */
  594. #define AF_BAD_AIFF_COMM       112  /* failed to parse COMM chunk */
  595. #define AF_BAD_AIFF_INST       113  /* failed to parse INST chunk */
  596. #define AF_BAD_AIFF_MARK       114  /* failed to parse MARK chunk */
  597. #define AF_BAD_AIFF_SKIP       115  /* failed to skip unsupported chunk */
  598. #define AF_BAD_AIFF_LOOPMODE   116  /* unrecognized loop mode (forw, etc)*/
  599.  
  600. #ifdef __cplusplus 
  601. }
  602. #endif
  603.  
  604. #endif /* ! __INC_AUDIOFILE_H__ */
  605.