#include <bayonneaudio.h>
Inheritance diagram for AudioFile:

Public Member Functions | |
| AudioFile (const char *fname, unsigned long samples=0) | |
| AudioFile (const char *fname, Info *info, unsigned long min=0) | |
| AudioFile () | |
| virtual | ~AudioFile () |
| void | open (const char *fname, Mode m=modeWrite, timeout_t framing=0) |
| Open an audio file and associate it with this object. | |
| void | create (const char *fname, Info *info, bool exclusive=false, timeout_t framing=0) |
| Create a new audio file and associate it with this object. | |
| void | close (void) |
| Returns age since last prior access. | |
| void | clear (void) |
| Clear the AudioFile structure. | |
| int | getBuffer (void *addr, unsigned len) |
| Retrieve bytes from the file into a memory buffer. | |
| unsigned | getLinear (Linear buffer, unsigned request) |
| Retrieve and convert content to linear encoded audio data from it's original form. | |
| int | putBuffer (void *attr, unsigned len) |
| Insert bytes into the file from a memory buffer. | |
| unsigned | putLinear (Linear buffer, unsigned request) |
| Convert and store content from linear encoded audio data to the format of the audio file. | |
| Error | getSamples (void *addr, unsigned samples) |
| Retrieve samples from the file into a memory buffer. | |
| Error | putSamples (void *addr, unsigned samples) |
| Insert samples into the file from a memory buffer. | |
| Error | skip (long samples) |
| Error | setPosition (unsigned long samples=~0l) |
| Error | setLimit (unsigned long samples=0l) |
| Error | getInfo (Info *info) |
| Error | setMinimum (unsigned long samples) |
| unsigned long | getAbsolutePosition (void) |
| Get the current file pointer in bytes relative to the start of the file. | |
| unsigned long | getPosition (void) |
| Get the current file pointer in samples relative to the start of the sample buffer. | |
| virtual bool | isOpen (void) |
| virtual bool | hasPositioning (void) |
| Encoding | getEncoding (void) |
| Format | getFormat (void) |
| unsigned | getSampleRate (void) |
| char * | getAnnotation (void) |
| Error | getError (void) |
| bool | operator! (void) |
| bool | isSigned (void) |
| Return if the current content is signed or unsigned samples. | |
Protected Member Functions | |
| void | initialize (void) |
| void | getWaveFormat (int size) |
| virtual bool | afCreate (const char *path, bool exclusive=false) |
| virtual bool | afOpen (const char *path, Mode m=modeWrite) |
| virtual bool | afPeek (unsigned char *data, unsigned size) |
| AudioCodec * | getCodec (void) |
| virtual int | afRead (unsigned char *data, unsigned size) |
| Read a given number of bytes from the file, starting from the current file pointer. | |
| virtual int | afWrite (unsigned char *data, unsigned size) |
| Write a number of bytes into the file at the current file pointer. | |
| virtual bool | afSeek (unsigned long pos) |
| Seek to the given position relative to the start of the file and set the file pointer. | |
| virtual void | afClose (void) |
| virtual char * | getContinuation (void) |
| const char * | getErrorStr (Error err) |
| Return a human-readable error message given a numeric error code of type Audio::Error. | |
| Error | setError (Error err) |
| unsigned long | getHeader (void) |
| unsigned short | getShort (unsigned char *data) |
| void | setShort (unsigned char *data, unsigned short value) |
| unsigned long | getLong (unsigned char *data) |
| void | setLong (unsigned char *data, unsigned long value) |
Protected Attributes | |
| char * | pathname |
| Error | error |
| Info | info |
| unsigned long | header |
| unsigned long | minimum |
| unsigned long | length |
| union { | |
| int fd | |
| void * handle | |
| } | file |
| Mode | mode |
| unsigned long | iolimit |
This class provides file level access to audio data stored in different formats. This class also provides the ability to write audio data into a disk file.
|
||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Read a given number of bytes from the file, starting from the current file pointer. May be overridden by derived classes.
|
|
|
Seek to the given position relative to the start of the file and set the file pointer. This does not use 64-bit clean seek functions, so seeking to positions greater than (2^32)-1 will result in undefined behavior.
|
|
||||||||||||
|
Write a number of bytes into the file at the current file pointer. May be overridden by derived classes.
|
|
|
Clear the AudioFile structure. Called by AudioFile::close(). Sets all fields to zero and deletes the dynamically allocated memory pointed to by the pathname and info.annotation members. See AudioFile::initialize() for the dynamic allocation code. |
|
|
Returns age since last prior access. Used for cache computations. / time_t getAge(void); /** Close an object associated with an open file. This updates the header metadata with the file length if the file length has changed. |
|
||||||||||||||||||||
|
Create a new audio file and associate it with this object. Called implicitly by the three-argument version of the constructor.
|
|
|
Get the current file pointer in bytes relative to the start of the file. See getPosition() to determine the position relative to the start of the sample buffer.
|
|
|
|
|
||||||||||||
|
Retrieve bytes from the file into a memory buffer. This increments the file pointer so subsequent calls read further bytes. If you want to read a number of samples rather than bytes, use getSamples().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return a human-readable error message given a numeric error code of type Audio::Error.
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Retrieve and convert content to linear encoded audio data from it's original form.
|
|
|
|
|
|
Get the current file pointer in samples relative to the start of the sample buffer. Note that you must multiply this result by the result of a call to toBytes(info.encoding, 1) in order to determine the offset in bytes.
|
|
|
|
|
||||||||||||
|
Retrieve samples from the file into a memory buffer. This increments the file pointer so subsequent calls read further samples. If a limit has been set using setLimit(), the number of samples read will be truncated to the limit position. If you want to read a certain number of bytes rather than a certain number of samples, use getBuffer().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return if the current content is signed or unsigned samples.
|
|
||||||||||||||||
|
Open an audio file and associate it with this object. Called implicitly by the two-argument version of the constructor.
|
|
|
|
|
||||||||||||
|
Insert bytes into the file from a memory buffer. This increments the file pointer so subsequent calls append further samples. If you want to write a number of samples rather than bytes, use putSamples().
|
|
||||||||||||
|
Convert and store content from linear encoded audio data to the format of the audio file.
|
|
||||||||||||
|
Insert samples into the file from a memory buffer. This increments the file pointer so subsequent calls append further samples. If you want to write a certain number of bytes rather than a certain number of samples, use putBuffer().
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.4.4