WavFile Class Reference

`#include <WavFile.h>`

Inheritance diagram for WavFile:

## Public Member Functions

| WavFile (void)
| WavFile (BinaryIO *io)
| ~WavFile (void)
void | read (BinaryIO *io)
void | write (void)
std::list< CvrStgFile::Property > | getProperties (void) const
unsigned long | getNumSamples (void) const
void | replaceSample (const SamplePos pos, const SampleValue *s)
SampleValue * | getSampleValue (SamplePos pos) const
std::vector< SampleValueAdjacencyList * > | calcSVAdjacencyLists (const std::vector< SampleValue * > &svs) const
std::vector< MatchingAlgorithm * > | getMatchingAlgorithms (Graph *g, Matching *m) const
unsigned short | getBitsPerSample (void) const
Public Member Functions inherited from CvrStgFile
| CvrStgFile (void)
virtual | ~CvrStgFile (void)
void | transform (const std::string &fn)
const std::string & | getName (void) const
bool | is_std (void) const
unsigned long | getCapacity (void) const
std::string | getHRCapacity (void) const
unsigned short | getSamplesPerVertex (void) const
UWORD32 | getRadius (void) const
EmbValue | getEmbValueModulus (void) const
virtual EmbValue | getEmbeddedValue (const SamplePos pos) const

## Private Member Functions

void | readheaders (void)
void | readdata (void)
void | writeheaders (void)
void | writedata (void)
void | calcpos (SamplePos n, unsigned long *bytepos, unsigned short *firstbitpos) const
unsigned short | getFirstBitPosinSample (void)
unsigned short | getBytesPerSample (void)

## Private Attributes

WavChunkHeader * | riffchhdr
char | id_wave [4]
WavFormatChunk * | FormatChunk
WavChunkHeader * | datachhdr
std::vector< unsigned char > | data_small
| this std::vector contains the wav data if BitsPerSample <= 8
std::vector< int > | data_large
| this std::vector contains the wav data if BitsPerSample >8
std::vector< WavChunkUnused * > | UnusedBeforeData
std::vector< BYTE > | UnusedAfterData

## Static Private Attributes

static const signed short | FormatPCM = 1
static const unsigned short | SamplesPerVertex = 2
static const UWORD32 | Radius_small = 1
static const UWORD32 | Radius_large = 20
static const EmbValue | EmbValueModulus = 2

## Additional Inherited Members

Static Public Member Functions inherited from CvrStgFile
static CvrStgFile * | readFile (const std::string &fn)
Protected Member Functions inherited from CvrStgFile
void | setSamplesPerVertex (unsigned short spv)
void | setRadius (UWORD32 r)
void | setEmbValueModulus (EmbValue m)
void | setBinIO (BinaryIO *io)
BinaryIO * | getBinIO (void) const

## Constructor & Destructor Documentation

## WavFile() [1/2]

WavFile::WavFile | ( | void |  | ) |

## WavFile() [2/2]

WavFile::WavFile | ( | BinaryIO * | io | ) |

## ~WavFile()

WavFile::~WavFile | ( | void |  | ) |

## Member Function Documentation

## calcpos()

void WavFile::calcpos | ( | SamplePos | n,
|  | unsigned long * | bytepos,
|  | unsigned short * | firstbitpos ) const

private

## calcSVAdjacencyLists()

std::vector< SampleValueAdjacencyList * > WavFile::calcSVAdjacencyLists | ( | const std::vector< SampleValue * > & | svs | ) | const

virtual

calculate a vector a SampleValueAdjacencyLists

Parameters

  svs | a vector of unique(!) sample values where svs[i]->getLabel() == i holds for all i

Returns
  a vector of SampleValueAdjacencyLists where retval[i] only contains sample values with getEmbValue() == i

Every row in the adjacency lists must be sorted in the following order: The first sample value has the least distance to the source sample value, the last has the largest distance. If two sample values in one row have the same distance to the source sample value, the order does not matter.

May be overridden in derived class to provide a faster version.

Reimplemented from CvrStgFile.

## getBitsPerSample()

unsigned short WavFile::getBitsPerSample | ( | void |  | ) | const

## getBytesPerSample()

unsigned short WavFile::getBytesPerSample | ( | void |  | ) |

private

## getFirstBitPosinSample()

unsigned short WavFile::getFirstBitPosinSample | ( | void |  | ) |

private

get the position of the first bit (of the first byte) containing the actual sample data

Returns
  the bit position (where 0 is the lsb and 7 the msb)

## getMatchingAlgorithms()

std::vector< MatchingAlgorithm * > WavFile::getMatchingAlgorithms | ( | Graph * | g,
|  | Matching * | m ) const

virtual

get recommended list of matching algorithms

Parameters

  m | an empty matching - will be used in construction of MatchingAlgorithm objects

The MatchingAlgorithm objects returned by this function should be deleted by the caller if they are no longer needed.

Reimplemented from CvrStgFile.

## getNumSamples()

unsigned long WavFile::getNumSamples | ( | void |  | ) | const

virtual

get the number of samples in this CvrStgObject

Implements CvrStgObject.

## getProperties()

std::list< CvrStgFile::Property > WavFile::getProperties | ( | void |  | ) | const

virtual

Implements CvrStgFile.

## getSampleValue()

SampleValue * WavFile::getSampleValue | ( | SamplePos | pos | ) | const

virtual

get the sample at position pos

Parameters

  pos | the position of a sample (must be in 0...getNumSamples()-1)

Returns
  the sample at the given position

The sample object is created in this function and should be deleted by the caller. The derived class should check the condition(s) given above in its Implementation of this function.

Implements CvrStgObject.

## read()

void WavFile::read | ( | BinaryIO * | io | ) |

virtual

Reimplemented from CvrStgFile.

## readdata()

void WavFile::readdata | ( | void |  | ) |

private

## readheaders()

void WavFile::readheaders | ( | void |  | ) |

private

## replaceSample()

void WavFile::replaceSample | ( | const SamplePos | pos,
|  | const SampleValue * | s )

virtual

replace a sample thus (possibly) altering the value of the bit returned by SampleValue->getBit()

Parameters

  pos | the position of the sample (must be in 0...getNumSamples()-1)
  s | the sample value that should replace the current sample value (must be of correct type for this CvrStgObject)

The derived class should check the condition(s) given above in its Implementation of this function.

Implements CvrStgObject.

## write()

void WavFile::write | ( | void |  | ) |

virtual

Reimplemented from CvrStgFile.

## writedata()

void WavFile::writedata | ( | void |  | ) |

private

## writeheaders()

void WavFile::writeheaders | ( | void |  | ) |

private

## Member Data Documentation

## data_large

std::vector<int> WavFile::data_large

private

## data_small

std::vector<unsigned char> WavFile::data_small

private

## datachhdr

WavChunkHeader* WavFile::datachhdr

private

## EmbValueModulus

const EmbValue WavFile::EmbValueModulus = 2

static private

## FormatChunk

WavFormatChunk* WavFile::FormatChunk

private

## FormatPCM

const signed short WavFile::FormatPCM = 1

static private

## id_wave

char WavFile::id_wave[4]

private

## Radius_large

const UWORD32 WavFile::Radius_large = 20

static private

## Radius_small

const UWORD32 WavFile::Radius_small = 1

static private

## riffchhdr

WavChunkHeader* WavFile::riffchhdr

private

## SamplesPerVertex

const unsigned short WavFile::SamplesPerVertex = 2

static private

## UnusedAfterData

std::vector<BYTE> WavFile::UnusedAfterData

private

## UnusedBeforeData

std::vector<WavChunkUnused*> WavFile::UnusedBeforeData

private

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

- WavFile.h
- WavFile.cc