class AudioData

AudioData is the abstract base class of all classes which represent audio files

Inheritance:

AudioData


Public Classes

enum SeekMode
constants describing new position counted from where

Public Methods

AudioData(const AudioData& audata)
creates new object which encapsulates the same audio file as audata does
AudioData()
creates new audio data.
uint32 bytesInSample()
returns the number of bytes which make a sample
const AudioCache& cache()
retuns a reference the audio cache where audio data is stored for processing
AudioCache& cache()
retuns a reference the audio cache where audio data is stored for processing
uint32 channelCount()
returns the number of channels stored in the audio file
FormatCode dataFormat()
returns the format of the data stored in the audio file
uint32 dataSize()
returns the size of the audio data
const string filename()
returns the name of the audio file
const string info()
returns the description found in the audio file
virtual size_t load(size_t samples)
loads a certain number of samples from the audio file (and its stored position) into the audio cache so that further processing is faster to be done
virtual size_t loadSecs(size_t secs)
loads a given number of seconds from the audio file (and its stored position) into the audio cache so that further processing is faster to be done
AudioData& operator=(const AudioData& audata)
assigns the specified AudioData to the invoking AudioData
virtual void printOn(ostream& os)
prints the parameters of the audio file on the given output stream
uint32 samplingRate()
returns the sampling rate of the signal stored in the audio file
virtual void seek(int samples, SeekMode mode)
moves the file pointer of the audio file to a certain position, where the next processing will start
virtual void seekSecs(int secs, SeekMode mode)
moves the file pointer of the audio file to a certain position, where the next processing will start
virtual void store(ofstream& file)
stores the contents of the audio cache into the given audio file
virtual ~AudioData()
destroy the object.

Public

enum SeekMode
constants describing new position counted from where

Protected Fields

mutable ifstream file
file containing audio data.
uint32 vBytesInSample
number of bytes which make a sample. Depends on the data format.
mutable AudioCache* vCache
audio cache where data is stored for processing.
uint32 vChannelCount
number of channels stored in the audio file
FormatCode vDataFormat
format of the stored data.
uint32 vDataSize
size of the audio data (without audio header!).
string vFilename
name of the audio file.
string vInfo
description found in the audio file.
uint32 vSamplingRate
sampling rate of the signal in the audio file.

Protected Methods

virtual void close()
closes the audio file.
virtual void open(const string& filename)
opens the audio file with the given name

Documentation

AudioData is the abstract base class of all classes which represent audio files. It defines a set of methods to open and close audio files, to load and store samples etc.
AudioData uses an AudioCache object to store parts of the audio file so that processing is faster to be done.
enum SeekMode
constants describing new position counted from where.
BEG = from beginning of the data
CUR = from the current position in the audio file
END = from the end of the data.

AudioData()
creates new audio data.

AudioData(const AudioData& audata)
creates new object which encapsulates the same audio file as audata does.
Parameters:
audata - other AudioData object

AudioData& operator=(const AudioData& audata)
assigns the specified AudioData to the invoking AudioData.
Parameters:
audata - other AudioData object

virtual ~AudioData()
destroy the object.

virtual size_t load(size_t samples)
loads a certain number of samples from the audio file (and its stored position) into the audio cache so that further processing is faster to be done. Samples are converted to the format defined by the cache, before being stored in cache.
If EOF is reached, load returns the number of samples less than the given number.
Throws:
Exception , if reading faild.
Returns:
number of samples loaded
Parameters:
samples - number of samples to be load

virtual size_t loadSecs(size_t secs)
loads a given number of seconds from the audio file (and its stored position) into the audio cache so that further processing is faster to be done. Samples are converted to the format defined by the cache, before being stored in cache.
If EOF is reached, load returns the number of seconds less than the given number.
Throws:
Exception , if reading faild.
Returns:
number of seconds loaded
Parameters:
samples - number of seconds to be load

virtual void seek(int samples, SeekMode mode)
moves the file pointer of the audio file to a certain position, where the next processing will start. If the given position is beyond data beginning (beyond file end) then seek positions the file pointer at the start of the data (file end).
Throws:
Exception , if the moving fails.
Parameters:
samples - offset describing the new position (in samples)
mode - constant describing new position counted from where

virtual void seekSecs(int secs, SeekMode mode)
moves the file pointer of the audio file to a certain position, where the next processing will start. If the given position is beyond data beginning (beyond file end) then seek positions the file pointer at the start of the data (file end).
Throws:
Exception , if the moving fails.
Parameters:
samples - offset describing the new position (in seconds)
mode - constant describing new position counted from where

virtual void store(ofstream& file)
stores the contents of the audio cache into the given audio file. Samples are converted to the format defined by the invoking object, before being written.
Throws:
Exception , if writing fails.
Parameters:
file - file output stream

const string filename()
returns the name of the audio file.
Returns:
file name

uint32 dataSize()
returns the size of the audio data.
Returns:
size in bytes

FormatCode dataFormat()
returns the format of the data stored in the audio file.
Returns:
sample format

uint32 samplingRate()
returns the sampling rate of the signal stored in the audio file.
Returns:
sampling rate in Hz

uint32 bytesInSample()
returns the number of bytes which make a sample. It depends on the data format.
Returns:
number of bytes

uint32 channelCount()
returns the number of channels stored in the audio file.
Returns:
number of channels

const string info()
returns the description found in the audio file.
Returns:
information string

AudioCache& cache()
retuns a reference the audio cache where audio data is stored for processing.
Returns:
audio cache

const AudioCache& cache()
retuns a reference the audio cache where audio data is stored for processing.
Returns:
audio cache

virtual void printOn(ostream& os)
prints the parameters of the audio file on the given output stream.
Parameters:
os - output stream

virtual void open(const string& filename)
opens the audio file with the given name.
Throws:
Exception , if reading fails
Parameters:
filename - file name

virtual void close()
closes the audio file.

mutable ifstream file
file containing audio data.

string vFilename
name of the audio file.

uint32 vDataSize
size of the audio data (without audio header!).

FormatCode vDataFormat
format of the stored data.

uint32 vSamplingRate
sampling rate of the signal in the audio file.

uint32 vBytesInSample
number of bytes which make a sample. Depends on the data format.

uint32 vChannelCount
number of channels stored in the audio file

string vInfo
description found in the audio file.

mutable AudioCache* vCache
audio cache where data is stored for processing.


Direct child classes:
WaveFile
AudioFile
Author:
Silvia Pfeiffer, Peter Tomczyk
Version:
$Id: audata.h,v 1.10 1998/04/14 10:26:27 tomczyk Exp $
See Also:
AudioCache

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de