1 | The purpose of the Audio File Library is to provide transparency to |
---|
2 | the programmer of file formats and data formats. |
---|
3 | |
---|
4 | BASICS |
---|
5 | |
---|
6 | Audio files contain a sequence of amplitudes sampled at a particular |
---|
7 | rate, called the sampling frequency. The method by which sounds can |
---|
8 | be acquired or generated in this manner is referred to as pulse-code |
---|
9 | modulation (PCM). The representation of these amplitudes varies from |
---|
10 | one file format to another. Common representations for these data are |
---|
11 | two's complement integers, unsigned integers, and floating-point |
---|
12 | numbers. |
---|
13 | |
---|
14 | For uncompressed audio, a track within an audio file consists of a |
---|
15 | sequence of frames, each of which contains a number of samples equal to |
---|
16 | the number of channels in the track. For example, in a stereo track, |
---|
17 | every frame contains two samples. |
---|
18 | |
---|
19 | To read from a file containing audio data, the following sequence of |
---|
20 | function calls are typically used: |
---|
21 | |
---|
22 | afOpenFile |
---|
23 | afReadFrames |
---|
24 | afCloseFile |
---|
25 | |
---|
26 | To write to a file, a similar sequence of commands is typically |
---|
27 | employed: |
---|
28 | |
---|
29 | afNewFileSetup |
---|
30 | afOpenFile |
---|
31 | afWriteFrames |
---|
32 | afCloseFile |
---|
33 | |
---|
34 | Data format transparency is achieved in the Audio File Library by |
---|
35 | providing the data in a virtual format. The virtual format consists of |
---|
36 | a virtual byte order and a virtual sample format. Virtual byte order |
---|
37 | is by default set to the host byte order and does not depend on the |
---|
38 | native byte order of the file format being used. Virtual sample format |
---|
39 | is by default in an uncompressed format. |
---|
40 | |
---|
41 | The current Audio File Library does not support the concept of a virtual |
---|
42 | sampling rate, but this may be supported in the future. |
---|
43 | |
---|
44 | At the present, the Audio File Library supports only CCITT G.711 |
---|
45 | mu-law/A-law compression. |
---|
46 | |
---|
47 | PROGRAMMING PARADIGM |
---|
48 | |
---|
49 | An audio file is manipulated through the AFfilehandle opaque data |
---|
50 | type. Calls to the library are made with this file handle as an |
---|
51 | argument. When opening a file for writing, another opaque data |
---|
52 | structure called AFfilsetup is used. This structure is then passed to |
---|
53 | calls which set various file parameters which are set at the time the |
---|
54 | file is created, such as its file type and data format; such |
---|
55 | properties cannot be modified for an existing file. |
---|
56 | |
---|
57 | FUNCTIONS |
---|
58 | |
---|
59 | Calls available through the library include the following: |
---|
60 | |
---|
61 | afNewFileSetup - create a file setup structure |
---|
62 | afFreeFileSetup - free a file setup structure |
---|
63 | afOpenFile - create a file handle structure given a file name and |
---|
64 | optionally a file setup |
---|
65 | afCloseFile - close an open audio file |
---|
66 | afSyncFile - update an audio file which has been opened for writing |
---|
67 | afSetVirtual{ByteOrder,Channels,PCMMapping,SampleFormat} - set virtual |
---|
68 | format for audio data within a specified track |
---|
69 | afInit{ByteOrder,Channels,Rate,SampleFormat} - set parameters of an |
---|
70 | AFfilesetup structure which will be used to open an audio file for |
---|
71 | writing |
---|
72 | |
---|
73 | afQuery - query regarding the capabilities of the Audio File Library |
---|
74 | afQueryLong |
---|
75 | afQueryPointer |
---|
76 | afQueryDouble |
---|
77 | |
---|
78 | afSetLoop* - set loop parameters |
---|
79 | afGetLoop* - get loop parameters |
---|
80 | |
---|
81 | afSetMark* - set mark parameters |
---|
82 | afGetMark* - get mark parameters |
---|
83 | |
---|
84 | afSetInst* - set instrument parameters |
---|
85 | afGetInst* - get instrument parameters |
---|
86 | |
---|
87 | afGetAESChannelData - get AES channel data for a given audio file |
---|
88 | afSetAESChannelData - set AES channel data for a given audio file |
---|
89 | afInitAESChannelData - specify that storage space is to be allocated |
---|
90 | for AES channel status data in a given audio file |
---|
91 | afInitAESChannelDataTo - specify whether storage space is to be allocated |
---|
92 | for AES channel status data in a given audio file |
---|