#include <pwavfile.h>
Inheritance diagram for PWAVFile:
Construction | |
enum | { fmt_PCM = 1, fmt_ALaw = 6, fmt_uLaw = 7, fmt_GSM = 0x31, fmt_G728 = 0x41, fmt_G723 = 0x42, fmt_MSG7231 = 0x42, fmt_G726 = 0x64, fmt_G722 = 0x65, fmt_G729 = 0x84, fmt_VivoG7231 = 0x111, PCM_WavFile = fmt_PCM, G7231_WavFile = fmt_VivoG7231 } |
PWAVFile (unsigned format=fmt_PCM) | |
PWAVFile (OpenMode mode, int opts=ModeDefault, unsigned format=fmt_PCM) | |
PWAVFile (const PFilePath &name, OpenMode mode=ReadWrite, int opts=ModeDefault, unsigned format=fmt_PCM) | |
~PWAVFile () | |
Public Types | |
Public Member Functions | |
Overrides from class PFile | |
virtual BOOL | Read (void *buf, PINDEX len) |
virtual BOOL | Write (const void *buf, PINDEX len) |
virtual BOOL | Open (OpenMode mode=ReadWrite, int opts=ModeDefault) |
virtual BOOL | Open (const PFilePath &name, OpenMode mode=ReadWrite, int opts=ModeDefault) |
virtual BOOL | Close () |
virtual BOOL | SetPosition (off_t pos, FilePositionOrigin origin=Start) |
virtual off_t | GetPosition () const |
Member variable access | |
virtual BOOL | SetFormat (unsigned fmt) |
virtual unsigned | GetFormat () const |
virtual unsigned | GetChannels () const |
virtual unsigned | GetSampleRate () const |
virtual unsigned | GetSampleSize () const |
off_t | GetHeaderLength () const |
virtual off_t | GetDataLength () |
BOOL | IsValid () const |
Protected Member Functions | |
BOOL | ProcessHeader () |
BOOL | GenerateHeader () |
BOOL | UpdateHeader () |
Protected Attributes | |
BOOL | isValidWAV |
unsigned | format |
unsigned | numChannels |
unsigned | sampleRate |
unsigned | bitsPerSample |
off_t | lenHeader |
off_t | lenData |
BOOL | header_needs_updating |
|
When a file is opened for writing, we can specify if this is a PCM wav file or a G.723.1 wav file. |
|
Create a WAV file object but do not open it. It does not initially have a valid file name. However, an attempt to open the file using the #PFile::Open()# function will generate a unique temporary file. If a WAV file is being created, the type parameter can be used to create a PCM Wave file or a G.723.1 Wave file by using #WaveType enum#
|
|
Create a unique temporary file name, and open the file in the specified mode and using the specified options. Note that opening a new, unique, temporary file name in ReadOnly mode will always fail. This would only be usefull in a mode and options that will create the file. If a WAV file is being created, the type parameter can be used to create a PCM Wave file or a G.723.1 Wave file by using #WaveType enum# The #PChannel::IsOpen()# function may be used after object construction to determine if the file was successfully opened.
|
|
Create a WAV file object with the specified name and open it in the specified mode and with the specified options. If a WAV file is being created, the type parameter can be used to create a PCM Wave file or a G.723.1 Wave file by using #WaveType enum# The #PChannel::IsOpen()# function may be used after object construction to determine if the file was successfully opened.
|
|
Close the file before destruction. |
|
Close the file channel. If a WAV file has been written to, this will update the header to contain the correct size information.
Reimplemented from PFile. |
|
|
|
Find out the number of channels the WAV file has. Typically this is 1 for mono and 2 for stereo. |
|
Find out how many bytes of audio data there are. |
|
Find out the format of the WAV file. Eg 0x01 for PCM, 0x42 or 0x111 for G.723.1. |
|
Find out the size of WAV header presented in the file. |
|
Get the current active position in the file for the next read or write operation. The WAV header is excluded from calculation the position.
Reimplemented from PFile. |
|
Find out the sample rate of the WAV file in Hz. |
|
Find out how may bits there are per sample, eg 8 or 16. |
|
Determine if the WAV file is a valid wave file.
|
|
Open the specified WAV file name in the specified mode and with the specified options. If the file object already has an open file then it is closed. This reads (and validates) the header for existing files. For new files, it creates a new file (and header) using the type of WAV file specified in the class constructor. Note: if #mode# is StandardInput, StandardOutput or StandardError, then the #name# parameter is ignored.
Reimplemented from PFile. |
|
Open the current file in the specified mode and with the specified options. If the file object already has an open file then it is closed. If there has not been a filename attached to the file object (via #SetFilePath()#, the #name# parameter or a previous open) then a new unique temporary filename is generated.
Reimplemented from PFile. |
|
|
|
Call PFile::Read() to read in audio data and perform necessary processing such as byte-order swaping.
Reimplemented from PFile. |
|
Find out the format of the WAV file. Eg 0x01 for PCM, 0x42 or 0x111 for G.723.1. |
|
Set the current active position in the file for the next read or write operation. The #pos# variable is a signed number which is added to the specified origin. For #origin == PFile::Start# only positive values for #pos# are meaningful. For #origin == PFile::End# only negative values for #pos# are meaningful. Note that for a WAV file, the origin of the file is right after the header. That is, the WAV header is not included when perform SetPosition().
Reimplemented from PFile. |
|
|
|
Call PFile::Write() to write out audio data and perform necessary processing such as byte-order swaping.
Reimplemented from PFile. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|