Logo Search packages:      
Sourcecode: pwlib version File versions

PWAVFile Class Reference

#include <pwavfile.h>

Inheritance diagram for PWAVFile:

PFile PChannel PObject

List of all members.

Detailed Description

A class representing a WAV audio file.

Definition at line 247 of file pwavfile.h.


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, fmt_NotKnown = 0x10000
 PWAVFile (const PString &format, const PFilePath &name, OpenMode mode=PFile::ReadWrite, int opts=PFile::ModeDefault)
 PWAVFile (const PFilePath &name, OpenMode mode=ReadWrite, int opts=ModeDefault, unsigned format=fmt_PCM)
 PWAVFile (OpenMode mode, int opts=ModeDefault, unsigned format=fmt_PCM)
 PWAVFile (unsigned format=fmt_PCM)
 ~PWAVFile ()
static PWAVFileformat (const PString &format, PFile::OpenMode mode, int opts=PFile::ModeDefault)
static PWAVFileformat (const PString &format)

Comparison functions

enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator>= (const PObject &obj) const

Error functions

enum  ErrorGroup { LastReadError, LastWriteError, LastGeneralError, NumErrorGroups }
enum  Errors {
  NoError, NotFound, FileExists, DiskFull,
  AccessDenied, DeviceInUse, BadParameter, NoMemory,
  NotOpen, Timeout, Interrupted, BufferTooSmall,
  Miscellaneous, ProtocolFailure, NumNormalisedErrors
Errors GetErrorCode (ErrorGroup group=NumErrorGroups) const
int GetErrorNumber (ErrorGroup group=NumErrorGroups) const
virtual PString GetErrorText (ErrorGroup group=NumErrorGroups) const
static PString GetErrorText (Errors lastError, int osError=0)

File channel functions

enum  FilePositionOrigin { Start = SEEK_SET, Current = SEEK_CUR, End = SEEK_END }
 Options for the origin in setting the file position. More...
const PFilePathGetFilePath () const
BOOL GetInfo (PFileInfo &info)
virtual off_t GetLength () const
BOOL IsEndOfFile () const
void SetFilePath (const PString &path)
virtual BOOL SetLength (off_t len)
BOOL SetPermissions (int permissions)
static BOOL GetInfo (const PFilePath &name, PFileInfo &info)
static BOOL SetPermissions (const PFilePath &name, int permissions)

Miscellaneous functions

enum  ShutdownValue { ShutdownRead = 0, ShutdownWrite = 1, ShutdownReadAndWrite = 2 }
void AbortCommandString ()
BOOL SendCommandString (const PString &command)
BOOL SetBufferSize (PINDEX newSize)
virtual BOOL Shutdown (ShutdownValue option)

I/O functions

ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)
virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)

File manipulation functions

BOOL Access (OpenMode mode)
BOOL Copy (const PFilePath &newname, BOOL force=FALSE)
BOOL Exists () const
BOOL Move (const PFilePath &newname, BOOL force=FALSE)
BOOL Remove (BOOL force=FALSE)
BOOL Rename (const PString &newname, BOOL force=FALSE)
static BOOL Access (const PFilePath &name, OpenMode mode)
static BOOL Copy (const PFilePath &oldname, const PFilePath &newname, BOOL force=FALSE)
static BOOL Exists (const PFilePath &name)
static BOOL Move (const PFilePath &oldname, const PFilePath &newname, BOOL force=FALSE)
static BOOL Remove (const PFilePath &name, BOOL force=FALSE)
static BOOL Rename (const PFilePath &oldname, const PString &newname, BOOL force=FALSE)

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
virtual BOOL InternalIsDescendant (const char *clsName) const
BOOL IsClass (const char *cls) const
static const char * Class ()

Public Types

enum  PXBlockType { PXReadBlock, PXWriteBlock, PXAcceptBlock, PXConnectBlock }
enum  OpenMode { ReadOnly, WriteOnly, ReadWrite }
enum  OpenOptions {
  ModeDefault = -1, MustExist = 0, Create = 1, Truncate = 2,
  Exclusive = 4, Temporary = 8, DenySharedRead = 16, DenySharedWrite = 32

Public Member Functions

BOOL FileRead (void *buf, PINDEX len)
BOOL FileWrite (const void *buf, PINDEX len)
off_t RawGetDataLength ()
off_t RawGetPosition () const
BOOL RawRead (void *buf, PINDEX len)
BOOL RawSetPosition (off_t pos, FilePositionOrigin origin)
BOOL RawWrite (const void *buf, PINDEX len)
void SetLastReadCount (PINDEX v)
Miscellaneous functions
virtual PObjectClone () const
Overrides from class PFile
virtual BOOL Close ()
virtual off_t GetPosition () const
virtual BOOL Open (const PFilePath &name, OpenMode mode=ReadWrite, int opts=ModeDefault)
virtual BOOL Open (OpenMode mode=ReadWrite, int opts=ModeDefault)
virtual BOOL Read (void *buf, PINDEX len)
virtual BOOL SetPosition (off_t pos, FilePositionOrigin origin=Start)
virtual BOOL Write (const void *buf, PINDEX len)
Overrides from class PObject
Comparison Compare (const PObject &obj) const
Information functions
virtual PChannelGetBaseReadChannel () const
virtual PChannelGetBaseWriteChannel () const
int GetHandle () const
virtual BOOL IsOpen () const
Member variable access
virtual unsigned GetChannels () const
virtual off_t GetDataLength ()
virtual unsigned GetFormat () const
virtual PString GetFormatAsString () const
PString GetFormatString () const
off_t GetHeaderLength () const
virtual unsigned GetSampleRate () const
virtual unsigned GetSampleSize () const
BOOL IsValid () const
void SetAutoconvert ()
virtual void SetChannels (unsigned v)
virtual BOOL SetFormat (const PString &format)
virtual BOOL SetFormat (unsigned fmt)
virtual void SetSampleRate (unsigned v)
virtual void SetSampleSize (unsigned v)
Reading functions
virtual PINDEX GetLastReadCount () const
PTimeInterval GetReadTimeout () const
virtual void OnReadComplete (void *buf, PINDEX len)
virtual BOOL ReadAsync (void *buf, PINDEX len)
BOOL ReadBlock (void *buf, PINDEX len)
virtual int ReadChar ()
PString ReadString (PINDEX len)
void SetReadTimeout (const PTimeInterval &time)
Writing functions
virtual PINDEX GetLastWriteCount () const
PTimeInterval GetWriteTimeout () const
virtual void OnWriteComplete (const void *buf, PINDEX len)
void SetWriteTimeout (const PTimeInterval &time)
virtual BOOL WriteAsync (const void *buf, PINDEX len)
BOOL WriteChar (int c)
BOOL WriteString (const PString &str)
Overrides from class PChannel
virtual PString GetName () const
Overrides from class PObject
virtual PINDEX HashFunction () const

Static Public Member Functions

static BOOL ConvertOSError (int libcReturnValue, Errors &lastError, int &osError)

Public Attributes

PBYTEArray extendedHeader
PWAV::FMTChunk wavFmtChunk

Protected Member Functions

void Construct ()
virtual BOOL ConvertOSError (int libcReturnValue, ErrorGroup group=LastGeneralError)
BOOL GenerateHeader ()
BOOL ProcessHeader ()
int PXClose ()
BOOL PXSetIOBlock (PXBlockType type, const PTimeInterval &timeout)
int ReadCharWithTimeout (PTimeInterval &timeout)
BOOL ReceiveCommandString (int nextChar, const PString &reply, PINDEX &pos, PINDEX start)
void SelectFormat (const PString &format)
void SelectFormat (unsigned fmt)
BOOL SetErrorValues (Errors errorCode, int osError, ErrorGroup group=LastGeneralError)
BOOL UpdateHeader ()

Protected Attributes

BOOL autoConvert
PString channelName
BOOL header_needs_updating
Errors lastErrorCode [NumErrorGroups+1]
 The platform independant error code.
int lastErrorNumber [NumErrorGroups+1]
 The operating system error number (eg as returned by errno).
PINDEX lastReadCount
 Number of byte last read by the Read() function.
PINDEX lastWriteCount
 Number of byte last written by the Write() function.
off_t lenData
off_t lenHeader
int os_handle
 The operating system file handle return by standard open() function.
PFilePath path
 The fully qualified path name for the file.
PXBlockType px_lastBlockType
PMutex px_selectMutex
PMutex px_threadMutex
PMutex px_writeMutex
PTimeInterval readTimeout
 Timeout for read operations.
BOOL removeOnClose
 File is to be removed when closed.
PBYTEArray wavHeaderData
PTimeInterval writeTimeout
 Timeout for write operations.

Private Member Functions



class PWAVFileConverter

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index