Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

afopenfile(3) [centos man page]

AFOPENFILE(3)															     AFOPENFILE(3)

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 is the path to the file to be opened. mode specifies a mode for opening the file: "r" for reading or "w" for writing. setup is an AFfilesetup created by afNewFileSetup(3). This value is ignored for files opened for reading except when the file format is AF_FILE_RAWDATA. RETURN VALUE
Upon success, afOpenFile returns a valid AFfilehandle which can be used in subsequent calls to the Audio File Library. Upon failure, afOpenFile returns NULL and generates an error. afCloseFile(3) is used to close the file when it is no longer needed. ERRORS
afOpenFile can produce the following errors: AF_BAD_OPEN A call to open failed. AF_BAD_READ A call to read failed AF_BAD_WRITE A call to write failed. AF_BAD_LSEEK A call to lseek failed. AF_BAD_MALLOC Memory allocation failed. AF_BAD_FILEFMT setup specifies a file format which is unsupported for mode. 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 setup specifies an invalid or unsupported configuration. SEE ALSO
afCloseFile(3), afNewFileSetup(3), afInitFileFormat(3), afInitSampleFormat(3), afReadFrames(3), afWriteFrames(3) AUTHOR
Michael Pruett <michael@68k.org> Audio File Library 0.3.6 03/06/2013 AFOPENFILE(3)

Check Out this Related Man Page

libaudiofile(3) 						C Library Functions						   libaudiofile(3)

NAME
libaudiofile - audio file library SYNOPSIS
#include <audiofile.h> #include <aupvlist.h> #include <af_vfs.h> DESCRIPTION
The audio file library provides a uniform programming interface to standard digital audio file formats. This library allows the processing of audio data to and from audio files of many common formats (currently AIFF, AIFF-C, WAVE, NeXT/Sun .snd/.au, and IRCAM). The library also supports compression (currently G.711 mu-law, A-law, IMA, and MS ADPCM) as well as PCM formats of all flavors (signed and unsigned integer, floating point and double-precision floating point). audiofile.h contains all of the public interfaces to the library. aupvlist.h contains the interfaces to the parameter value list data structures and routines. af_vfs.h should only be included if using audio file library through virtual file operations. EXTENDED DESCRIPTION
One premise of the audio file library is that the data presented to an application need not be in the same format as the data contained in the file. Another, however, is that the capabilities of the file format are exposed to the application programmer should the programmer wish to take advantage of them. To read from a file containing audio data, you typically use the following sequence of function calls: AFfilehandle afOpenFile (const char *filename, const char *mode, AFfilesetup setup); int afReadFrames (AFfilehandle, int track, void *buffer, int frameCount); int afCloseFile (AFfilehandle file); To write to a file, you typically use a similar sequence of commands: AFfilesetup afNewFileSetup (void); AFfilehandle afOpenFile (const char *filename, const char *mode, AFfilesetup setup); int afWriteFrames (AFfilehandle, int track, const void *buffer, int frameCount); int afCloseFile (AFfilehandle file); Data format transparency is achieved in the audio file library by providing the data in a virtual format. The virtual format consists of a virtual byte order and a virtual sample format. Virtual byte order is by default set to the host byte order and does not depend on the native byte order of the file format being used. Virtual sample format is by default in an uncompressed format. The current audio file library does not support the concept of a virtual sampling rate, but this may be supported in the future. At present, the audio file library supports only CCITT G.711 mu-law/A-law compression. An audio file is manipulated through the AFfilehandle opaque data type. Calls to the library are made with this file handle as an argument. When opening a file for writing, another opaque data structure called AFfilesetup is used. This structure is then passed to calls that set various file parameters at the time the file is created, such as its file type and data format. Such properties cannot be modified for an existing file. Functions The following functions are available through the library: afNewFileSetup Create a file setup structure. afFreeFileSetup Free a file setup structure. afOpenFile Create a file handle structure given a file name and optionally a file setup. afCloseFile Close an open audio file. afSyncFile Update an audio file that has been opened for writing. afSetVirtual{ByteOrder,CSetnvirtualMformat,forpaudiomdata within a specified track. afInit{ByteOrder,ChannelSetaparametersoofaan AFfilesetup structure which will be used to open an audio file for writing. afQuery Query regarding the capabilities of the audio file library. afQueryLong Query whether the data is of type long. afQueryPointer Query whether the data is of type pointer. afQueryDouble Query whether the data is of type double. afSetLoop* The group of functions that set loop parameters. afGetLoop* The group of functions that get loop parameters. afSetMark* The group of functions that set mark parameters. afGetMark* The group of functions that get mark parameters. afSetInst* The group of functions that set instrument parameters. afGetInst* The group of functions that get instrument parameters. afGetAESChannelData Get AES channel data for a given audio file. afSetAESChannelData Set AES channel data for a given audio file. afInitAESChannelData Specify that storage space is to be allocated for AES channel status data in a given audio file. afInitAESChannelDataTo Specify whether storage space is to be allocated for AES channel status data in a given audio file. FILES
The following files are used by this application: /usr/libaudiofile.so Audio file shared library /usr/include/audiofile.h Public interfaces C header file /usr/include/aupvlist.h Parameter value list C header file /usr/include/af_vfs.h Virtual File System C header file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-audio | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
audiofile-config(1), libesd(3), attributes(5) NOTES
Written by Ghee Teo, Sun Microsystems Inc., 2003. This library is provided as an Open Source project by Silicon Graphics. SunOS 5.11 3 Apr2003 libaudiofile(3)
Man Page