class AudioFile : public AudioData

AudioFile represents a SUN-au file

Inheritance:

AudioFile < AudioData


Public Methods

AudioFile(const AudioFile& aufile)
creates new AudioFile which encapsulates the same audio file as the specified object do
explicit AudioFile(const string& filename)
creates an instance of AudioFile for the SUN-au file having the given name
uint32 dataLocation()
returns the location of audio data in the file
uint32 headerID()
returns the header ID
size_t load(size_t samples)
Implementation of load for SUN-au files.
size_t loadSecs(size_t secs)
Implementation of loadSecs for SUN-au files.
void seek(int samples, SeekMode mode)
Implementation of seek for SUN-au files.
void seekSecs(int secs, SeekMode mode)
Implementation of seekSecs for SUN-au files.
void store(ofstream& file)
Implementation of store for SUN-au files.
~AudioFile()
destroy the object.

Protected Fields

static const int expLut[]
Conversion table: lin16 to expot.
static const Sample ulawTable[]
Conversion table: u-law to lin16.
uint32 vDataLocation
Position of audio data in the audio file.
uint32 vHeaderID
Header found in audio data.

Protected Methods

Sample calcSampAmp(Byte* buf)
converts sample amplitude stored in certain bytes to a single value
void calcSampCode(Sample samp, Byte* buf)
stores single sample into a buffer
void close()
Implementation of close for SUN-au files.
bool isSND(Byte header[4])
checks if the given array contains the SND-header
Byte lin2ulaw(Sample sample)
converts a Sample value to u-law value
void open(const string& filename)
Implementation of open for SUN-au files.
uint32 packBytes(Byte* bytes)
converts an integer stored in a 4 byte buffer in a 32 bit unsigned integer value
Byte* swapInt32(Byte cp[4])
swap the array contents: [0,1,2,3] is now [3,2,1,0]
Sample ulaw2lin(int i)
converts a u-law value to Sample format

Inherited from AudioData:

Public Classes

enum SeekMode

Public Methods

uint32 bytesInSample()
AudioCache& cache()
const AudioCache& cache()
uint32 channelCount()
FormatCode dataFormat()
uint32 dataSize()
const string filename()
const string info()
AudioData& operator=(const AudioData& audata)
virtual void printOn(ostream& os)
uint32 samplingRate()

Public

enum SeekMode

Protected Fields

mutable ifstream file
uint32 vBytesInSample
mutable AudioCache* vCache
uint32 vChannelCount
FormatCode vDataFormat
uint32 vDataSize
string vFilename
string vInfo
uint32 vSamplingRate

Documentation

AudioFile represents a SUN-au file. It implements the interface defined by AudioData.
explicit AudioFile(const string& filename)
creates an instance of AudioFile for the SUN-au file having the given name.
Throws:
Exception , if reading faild
Parameters:
filename - name of a SUN-au file

AudioFile(const AudioFile& aufile)
creates new AudioFile which encapsulates the same audio file as the specified object do.
Parameters:
aufile - other AudioFile object

~AudioFile()
destroy the object.

size_t load(size_t samples)
Implementation of load for SUN-au files.

size_t loadSecs(size_t secs)
Implementation of loadSecs for SUN-au files.

void seek(int samples, SeekMode mode)
Implementation of seek for SUN-au files.

void seekSecs(int secs, SeekMode mode)
Implementation of seekSecs for SUN-au files.

void store(ofstream& file)
Implementation of store for SUN-au files.

uint32 headerID()
returns the header ID.
Returns:
ID (4 byte unsinged)

uint32 dataLocation()
returns the location of audio data in the file.
Returns:
absolute position in bytes

void open(const string& filename)
Implementation of open for SUN-au files.

void close()
Implementation of close for SUN-au files.

Sample calcSampAmp(Byte* buf)
converts sample amplitude stored in certain bytes to a single value.
Throws:
Exception , if there is no conversion method for the data format
Returns:
single amplitude value
Parameters:
buf - buffer where the sample is stored

Sample ulaw2lin(int i)
converts a u-law value to Sample format.
Returns:
Sample value
Parameters:
i - u-law value

void calcSampCode(Sample samp, Byte* buf)
stores single sample into a buffer.
Throws:
Exception , if there is no conversion method for the data format
Parameters:
samp - single sample
buf - array of bytes

Byte lin2ulaw(Sample sample)
converts a Sample value to u-law value.
Returns:
8 bit u-law sample
Parameters:
sample - 16 bit linear sample

uint32 packBytes(Byte* bytes)
converts an integer stored in a 4 byte buffer in a 32 bit unsigned integer value.
Returns:
32 bit unsigned integer
Parameters:
bytes - array containing 4 bytes

Byte* swapInt32(Byte cp[4])
swap the array contents: [0,1,2,3] is now [3,2,1,0].
Returns:
swapped array
Parameters:
cp - array containing 4 bytes

bool isSND(Byte header[4])
checks if the given array contains the SND-header.
Returns:
true if header is SND-header
Parameters:
header - array containing 4 bytes

uint32 vHeaderID
Header found in audio data.

uint32 vDataLocation
Position of audio data in the audio file.

static const Sample ulawTable[]
Conversion table: u-law to lin16.

static const int expLut[]
Conversion table: lin16 to expot.


This class has no child classes.
Author:
Silvia Pfeiffer, Peter Tomczyk
Version:
$Id: aufile.h,v 1.8 1998/04/14 10:26:27 tomczyk Exp $

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