AFOPENFILE(3)
π AFOPENFILE(3) π
okay bestie, welcome to the Audio File Library glow-up zone β¨ this is the page for afOpenFile, and it's literally the moment your audio file gets a handle β like, an actual AFfilehandle β so every other call in the library has something to hold onto. no cap. π«Ά
β¨ NAME β¨
afOpenFile β open an audio file and create a file handle structure used for subsequent calls to the Audio File Library π
πΈ SYNOPSIS πΈ
#include <audiofile.h>
AFfilehandle afOpenFile(const char *path, const char *mode,
AFfilesetup setup);
π PARAMETERS π
pathβ the path to the file you wanna open. that's it, that's the vibe. ποΈmodeβ tells it how you're opening the file:"r"for reading or"w"for writing. pick your fighter. β¨setupβ anAFfilesetupcreated byafNewFileSetup(3). here's the tea though: this value is ignored for files opened for reading, except when the file format isAF_FILE_RAWDATA. so raw data is the one exception that gets to be main character. π
π RETURN VALUE π
Upon success, afOpenFile returns a valid AFfilehandle which can be used in subsequent calls to the Audio File Library. slay. π
Upon failure, afOpenFile returns NULL and generates an error. not slay. π
When you're done with the file, afCloseFile(3) is what you use to close it β don't just ghost it, bestie. π
π₯ ERRORS π₯
afOpenFile can produce the following errors β here's the full roster, no skipping:
AF_BAD_OPENβ A call toopenfailed. πAF_BAD_READβ A call toreadfailedAF_BAD_WRITEβ A call towritefailed.AF_BAD_LSEEKβ A call tolseekfailed.AF_BAD_MALLOCβ Memory allocation failed. the malloc said no πAF_BAD_FILEFMTβsetupspecifies a file format which is unsupported formode.AF_BAD_SAMPFMTβ The file's sample format is not supported.AF_BAD_WIDTHβ The file's sample width is not supported.AF_BAD_RATEβ The file's sample rate is not supported.AF_BAD_CHANNELSβ The number of channels in the file is not supported.AF_BAD_FILESETUPβsetupspecifies an invalid or unsupported configuration.
fr fr, if you get one of these, something about your file or your setup just did not pass the vibe check. π
π¦ SEE ALSO π¦
afCloseFile(3)afNewFileSetup(3)afInitFileFormat(3)afInitSampleFormat(3)afReadFrames(3)afWriteFrames(3)
π AUTHOR π
Michael Pruett <michael@68k.org> β iconic, we stan π
and that's the whole page, bestie!! this was Audio File Library 0.3.6, dated 03/06/2013, and honestly? it ate. go open that file. periodt. π
β¨πΈ
π¦ where this page comes from
- alpine 3.24: audiofile-doc 0.3.6-r3 Β· LGPL-2.1-or-later
- arch rolling: audiofile 0.3.6-12 Β· Apache-2.0 AND GPL-2.0-or-later AND LGPL-2.1-or-later
- debian bookworm: libaudiofile-dev 0.3.6-5+deb12u1 Β· LGPL-2.1-or-later
- debian trixie: libaudiofile-dev 0.3.6-7+b1 Β· LGPL-2.1-or-later
- epel 10: audiofile-devel 1:0.3.6-44.el10_2 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- epel 9: audiofile-devel 1:0.3.6-36.el9 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- fedora 43: audiofile-devel 1:0.3.6-42.fc43 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- fedora 43: audiofile-devel 1:0.3.6-42.fc43 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- fedora 44: audiofile-devel 1:0.3.6-44.fc44 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- fedora 44: audiofile-devel 1:0.3.6-44.fc44 Β· LGPL-2.1-or-later and GPL-2.0-or-later
- nixpkgs unstable: audiofile 0.3.6
- opensuse-leap 16.0: audiofile-doc 0.3.6-bp160.1.13 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: audiofile-doc 0.3.6-bp160.1.13 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: audiofile-doc 0.3.6-bp160.1.13 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: audiofile-doc 0.3.6-bp160.1.13 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- ubuntu jammy: libaudiofile-dev 0.3.6-5+deb10u1build0.22.04.1 Β· LGPL-2.1-or-later
- ubuntu jammy: libaudiofile-dev 0.3.6-5build1 Β· LGPL-2.1-or-later
- ubuntu noble: libaudiofile-dev 0.3.6-6build2 Β· LGPL-2.1-or-later
- ubuntu questing: libaudiofile-dev 0.3.6-7build1
- ubuntu resolute: libaudiofile-dev 0.3.6-7build2 Β· LGPL-2.1-or-later
- ubuntu stonking: libaudiofile-dev 0.3.6-7build2 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms