Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

QwavWaveDataInterface Class Reference

Interface for accessing the sound data and informations about it. More...

#include <qwavwavedatainterface.h>

Inheritance diagram for QwavWaveDataInterface:

Inheritance graph
[legend]
Collaboration diagram for QwavWaveDataInterface:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual float sampleRate (void) const=0
virtual long nrOfSamples (void) const=0
virtual uint nrOfChannels (void) const=0
virtual bool readFile (const string &filename)=0 throw (FileOpenError,FileReadError)
virtual bool writeFile (const string &filename)=0 throw (FileOpenError,FileReadError)
virtual QwavPeakInfo getPeak (QwavPeakInterpolator *s, int pixel, int nPixels, Float zoomFac=1.0, uint channel=1) const=0
virtual const Float & operator[] (uint index) const=0
virtual bool isOpen () const=0

Detailed Description

Interface for accessing the sound data and informations about it.

The WaveDataInterface is an abstract interface class and can be derived to implement sound data/information access via different sound libraries (e.g. libaudiofile, libsndfile, ..). All methods in this class are pure virtual and have to be implemented in subclasses.

Information about the sound data can be obtained by

isOpen() informs about sound data is already being read by readFile(). To write the sound data into a file use writeFile().

The sound data can be directly accesed using operator[]().

The QwavPeakInfo for a particular pixel can be obtained using getPeak().

See also:
QwavLibSndfileWaveData
Author:
Peter Eschler


Member Function Documentation

virtual QwavPeakInfo QwavWaveDataInterface::getPeak QwavPeakInterpolator   s,
int    pixel,
int    nPixels,
Float    zoomFac = 1.0,
uint    channel = 1
const [pure virtual]
 

Returns the peak for pixel using the QwavPeakInterpolator s according to the current nPixels and the zoomFac. The peak is returned for the given channel.

Returns:
the peak info

Implemented in QwavLibSndfileWaveData, and QwavVorbisWaveData.

virtual bool QwavWaveDataInterface::isOpen   const [pure virtual]
 

Returns true when the waveform is open, otherwise false.

Returns:
true when the waveform is open, otherwise false.

Implemented in QwavLibSndfileWaveData, and QwavVorbisWaveData.

virtual uint QwavWaveDataInterface::nrOfChannels void    const [pure virtual]
 

Returns the number of channels of the waveform.

Returns:
the number of channels

Implemented in QwavLibSndfileWaveData, and QwavVorbisWaveData.

virtual long QwavWaveDataInterface::nrOfSamples void    const [pure virtual]
 

Returns the number of samples of the waveform.

Returns:
the number of samples

Implemented in QwavLibSndfileWaveData, and QwavVorbisWaveData.

virtual const Float& QwavWaveDataInterface::operator[] uint    index const [pure virtual]
 

Returns the pcm value at index of this waveform.

The parameter index is not range checked for speed reason.

The format of the returned pcm value depends on the setting in defines.h. The default is float, thus value are in the interval [-1,1].

Todo:
extend this to stereo waveforms
Parameters:
index  the index of the value to return
Returns:
the pcm value

Implemented in QwavLibSndfileWaveData, and QwavVorbisWaveData.

virtual bool QwavWaveDataInterface::readFile const string &    filename throw (FileOpenError,FileReadError) [pure virtual]
 

Opens the soundfile filename.

Parameters:
filename  the filename of the waveform
Returns:
true if filename opened succesfully, if open failed an exception is thrown
Exceptions:
FileOpenError  is thrown when an error occurred while opening the file
FileReadError  is thrown when an error occurred while reading the file
Todo:
rename this to readFile

add a parameter doPeakUpdate=true

Implemented in QwavLibSndfileWaveData, and QwavVorbisWaveData.

virtual float QwavWaveDataInterface::sampleRate void    const [pure virtual]
 

Returns the sample rate of the waveform.

Returns:
the sample rate

Implemented in QwavLibSndfileWaveData, and QwavVorbisWaveData.

virtual bool QwavWaveDataInterface::writeFile const string &    filename throw (FileOpenError,FileReadError) [pure virtual]
 

Writes the sound data to the the file filename.

Parameters:
filename  the filename
Exceptions:
FileOpenError  is thrown when an error occured during opening the file for writing

Implemented in QwavLibSndfileWaveData, and QwavVorbisWaveData.


The documentation for this class was generated from the following file:
Generated on Mon Jan 20 00:24:56 2003 for Qwav by doxygen1.2.16