| 1 |
afOpenFile(3) |
| 2 |
============= |
| 3 |
|
| 4 |
NAME |
| 5 |
---- |
| 6 |
afOpenFile - open an audio file and create a file handle structure used |
| 7 |
for subsequent calls to the Audio File Library |
| 8 |
|
| 9 |
SYNOPSIS |
| 10 |
-------- |
| 11 |
#include <audiofile.h> |
| 12 |
|
| 13 |
AFfilehandle afOpenFile(const char *path, const char *mode, |
| 14 |
AFfilesetup setup); |
| 15 |
|
| 16 |
PARAMETERS |
| 17 |
---------- |
| 18 |
'path' is the path to the file to be opened. |
| 19 |
|
| 20 |
'mode' specifies a mode for opening the file: `"r"` for reading or |
| 21 |
`"w"` for writing. |
| 22 |
|
| 23 |
'setup' is an AFfilesetup created by linkaf:afNewFileSetup[3]. This value |
| 24 |
is ignored for files opened for reading except when the file format is |
| 25 |
`AF_FILE_RAWDATA`. |
| 26 |
|
| 27 |
RETURN VALUE |
| 28 |
------------ |
| 29 |
Upon success, `afOpenFile` returns a valid `AFfilehandle` which can |
| 30 |
be used in subsequent calls to the Audio File Library. Upon failure, |
| 31 |
`afOpenFile` returns NULL and generates an error. |
| 32 |
|
| 33 |
linkaf:afCloseFile[3] is used to close the file when it is no longer |
| 34 |
needed. |
| 35 |
|
| 36 |
ERRORS |
| 37 |
------ |
| 38 |
`afOpenFile` can produce the following errors: |
| 39 |
|
| 40 |
`AF_BAD_OPEN`:: A call to `open` failed. |
| 41 |
`AF_BAD_READ`:: A call to `read` failed |
| 42 |
`AF_BAD_WRITE`:: A call to `write` failed. |
| 43 |
`AF_BAD_LSEEK`:: A call to `lseek` failed. |
| 44 |
`AF_BAD_MALLOC`:: Memory allocation failed. |
| 45 |
`AF_BAD_FILEFMT`:: `setup` specifies a file format which is unsupported for `mode`. |
| 46 |
`AF_BAD_SAMPFMT`:: The file's sample format is not supported. |
| 47 |
`AF_BAD_WIDTH`:: The file's sample width is not supported. |
| 48 |
`AF_BAD_RATE`:: The file's sample rate is not supported. |
| 49 |
`AF_BAD_CHANNELS`:: The number of channels in the file is not supported. |
| 50 |
`AF_BAD_FILESETUP`:: `setup` specifies an invalid or unsupported configuration. |
| 51 |
|
| 52 |
SEE ALSO |
| 53 |
-------- |
| 54 |
linkaf:afCloseFile[3], |
| 55 |
linkaf:afNewFileSetup[3], |
| 56 |
linkaf:afInitFileFormat[3], |
| 57 |
linkaf:afInitSampleFormat[3], |
| 58 |
linkaf:afReadFrames[3], |
| 59 |
linkaf:afWriteFrames[3] |
| 60 |
|
| 61 |
AUTHOR |
| 62 |
------ |
| 63 |
Michael Pruett <[email protected]> |