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

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

# Exponent::Audio::TAiffFileFormat< TypeName > Class Template Reference

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

List of all members.

## Detailed Description

### template<typename TypeName>
class Exponent::Audio::TAiffFileFormat< TypeName >

Specifies the aiff 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

  Documented online at http://www.borg.com/~jglatt/tech/aiff.htm

Id
  TAiffFileFormat.hpp,v 1.6 2007/02/08 21:08:09 paul Exp

Definition at line 41 of file TAiffFileFormat.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)
- TAiffFileFormat ()
- virtual bool writeData (const TAudioBuffer< TypeName > &buffer)
- virtual bool writeHeader (const typename IAudioFileFormat< TypeName >::SAudioFileFormat &format)
- virtual ~TAiffFileFormat ()

## Static Protected Member Functions

- static unsigned long foolToLong (unsigned long *ptr)
- static void get80BitFloatingPointNumber (unsigned char *buffer, unsigned long value)
- static bool isValidAiffWaveChunk (const SAiffFileFormat &format)
- static bool isValidCommChunk (const SAiffFileFormat &format)
- static bool isValidSSNDChunk (const SAiffFileFormat &format)
- static bool read80BitSampleRate (CFileStream &stream, SAiffFileFormat &diskFormat)
- static bool readFileHeader (CFileStream &stream, SAiffFileFormat &diskFormat)
- static bool write80BitSampleRate (CFileStream &stream, const unsigned long sampleRate)

## Protected Attributes

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

## Classes

- struct SAiffFileFormat
    Storeage for the file version of the aiff. More...

## Constructor & Destructor Documentation

template<typename TypeName>

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

Construction

Definition at line 48 of file TAiffFileFormat.hpp.

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

template<typename TypeName>

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

Destruction

Definition at line 56 of file TAiffFileFormat.hpp.

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

## Member Function Documentation

template<typename TypeName>

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

Close the file

Return values:

  | bool | True if closed properly, false otherwise

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

Definition at line 78 of file TAiffFileFormat.hpp.

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

template<typename TypeName>

static unsigned long Exponent::Audio::TAiffFileFormat< TypeName >::foolToLong | ( | unsigned long * | ptr | ) | `[inline, static, protected]`

Fool compiler to long swap

Parameters:

  | ptr | The unsigned char ptr

Return values:

  | unsigned | long the Unsigned long verison

Definition at line 655 of file TAiffFileFormat.hpp.

Referenced by Exponent::Audio::TAiffFileFormat< TypeName >::read80BitSampleRate().

template<typename TypeName>

static void Exponent::Audio::TAiffFileFormat< TypeName >::get80BitFloatingPointNumber | ( | unsigned char * | buffer,
|  | unsigned long | value |
| ) |  |  | `[inline, static, protected]`

Get 80 bit serial code

Parameters:

  | buffer | The buffer to write in to
  | value | The sample rate

Note:
  Why oh why did apple choose this format :S

Definition at line 565 of file TAiffFileFormat.hpp.

References DOUBLE_TO_UNSIGNED_LONG.

Referenced by Exponent::Audio::TAiffFileFormat< TypeName >::write80BitSampleRate().

template<typename TypeName>

virtual void Exponent::Audio::TAiffFileFormat< 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 90 of file TAiffFileFormat.hpp.

template<typename TypeName>

static bool Exponent::Audio::TAiffFileFormat< TypeName >::isValidAiffWaveChunk | ( | const SAiffFileFormat & | 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 467 of file TAiffFileFormat.hpp.

References Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_aiffFormatId, and Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_formId.

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

template<typename TypeName>

static bool Exponent::Audio::TAiffFileFormat< TypeName >::isValidCommChunk | ( | const SAiffFileFormat & | 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 484 of file TAiffFileFormat.hpp.

References Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_commId.

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

template<typename TypeName>

virtual bool Exponent::Audio::TAiffFileFormat< 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 102 of file TAiffFileFormat.hpp.

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

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

template<typename TypeName>

static bool Exponent::Audio::TAiffFileFormat< TypeName >::isValidSSNDChunk | ( | const SAiffFileFormat & | format | ) | `[inline, static, protected]`

Is this a valid SSND chunk

Parameters:

  | format | The format header to check

Return values:

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

Definition at line 642 of file TAiffFileFormat.hpp.

References Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_ssndId.

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

template<typename TypeName>

virtual bool Exponent::Audio::TAiffFileFormat< 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 69 of file TAiffFileFormat.hpp.

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

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

template<typename TypeName>

static bool Exponent::Audio::TAiffFileFormat< TypeName >::read80BitSampleRate | ( | CFileStream & | stream,
|  | SAiffFileFormat & | diskFormat |
| ) |  |  | `[inline, static, protected]`

Read the sample rate in to the buffer

Parameters:

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

Return values:

  | bool | True if sample rate read properly

Definition at line 498 of file TAiffFileFormat.hpp.

References Exponent::Audio::TAiffFileFormat< TypeName >::foolToLong(), Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_sampleRate, and Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_sampleRateBuffer.

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

template<typename TypeName>

virtual bool Exponent::Audio::TAiffFileFormat< 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 149 of file TAiffFileFormat.hpp.

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

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

template<typename TypeName>

static bool Exponent::Audio::TAiffFileFormat< TypeName >::readFileHeader | ( | CFileStream & | stream,
|  | SAiffFileFormat & | 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 aiff wave file format

Definition at line 397 of file TAiffFileFormat.hpp.

References Exponent::Audio::TAiffFileFormat< TypeName >::isValidAiffWaveChunk(), Exponent::Audio::TAiffFileFormat< TypeName >::isValidCommChunk(), Exponent::Audio::TAiffFileFormat< TypeName >::isValidSSNDChunk(), Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_aiffFormatId, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_bitsPerSample, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_blockSize, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_commId, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_commSize, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_formId, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_formSize, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_numberOfChannels, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_numberOfSampleFrames, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_offset, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_ssndId, Exponent::Audio::TAiffFileFormat< TypeName >::SAiffFileFormat::m_ssndSize, and Exponent::Audio::TAiffFileFormat< TypeName >::read80BitSampleRate().

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

template<typename TypeName>

virtual bool Exponent::Audio::TAiffFileFormat< 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 125 of file TAiffFileFormat.hpp.

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

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

template<typename TypeName>

static bool Exponent::Audio::TAiffFileFormat< TypeName >::write80BitSampleRate | ( | CFileStream & | stream,
|  | const unsigned long | sampleRate |
| ) |  |  | `[inline, static, protected]`

Write unsigned long to 80 bit sample rate

Parameters:

  | stream | The stream to write
  | sampleRate | The sampler ate

Return values:

  | bool | True if sample rate read properly

Definition at line 537 of file TAiffFileFormat.hpp.

References Exponent::Audio::TAiffFileFormat< TypeName >::get80BitFloatingPointNumber().

Referenced by Exponent::Audio::TAiffFileFormat< TypeName >::writeHeader().

template<typename TypeName>

virtual bool Exponent::Audio::TAiffFileFormat< 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 312 of file TAiffFileFormat.hpp.

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

template<typename TypeName>

virtual bool Exponent::Audio::TAiffFileFormat< 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 261 of file TAiffFileFormat.hpp.

References Exponent::Audio::TAiffFileFormat< TypeName >::m_stream, and Exponent::Audio::TAiffFileFormat< TypeName >::write80BitSampleRate().

## Member Data Documentation

template<typename TypeName>

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

Bit depth of files being written

Definition at line 663 of file TAiffFileFormat.hpp.

Referenced by Exponent::Audio::TAiffFileFormat< TypeName >::readData(), Exponent::Audio::TAiffFileFormat< TypeName >::readHeader(), Exponent::Audio::TAiffFileFormat< TypeName >::TAiffFileFormat(), and Exponent::Audio::TAiffFileFormat< TypeName >::writeData().

template<typename TypeName>

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

The file stream that we have

Definition at line 662 of file TAiffFileFormat.hpp.

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