1AFOPENFILE(3) AFOPENFILE(3)
2
3
4
6 afOpenFile - open an audio file and create a file handle structure used
7 for subsequent calls to the Audio File Library
8
10 #include <audiofile.h>
11
12 AFfilehandle afOpenFile(const char *path, const char *mode,
13 AFfilesetup setup);
14
16 path is the path to the file to be opened.
17
18 mode specifies a mode for opening the file: "r" for reading or "w" for
19 writing.
20
21 setup is an AFfilesetup created by afNewFileSetup(3). This value is
22 ignored for files opened for reading except when the file format is
23 AF_FILE_RAWDATA.
24
26 Upon success, afOpenFile returns a valid AFfilehandle which can be used
27 in subsequent calls to the Audio File Library. Upon failure, afOpenFile
28 returns NULL and generates an error.
29
30 afCloseFile(3) is used to close the file when it is no longer needed.
31
33 afOpenFile can produce the following errors:
34
35 AF_BAD_OPEN
36 A call to open failed.
37
38 AF_BAD_READ
39 A call to read failed
40
41 AF_BAD_WRITE
42 A call to write failed.
43
44 AF_BAD_LSEEK
45 A call to lseek failed.
46
47 AF_BAD_MALLOC
48 Memory allocation failed.
49
50 AF_BAD_FILEFMT
51
52 setup specifies a file format which is unsupported for mode.
53
54 AF_BAD_SAMPFMT
55 The file’s sample format is not supported.
56
57 AF_BAD_WIDTH
58 The file’s sample width is not supported.
59
60 AF_BAD_RATE
61 The file’s sample rate is not supported.
62
63 AF_BAD_CHANNELS
64 The number of channels in the file is not supported.
65
66 AF_BAD_FILESETUP
67
68 setup specifies an invalid or unsupported configuration.
69
71 afCloseFile(3), afNewFileSetup(3), afInitFileFormat(3),
72 afInitSampleFormat(3), afReadFrames(3), afWriteFrames(3)
73
75 Michael Pruett <michael@68k.org>
76
77
78
79Audio File Library 0.3.6 03/06/2013 AFOPENFILE(3)