| audiofile.h | | audiofile.h | |
| /* | | /* | |
| Audio File Library | | Audio File Library | |
|
| Copyright (C) 1998-1999, Michael Pruett <michael@68k.org> | | Copyright (C) 1998-2000, Michael Pruett <michael@68k.org> | |
| | | | |
| This library is free software; you can redistribute it and/or | | This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Library General Public | | modify it under the terms of the GNU Library General Public | |
| License as published by the Free Software Foundation; either | | License as published by the Free Software Foundation; either | |
| version 2 of the License, or (at your option) any later version. | | version 2 of the License, or (at your option) any later version. | |
| | | | |
| This library is distributed in the hope that it will be useful, | | This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| /* | | /* | |
| audiofile.h | | audiofile.h | |
| | | | |
| This file contains the public interfaces to the Audio File Library. | | This file contains the public interfaces to the Audio File Library. | |
| */ | | */ | |
| | | | |
| #ifndef AUDIOFILE_H | | #ifndef AUDIOFILE_H | |
| #define AUDIOFILE_H | | #define AUDIOFILE_H | |
| | | | |
| #include <sys/types.h> | | #include <sys/types.h> | |
|
| #include "aupvlist.h" | | #include <aupvlist.h> | |
| | | | |
| | | #define LIBAUDIOFILE_MAJOR_VERSION 0 | |
| | | #define LIBAUDIOFILE_MINOR_VERSION 2 | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #endif /* __cplusplus */ | | #endif /* __cplusplus */ | |
| | | | |
|
| | | /* | |
| | | AFvirtualfile is the preferred type to use; AF_VirtualFile will go | |
| | | away. | |
| | | */ | |
| | | typedef struct _AF_VirtualFile AFvirtualfile; | |
| | | typedef struct _AF_VirtualFile AF_VirtualFile; | |
| | | | |
| typedef struct _AFfilesetup *AFfilesetup; | | typedef struct _AFfilesetup *AFfilesetup; | |
| typedef struct _AFfilehandle *AFfilehandle; | | typedef struct _AFfilehandle *AFfilehandle; | |
| typedef void (*AFerrfunc)(long, const char *); | | typedef void (*AFerrfunc)(long, const char *); | |
| | | | |
| typedef off_t AFframecount; | | typedef off_t AFframecount; | |
| typedef off_t AFfileoffset; | | typedef off_t AFfileoffset; | |
| | | | |
| #define AF_NULL_FILESETUP ((struct _AFfilesetup *) 0) | | #define AF_NULL_FILESETUP ((struct _AFfilesetup *) 0) | |
| #define AF_NULL_FILEHANDLE ((struct _AFfilehandle *) 0) | | #define AF_NULL_FILEHANDLE ((struct _AFfilehandle *) 0) | |
| | | | |
| | | | |
| skipping to change at line 78 | | skipping to change at line 88 | |
| AF_BYTEORDER_LITTLEENDIAN = 502 | | AF_BYTEORDER_LITTLEENDIAN = 502 | |
| }; | | }; | |
| | | | |
| enum | | enum | |
| { | | { | |
| AF_FILE_UNKNOWN = -1, | | AF_FILE_UNKNOWN = -1, | |
| AF_FILE_RAWDATA = 0, | | AF_FILE_RAWDATA = 0, | |
| AF_FILE_AIFFC = 1, | | AF_FILE_AIFFC = 1, | |
| AF_FILE_AIFF = 2, | | AF_FILE_AIFF = 2, | |
| AF_FILE_NEXTSND = 3, | | AF_FILE_NEXTSND = 3, | |
|
| AF_FILE_WAVE = 4, | | AF_FILE_WAVE = 4 | |
| AF_FILE_BICSF = 5, | | | |
| AF_FILE_MPEG1BITSTREAM = 6, | | | |
| AF_FILE_SOUNDDESIGNER1 = 7, | | | |
| AF_FILE_SOUNDDESIGNER2 = 8, | | | |
| AF_FILE_AVR = 9, | | | |
| AF_FILE_IFF_8SVX = 10, | | | |
| AF_FILE_SAMPLEVISION = 11, | | | |
| AF_FILE_VOC = 12, | | | |
| AF_FILE_NIST_SPHERE = 13, | | | |
| AF_FILE_SOUNDFONT2 = 14 | | | |
| }; | | }; | |
| | | | |
|
| #define AF_FILE_IRCAM AF_FILE_BICSF | | | |
| | | | |
| enum | | enum | |
| { | | { | |
| AF_LOOP_MODE_NOLOOP = 0, | | AF_LOOP_MODE_NOLOOP = 0, | |
| AF_LOOP_MODE_FORW = 1, | | AF_LOOP_MODE_FORW = 1, | |
|
| AF_LOOP_MODE_FORWBACKW = 2 | | AF_LOOP_MODE_FORWBAKW = 2 | |
| }; | | }; | |
| | | | |
| enum | | enum | |
| { | | { | |
|
| AF_SAMPFMT_TWOSCOMP = 401, | | AF_SAMPFMT_TWOSCOMP = 401, /* linear two's complement */ | |
| AF_SAMPFMT_UNSIGNED = 402, | | AF_SAMPFMT_UNSIGNED = 402, /* unsigned integer */ | |
| AF_SAMPFMT_FLOAT = 403, | | AF_SAMPFMT_FLOAT = 403, /* 32-bit IEEE floating-point */ | |
| AF_SAMPFMT_DOUBLE = 404 | | AF_SAMPFMT_DOUBLE = 404 /* 64-bit IEEE double-precision floating-poi | |
| | | nt */ | |
| }; | | }; | |
| | | | |
| enum | | enum | |
| { | | { | |
| AF_INST_LOOP_OFF = 0, /* no looping */ | | AF_INST_LOOP_OFF = 0, /* no looping */ | |
| AF_INST_LOOP_CONTINUOUS = 1, /* loop continuously through decay *
/ | | AF_INST_LOOP_CONTINUOUS = 1, /* loop continuously through decay *
/ | |
| AF_INST_LOOP_SUSTAIN = 3 /* loop during sustain, then
continue */ | | AF_INST_LOOP_SUSTAIN = 3 /* loop during sustain, then
continue */ | |
| }; | | }; | |
| | | | |
| enum | | enum | |
| | | | |
| skipping to change at line 146 | | skipping to change at line 144 | |
| enum | | enum | |
| { | | { | |
| AF_MISC_UNRECOGNIZED = 0, /* unrecognized data chunk */ | | AF_MISC_UNRECOGNIZED = 0, /* unrecognized data chunk */ | |
| AF_MISC_COPY = 201, /* copyright string */ | | AF_MISC_COPY = 201, /* copyright string */ | |
| AF_MISC_AUTH = 202, /* author string */ | | AF_MISC_AUTH = 202, /* author string */ | |
| AF_MISC_NAME = 203, /* name string */ | | AF_MISC_NAME = 203, /* name string */ | |
| AF_MISC_ANNO = 204, /* annotation string */ | | AF_MISC_ANNO = 204, /* annotation string */ | |
| AF_MISC_APPL = 205, /* application-specific data */ | | AF_MISC_APPL = 205, /* application-specific data */ | |
| AF_MISC_MIDI = 206, /* MIDI exclusive data */ | | AF_MISC_MIDI = 206, /* MIDI exclusive data */ | |
| AF_MISC_PCMMAP = 207, /* PCM mapping information (future use) */ | | AF_MISC_PCMMAP = 207, /* PCM mapping information (future use) */ | |
|
| AF_MISC_NeXT = 208, /* misc binary data appended to NeXT hdr */ | | AF_MISC_NeXT = 208, /* misc binary data appended to NeXT header
*/ | |
| AF_MISC_IRCAM_PEAKAMP = 209, /* peak amplitude information */ | | AF_MISC_IRCAM_PEAKAMP = 209, /* peak amplitude information */ | |
| AF_MISC_IRCAM_COMMENT = 210, /* BICSF text comment */ | | AF_MISC_IRCAM_COMMENT = 210, /* BICSF text comment */ | |
| AF_MISC_COMMENT = 210, /* general text comment */ | | AF_MISC_COMMENT = 210, /* general text comment */ | |
| | | | |
|
| AF_MISC_ICMT = AF_MISC_COMMENT, /* comments chunk (WAV format) */ | | AF_MISC_ICMT = AF_MISC_COMMENT, /* comments chunk (WAVE format) */ | |
| AF_MISC_ICRD = 211, /* creation date (WAV format) */ | | AF_MISC_ICRD = 211, /* creation date (WAVE format) */ | |
| AF_MISC_ISFT = 212 /* software name (WAV format) */ | | AF_MISC_ISFT = 212 /* software name (WAVE format) */ | |
| }; | | }; | |
| | | | |
| enum | | enum | |
| { | | { | |
| /* supported compression schemes */ | | /* supported compression schemes */ | |
| AF_COMPRESSION_UNKNOWN = -1, | | AF_COMPRESSION_UNKNOWN = -1, | |
| AF_COMPRESSION_NONE = 0, | | AF_COMPRESSION_NONE = 0, | |
| AF_COMPRESSION_G722 = 501, | | AF_COMPRESSION_G722 = 501, | |
| AF_COMPRESSION_G711_ULAW = 502, | | AF_COMPRESSION_G711_ULAW = 502, | |
| AF_COMPRESSION_G711_ALAW = 503, | | AF_COMPRESSION_G711_ALAW = 503, | |
| | | | |
| /* Apple proprietary AIFF-C compression schemes (not supported) */ | | /* Apple proprietary AIFF-C compression schemes (not supported) */ | |
| AF_COMPRESSION_APPLE_ACE2 = 504, | | AF_COMPRESSION_APPLE_ACE2 = 504, | |
| AF_COMPRESSION_APPLE_ACE8 = 505, | | AF_COMPRESSION_APPLE_ACE8 = 505, | |
| AF_COMPRESSION_APPLE_MAC3 = 506, | | AF_COMPRESSION_APPLE_MAC3 = 506, | |
| AF_COMPRESSION_APPLE_MAC6 = 507, | | AF_COMPRESSION_APPLE_MAC6 = 507, | |
| | | | |
|
| AF_COMPRESSION_MPEG1 = 515, | | | |
| AF_COMPRESSION_AWARE_MULTIRATE = 516, | | | |
| | | | |
| AF_COMPRESSION_G726 = 517, | | AF_COMPRESSION_G726 = 517, | |
| AF_COMPRESSION_G728 = 518, | | AF_COMPRESSION_G728 = 518, | |
| AF_COMPRESSION_DVI_AUDIO = 519, | | AF_COMPRESSION_DVI_AUDIO = 519, | |
| AF_COMPRESSION_GSM = 520, | | AF_COMPRESSION_GSM = 520, | |
|
| AF_COMPRESSION_FS1016 = 521, | | AF_COMPRESSION_FS1016 = 521 | |
| | | | |
| AF_COMPRESSION_DEFAULT_MPEG_I = 508, | | | |
| AF_COMPRESSION_DEFAULT_MPEG1_LAYERI = AF_COMPRESSION_DEFAULT_MPEG_I, | | | |
| AF_COMPRESSION_DEFAULT_MPEG_II = 509, | | | |
| AF_COMPRESSION_DEFAULT_MPEG1_LAYERII = AF_COMPRESSION_DEFAULT_MPEG_I | | | |
| I, | | | |
| AF_COMPRESSION_DEFAULT_MULTIRATE = 513, | | | |
| AF_COMPRESSION_DEFAULT_LOSSLESS = 514 | | | |
| }; | | }; | |
| | | | |
| /* tokens for afQuery() -- see the man page for instructions */ | | /* tokens for afQuery() -- see the man page for instructions */ | |
| /* level 1 selectors */ | | /* level 1 selectors */ | |
| enum | | enum | |
| { | | { | |
| AF_QUERYTYPE_INSTPARAM = 500, | | AF_QUERYTYPE_INSTPARAM = 500, | |
| AF_QUERYTYPE_FILEFMT = 501, | | AF_QUERYTYPE_FILEFMT = 501, | |
| AF_QUERYTYPE_COMPRESSION = 502, | | AF_QUERYTYPE_COMPRESSION = 502, | |
| AF_QUERYTYPE_COMPRESSIONPARAM = 503, | | AF_QUERYTYPE_COMPRESSIONPARAM = 503, | |
| | | | |
| skipping to change at line 413 | | skipping to change at line 401 | |
| void *afQueryPointer (int querytype, int arg1, int arg2, int arg3, int arg4
); | | void *afQueryPointer (int querytype, int arg1, int arg2, int arg3, int arg4
); | |
| | | | |
| /* basic operations on file handles and file setups */ | | /* basic operations on file handles and file setups */ | |
| AFfilesetup afNewFileSetup (void); | | AFfilesetup afNewFileSetup (void); | |
| void afFreeFileSetup (AFfilesetup); | | void afFreeFileSetup (AFfilesetup); | |
| int afIdentifyFD (int); | | int afIdentifyFD (int); | |
| int afIdentifyNamedFD (int, const char *filename, int *implemented); | | int afIdentifyNamedFD (int, const char *filename, int *implemented); | |
| | | | |
| AFfilehandle afOpenFile (const char *filename, const char *mode, | | AFfilehandle afOpenFile (const char *filename, const char *mode, | |
| AFfilesetup setup); | | AFfilesetup setup); | |
|
| | | AFfilehandle afOpenVirtualFile(AF_VirtualFile *vfile, const char *mode, AFf
ilesetup setup); | |
| AFfilehandle afOpenFD (int fd, const char *mode, AFfilesetup setup); | | AFfilehandle afOpenFD (int fd, const char *mode, AFfilesetup setup); | |
| AFfilehandle afOpenNamedFD (int fd, const char *mode, AFfilesetup setup, | | AFfilehandle afOpenNamedFD (int fd, const char *mode, AFfilesetup setup, | |
| const char *filename); | | const char *filename); | |
| | | | |
|
| int afGetFD (AFfilehandle file); | | | |
| void afSaveFilePosition (AFfilehandle file); | | void afSaveFilePosition (AFfilehandle file); | |
| void afRestoreFilePosition (AFfilehandle file); | | void afRestoreFilePosition (AFfilehandle file); | |
| int afSyncFile (AFfilehandle file); | | int afSyncFile (AFfilehandle file); | |
| int afCloseFile (AFfilehandle file); | | int afCloseFile (AFfilehandle file); | |
| | | | |
| void afInitFileFormat (AFfilesetup, int format); | | void afInitFileFormat (AFfilesetup, int format); | |
| int afGetFileFormat (AFfilehandle, int *version); | | int afGetFileFormat (AFfilehandle, int *version); | |
| | | | |
| /* track */ | | /* track */ | |
| void afInitTrackIDs (AFfilesetup, int *trackids, int trackCount); | | void afInitTrackIDs (AFfilesetup, int *trackids, int trackCount); | |
| int afGetTrackIDs (AFfilehandle, int *trackids); | | int afGetTrackIDs (AFfilehandle, int *trackids); | |
| | | | |
| /* track data: reading, writng, seeking, sizing frames */ | | /* track data: reading, writng, seeking, sizing frames */ | |
| int afReadFrames (AFfilehandle, int track, void *buffer, int frameCount); | | int afReadFrames (AFfilehandle, int track, void *buffer, int frameCount); | |
| int afWriteFrames (AFfilehandle, int track, void *buffer, int frameCount); | | int afWriteFrames (AFfilehandle, int track, void *buffer, int frameCount); | |
| AFframecount afSeekFrame (AFfilehandle, int track, AFframecount frameoffset
); | | AFframecount afSeekFrame (AFfilehandle, int track, AFframecount frameoffset
); | |
| AFfileoffset afTellFrame (AFfilehandle, int track); | | AFfileoffset afTellFrame (AFfilehandle, int track); | |
| AFfileoffset afGetTrackBytes (AFfilehandle, int track); | | AFfileoffset afGetTrackBytes (AFfilehandle, int track); | |
| float afGetFrameSize (AFfilehandle, int track, int expand3to4); | | float afGetFrameSize (AFfilehandle, int track, int expand3to4); | |
|
| #if 0 | | | |
| float afGetVirtualFrameSize (AFfilehandle, int track, int expand3to4); | | float afGetVirtualFrameSize (AFfilehandle, int track, int expand3to4); | |
|
| #endif | | | |
| | | | |
| /* track data: AES data */ | | /* track data: AES data */ | |
| /* afInitAESChannelData is obsolete -- use afInitAESChannelDataTo() */ | | /* afInitAESChannelData is obsolete -- use afInitAESChannelDataTo() */ | |
| void afInitAESChannelData (AFfilesetup, int track); /* obsolete */ | | void afInitAESChannelData (AFfilesetup, int track); /* obsolete */ | |
| void afInitAESChannelDataTo (AFfilesetup, int track, int willBeData); | | void afInitAESChannelDataTo (AFfilesetup, int track, int willBeData); | |
| int afGetAESChannelData (AFfilehandle, int track, unsigned char buf[24]); | | int afGetAESChannelData (AFfilehandle, int track, unsigned char buf[24]); | |
| void afSetAESChannelData (AFfilehandle, int track, unsigned char buf[24]); | | void afSetAESChannelData (AFfilehandle, int track, unsigned char buf[24]); | |
| | | | |
| #if 0 | | #if 0 | |
| /* track setup format initialized via DMparams */ | | /* track setup format initialized via DMparams */ | |
| | | | |
| skipping to change at line 483 | | skipping to change at line 469 | |
| int afGetVirtualChannels (AFfilehandle, int track); | | int afGetVirtualChannels (AFfilehandle, int track); | |
| void afSetChannelMatrix (AFfilehandle, int track, double *matrix); | | void afSetChannelMatrix (AFfilehandle, int track, double *matrix); | |
| | | | |
| /* track data: sample format and sample width */ | | /* track data: sample format and sample width */ | |
| void afInitSampleFormat (AFfilesetup, int track, int sampleFormat, | | void afInitSampleFormat (AFfilesetup, int track, int sampleFormat, | |
| int sampleWidth); | | int sampleWidth); | |
| void afGetSampleFormat (AFfilehandle file, int track, int *sampfmt, | | void afGetSampleFormat (AFfilehandle file, int track, int *sampfmt, | |
| int *sampwidth); | | int *sampwidth); | |
| void afGetVirtualSampleFormat (AFfilehandle file, int track, int *sampfmt, | | void afGetVirtualSampleFormat (AFfilehandle file, int track, int *sampfmt, | |
| int *sampwidth); | | int *sampwidth); | |
|
| #if 0 | | | |
| int afSetVirtualSampleFormat (AFfilehandle, int track, | | int afSetVirtualSampleFormat (AFfilehandle, int track, | |
| int sampleFormat, int sampleWidth); | | int sampleFormat, int sampleWidth); | |
| void afGetVirtualSampleFormat (AFfilehandle, int track, | | void afGetVirtualSampleFormat (AFfilehandle, int track, | |
| int *sampleFormat, int *sampleWidth); | | int *sampleFormat, int *sampleWidth); | |
|
| #endif | | | |
| | | | |
| /* track data: sampling rate */ | | /* track data: sampling rate */ | |
| void afInitRate (AFfilesetup, int track, double rate); | | void afInitRate (AFfilesetup, int track, double rate); | |
| double afGetRate (AFfilehandle, int track); | | double afGetRate (AFfilehandle, int track); | |
| | | | |
| #if 0 | | #if 0 | |
| int afSetVirtualRate (AFfilehandle, int track, double rate); | | int afSetVirtualRate (AFfilehandle, int track, double rate); | |
| double afGetVirtualRate (AFfilehandle, int track); | | double afGetVirtualRate (AFfilehandle, int track); | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 520 | | skipping to change at line 504 | |
| | | | |
| int afSetVirtualCompression (AFfilesetup, int track, int compression); | | int afSetVirtualCompression (AFfilesetup, int track, int compression); | |
| void afSetVirtualCompressionParams (AFfilehandle, int track, int compressio
n, | | void afSetVirtualCompressionParams (AFfilehandle, int track, int compressio
n, | |
| AUpvlist params, int parameterCount); | | AUpvlist params, int parameterCount); | |
| | | | |
| int afGetVirtualCompression (AFfilesetup, int track, int compression); | | int afGetVirtualCompression (AFfilesetup, int track, int compression); | |
| void afGetVirtualCompressionParams (AFfilehandle, int track, int *compressi
on, | | void afGetVirtualCompressionParams (AFfilehandle, int track, int *compressi
on, | |
| AUpvlist params, int parameterCount); | | AUpvlist params, int parameterCount); | |
| #endif | | #endif | |
| | | | |
|
| #if 0 | | | |
| /* track data: pcm mapping */ | | /* track data: pcm mapping */ | |
| void afInitPCMMapping (AFfilesetup filesetup, int track, | | void afInitPCMMapping (AFfilesetup filesetup, int track, | |
| double slope, double intercept, double minClip, double maxClip); | | double slope, double intercept, double minClip, double maxClip); | |
| void afGetPCMMapping (AFfilehandle file, int track, | | void afGetPCMMapping (AFfilehandle file, int track, | |
| double *slope, double *intercept, double *minClip, double *maxClip); | | double *slope, double *intercept, double *minClip, double *maxClip); | |
| /* NOTE: afSetTrackPCMMapping() is special--it does not set the virtual */ | | /* NOTE: afSetTrackPCMMapping() is special--it does not set the virtual */ | |
| /* format; it changes what the AF thinks the track format is! Be careful. *
/ | | /* format; it changes what the AF thinks the track format is! Be careful. *
/ | |
| int afSetTrackPCMMapping (AFfilehandle file, int track, | | int afSetTrackPCMMapping (AFfilehandle file, int track, | |
| double slope, double intercept, double minClip, double maxClip); | | double slope, double intercept, double minClip, double maxClip); | |
| /* NOTE: afSetVirtualPCMMapping() is different from afSetTrackPCMMapping():
*/ | | /* NOTE: afSetVirtualPCMMapping() is different from afSetTrackPCMMapping():
*/ | |
| /* see comment for afSetTrackPCMMapping(). */ | | /* see comment for afSetTrackPCMMapping(). */ | |
| int afSetVirtualPCMMapping (AFfilehandle file, int track, | | int afSetVirtualPCMMapping (AFfilehandle file, int track, | |
| double slope, double intercept, double minClip, double maxClip); | | double slope, double intercept, double minClip, double maxClip); | |
| void afGetVirtualPCMMapping (AFfilehandle file, int track, | | void afGetVirtualPCMMapping (AFfilehandle file, int track, | |
| double *slope, double *intercept, double *minClip, double *maxClip); | | double *slope, double *intercept, double *minClip, double *maxClip); | |
| | | | |
|
| #endif | | | |
| | | | |
| /* track data: data offset within the file */ | | /* track data: data offset within the file */ | |
| /* initialize for raw reading only */ | | /* initialize for raw reading only */ | |
| void afInitDataOffset(AFfilesetup, int track, AFfileoffset offset); | | void afInitDataOffset(AFfilesetup, int track, AFfileoffset offset); | |
| AFfileoffset afGetDataOffset (AFfilehandle, int track); | | AFfileoffset afGetDataOffset (AFfilehandle, int track); | |
| | | | |
| /* track data: count of frames in file */ | | /* track data: count of frames in file */ | |
| void afInitFrameCount (AFfilesetup, int track, AFframecount frameCount); | | void afInitFrameCount (AFfilesetup, int track, AFframecount frameCount); | |
| AFframecount afGetFrameCount (AFfilehandle file, int track); | | AFframecount afGetFrameCount (AFfilehandle file, int track); | |
| | | | |
| /* loop operations */ | | /* loop operations */ | |
| | | | |
End of changes. 19 change blocks. |
| 44 lines changed or deleted | | 25 lines changed or added | |
|