- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::Audio::TWaveFileFormat< TypeName > Interface Template Reference

Inheritance diagram for Exponent::Audio::TWaveFileFormat< TypeName >:

List of all members.

## Detailed Description

### template<typename TypeName>
interface Exponent::Audio::TWaveFileFormat< TypeName >

Specifies the wave file format.

Date:
  13/04/2006

Author:
  Paul Chana

Version:
  1.0.0 Initial version

See also:
  IAudioFormat

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  TWaveFileFormat.hpp,v 1.9 2007/02/08 21:08:09 paul Exp

Definition at line 33 of file TWaveFileFormat.hpp.

## Public Member Functions

- virtual bool closeFile ()
- virtual void getFileExtension (TStringCountedPointerArray &array) const
- virtual bool isValidFormat (const CSystemString &filename) const
- virtual bool openFile (CFileStream::EStreamMode mode, const CSystemString &filename)
- virtual bool readData (TAudioBuffer< TypeName > &buffer)
- virtual bool readHeader (typename IAudioFileFormat< TypeName >::SAudioFileFormat &format)
- TWaveFileFormat ()
- virtual bool writeData (const TAudioBuffer< TypeName > &buffer)
- virtual bool writeHeader (const typename IAudioFileFormat< TypeName >::SAudioFileFormat &format)
- virtual ~TWaveFileFormat ()

## Static Protected Member Functions

- static bool isValidDataChunk (const SWaveFileFormat &format)
- static bool isValidFormatChunk (const SWaveFileFormat &format)
- static bool isValidRiffWaveChunk (const SWaveFileFormat &format)
- static bool readFileHeader (CFileStream &stream, SWaveFileFormat &diskFormat)

## Protected Attributes

- IAudioFileFormat< TypeName
  >::EBitDepth m_bitDepth
- CFileStream m_stream

## Classes

- struct SWaveFileFormat
    Storeage for the file version of the wave. More...

## Constructor & Destructor Documentation

template<typename TypeName>

Exponent::Audio::TWaveFileFormat< TypeName >::TWaveFileFormat | ( |  | ) | `[inline]`

Construction

Definition at line 40 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::m_bitDepth.

template<typename TypeName>

virtual Exponent::Audio::TWaveFileFormat< TypeName >::~TWaveFileFormat | ( |  | ) | `[inline, virtual]`

Destruction

Definition at line 48 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::m_stream.

## Member Function Documentation

template<typename TypeName>

virtual bool Exponent::Audio::TWaveFileFormat< TypeName >::closeFile | ( |  | ) | `[inline, virtual]`

Close the file

Return values:

  | bool | True if closed properly, false otherwise

Implements Exponent::Audio::IAudioFileFormat< TypeName >.

Definition at line 70 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::m_stream.

template<typename TypeName>

virtual void Exponent::Audio::TWaveFileFormat< TypeName >::getFileExtension | ( | TStringCountedPointerArray & | array | ) | const`[inline, virtual]`

Get the extension of the file format, each array entry sould contain one string

Parameters:

  | array | The array to fill in

Implements Exponent::Audio::IAudioFileFormat< TypeName >.

Definition at line 82 of file TWaveFileFormat.hpp.

template<typename TypeName>

static bool Exponent::Audio::TWaveFileFormat< TypeName >::isValidDataChunk | ( | const SWaveFileFormat & | format | ) | `[inline, static, protected]`

Is this a valid data chunk

Parameters:

  | format | The format header to check

Return values:

  | bool | True if the format has a valid data chunk

Definition at line 540 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_dataId.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::readFileHeader().

template<typename TypeName>

virtual bool Exponent::Audio::TWaveFileFormat< TypeName >::isValidFormat | ( | const CSystemString & | filename | ) | const`[inline, virtual]`

Check if a file is a valid format of this file format

Parameters:

  | filename | The name of the file to load

Return values:

  | bool | True if the file format matches (checks actual binary data, not just extension

Definition at line 92 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::readFileHeader().

Referenced by Exponent::Audio::TAudioFile< TypeName >::readFile().

template<typename TypeName>

static bool Exponent::Audio::TWaveFileFormat< TypeName >::isValidFormatChunk | ( | const SWaveFileFormat & | format | ) | `[inline, static, protected]`

Is this a valid format chunk

Parameters:

  | format | The format header to check

Return values:

  | bool | True if the format has a valid format chunk

Definition at line 527 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_formatId.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::readFileHeader().

template<typename TypeName>

static bool Exponent::Audio::TWaveFileFormat< TypeName >::isValidRiffWaveChunk | ( | const SWaveFileFormat & | format | ) | `[inline, static, protected]`

Is this a valid riff wave

Parameters:

  | format | The format header to check

Return values:

  | bool | True if riff wave file format

Definition at line 510 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_riffFormatId, and Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_riffId.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::readFileHeader().

template<typename TypeName>

virtual bool Exponent::Audio::TWaveFileFormat< TypeName >::openFile | ( | CFileStream::EStreamMode | mode,
|  | const CSystemString & | filename |
| ) |  |  | `[inline, virtual]`

Open the file

Parameters:

  | mode | The mode of opening, read or write
  | filename | The name of the file to open

Return values:

  | bool | True if stream is opened

Definition at line 61 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::m_stream.

Referenced by Exponent::Audio::TAudioFile< TypeName >::readFile(), and Exponent::Audio::TAudioFile< TypeName >::writeFile().

template<typename TypeName>

virtual bool Exponent::Audio::TWaveFileFormat< TypeName >::readData | ( | TAudioBuffer< TypeName > & | buffer | ) | `[inline, virtual]`

Read the entire audio file to the provided audio buffer

Parameters:

  | buffer | The data buffer to store te samples in

Return values:

  | bool | True if read correctly, false otherwise

Implements Exponent::Audio::IAudioFileFormat< TypeName >.

Definition at line 140 of file TWaveFileFormat.hpp.

References FREE_ARRAY_POINTER, Exponent::Audio::TAudioBuffer< TypeName >::getBufferSize(), Exponent::Audio::TAudioBuffer< TypeName >::getMutableData(), Exponent::Audio::TWaveFileFormat< TypeName >::m_bitDepth, and Exponent::Audio::TWaveFileFormat< TypeName >::m_stream.

Referenced by Exponent::Audio::TAudioFile< TypeName >::readFile().

template<typename TypeName>

static bool Exponent::Audio::TWaveFileFormat< TypeName >::readFileHeader | ( | CFileStream & | stream,
|  | SWaveFileFormat & | diskFormat |
| ) |  |  | `[inline, static, protected]`

Is this a valid riff wave

Parameters:

  | stream | The stream to read
  | diskFormat | The format header to check

Return values:

  | bool | True if riff wave file format

Definition at line 376 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::isValidDataChunk(), Exponent::Audio::TWaveFileFormat< TypeName >::isValidFormatChunk(), Exponent::Audio::TWaveFileFormat< TypeName >::isValidRiffWaveChunk(), Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_bitsPerSample, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_blockAlignment, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_bytesPerSecond, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_dataId, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_dataSize, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_formatId, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_formatSize, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_formatTag, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_numberOfChannels, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_numberOfSamples, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_riffFormatId, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_riffId, Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_riffSize, and Exponent::Audio::TWaveFileFormat< TypeName >::SWaveFileFormat::m_sampleRate.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::isValidFormat(), and Exponent::Audio::TWaveFileFormat< TypeName >::readHeader().

template<typename TypeName>

virtual bool Exponent::Audio::TWaveFileFormat< TypeName >::readHeader | ( | typename IAudioFileFormat< TypeName >::SAudioFileFormat & | format | ) | `[inline, virtual]`

Read the header information and store a copy in the format

Parameters:

  | format | On return is filled with the values for this audio file

Return values:

  | bool | True if read the header correctly, false otherwise

Definition at line 115 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::m_bitDepth, Exponent::Audio::TWaveFileFormat< TypeName >::m_stream, and Exponent::Audio::TWaveFileFormat< TypeName >::readFileHeader().

Referenced by Exponent::Audio::TAudioFile< TypeName >::readFile().

template<typename TypeName>

virtual bool Exponent::Audio::TWaveFileFormat< TypeName >::writeData | ( | const TAudioBuffer< TypeName > & | buffer | ) | `[inline, virtual]`

Write the entire audio file to the provided audio buffer

Parameters:

  | buffer | The data buffer to store

Return values:

  | bool | True if written correctly, false otherwise

Implements Exponent::Audio::IAudioFileFormat< TypeName >.

Definition at line 289 of file TWaveFileFormat.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::getData(), Exponent::Audio::TAudioBuffer< TypeName >::getNumberOfChannels(), Exponent::Audio::TAudioBuffer< TypeName >::getNumberOfSamples(), Exponent::Audio::TWaveFileFormat< TypeName >::m_bitDepth, and Exponent::Audio::TWaveFileFormat< TypeName >::m_stream.

Referenced by Exponent::Audio::TAudioFile< TypeName >::writeFile().

template<typename TypeName>

virtual bool Exponent::Audio::TWaveFileFormat< TypeName >::writeHeader | ( | const typename IAudioFileFormat< TypeName >::SAudioFileFormat & | format | ) | `[inline, virtual]`

Write the header information and from the format

Parameters:

  | format | The format to write in

Return values:

  | bool | True if wrote the header correctly, false otherwise

Definition at line 248 of file TWaveFileFormat.hpp.

References Exponent::Audio::TWaveFileFormat< TypeName >::m_bitDepth, and Exponent::Audio::TWaveFileFormat< TypeName >::m_stream.

Referenced by Exponent::Audio::TAudioFile< TypeName >::writeFile().

## Member Data Documentation

template<typename TypeName>

IAudioFileFormat<TypeName>::EBitDepth Exponent::Audio::TWaveFileFormat< TypeName >::m_bitDepth`[protected]`

Bit depth of files being written

Definition at line 551 of file TWaveFileFormat.hpp.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::readData(), Exponent::Audio::TWaveFileFormat< TypeName >::readHeader(), Exponent::Audio::TWaveFileFormat< TypeName >::TWaveFileFormat(), Exponent::Audio::TWaveFileFormat< TypeName >::writeData(), Exponent::Audio::TAudioFile< TypeName >::writeFile(), and Exponent::Audio::TWaveFileFormat< TypeName >::writeHeader().

template<typename TypeName>

CFileStream Exponent::Audio::TWaveFileFormat< TypeName >::m_stream`[protected]`

The file stream that we have

Definition at line 550 of file TWaveFileFormat.hpp.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::closeFile(), Exponent::Audio::TWaveFileFormat< TypeName >::openFile(), Exponent::Audio::TWaveFileFormat< TypeName >::readData(), Exponent::Audio::TWaveFileFormat< TypeName >::readHeader(), Exponent::Audio::TWaveFileFormat< TypeName >::writeData(), Exponent::Audio::TWaveFileFormat< TypeName >::writeHeader(), and Exponent::Audio::TWaveFileFormat< TypeName >::~TWaveFileFormat().