Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

aflibData Class Reference

Main data class for a segment of audio data. More...

#include <aflibData.h>

List of all members.

Public Methods

 aflibData (long length)
 Constructor.

 aflibData (const aflibConfig &config, long length)
 Constructor.

 aflibData (const aflibData &data)
 Copy Constructor. More...

 ~aflibData ()
 Destructor.

aflibData& operator= (const aflibData &data)
 Assignment operator. More...

void setConfig (const aflibConfig &config)
 Set the audio configuration of the data. More...

const aflibConfiggetConfig () const
 Gets audio configuration data.

void getLength (long &length) const
 Gets length of data. This returns the number of samples. It does not matter how many channels. It only means samples no matter how many channels.

long getLength () const
 Same as getLength(length);.

void getOrigLength (long &length) const
 Get the original length. This returns the original number of samples that was used to allocate space. If the samples are adjusted down then this is the original value and not the adjusted value. It does not matter how many channels. It only means samples no matter how many channels.

long getOrigLength () const
 Same as getOrigLength(length).

void adjustLength (long length)
 Adjust size of data array. More...

void adjustTotalLength (long length)
 Adjust total size of data array. More...

long getTotalLength ()
 Gets the total length of memory that is allocated.

long getTotalAdjustLength ()
 Gets the total length of memory that is adjusted.

void* getDataPointer () const
 Get a pointer to the internal data. More...

void setSample (int sample, long position, int channel)
 Sets a sample of audio data. More...

int getSample (long position, int channel)
 Gets a sample of audio data. More...

void getMinMax (int &min_value, int &max_value) const
 Returns absolute min and max values of data type selected.

void convertToSize (aflib_data_size data_size)
 Convert data from one data size to another. More...

void convertToEndian (aflib_data_endian endian)
 Converts data from one endian format to another. More...

aflib_data_endian getHostEndian () const
 Returns endian state of this computer platform.

void zeroData ()
 This will zero all audio data in this object.


Detailed Description

Main data class for a segment of audio data.

This is the main data class that defines a segment of audio data. The length of data can be set in the constructor. The configuration of the data can also be set either in the constructor or seperately. The actual space for the data is allocated in this class and should not be freed or allocated outside this class. This class provides access to this memory via a getDataPointer function. But it is encouraged to use the getSample and setSample functions to manipulate the data. These functions are not efficient and will be made so in the future. For those who wish to use the pointer access function then a call to getTotalLength should be made first. This will tell them the total length of the allocated memory buffer. It is up to the caller to make sure one does not write or read beyond this buffer. This class also provides convience functions to manipulate data. Functions convertToSize and convertToEndian will convert from one format to another. Function zeroData will zero all audio data.

A copy constructor and assignment operator are provided so that an aflibData object can be set to the same data as another aflibData object.


Constructor & Destructor Documentation

aflibData::aflibData ( long length )
 

Constructor.

aflibData::aflibData ( const aflibConfig & config,
long length )
 

Constructor.

aflibData::aflibData ( const aflibData & data )
 

Copy Constructor.

This copy constructor will create another data object with the same data as the other one. It will have newly allocated memory with an identical configuration and data.

aflibData::~aflibData ( )
 

Destructor.


Member Function Documentation

void aflibData::adjustLength ( long length )
 

Adjust size of data array.

This allows one to adjust the size of the data array downward without allocating new data. This is useful when a data object is passed to a read file class with a certain size. If we are at the end of the file and only a portion of the data requested is available then the size of the data object can be changed downward.

void aflibData::adjustTotalLength ( long length )
 

Adjust total size of data array.

This allows one to adjust the size of the data array downward without allocating new data. This is useful when a data object is passed to a read file class with a certain size. If we are at the end of the file and only a portion of the data requested is available then the size of the data object can be changed downward. The parameter passed is in total bytes not samples

void aflibData::convertToEndian ( aflib_data_endian endian )
 

Converts data from one endian format to another.

This function will convert the data in this object to a different endian layout. If the user passes the endian layout that the data is currently in then nothing will be done.

void aflibData::convertToSize ( aflib_data_size data_size )
 

Convert data from one data size to another.

This function will convert the data in this object to a different size. It will rescale the data. If the user passes the data size that the data is currently in then nothing will be done.

const aflibConfig & aflibData::getConfig ( ) const
 

Gets audio configuration data.

void * aflibData::getDataPointer ( ) const
 

Get a pointer to the internal data.

This will return a void pointer to the internally allocated data array. One should use the setSample and getSample routines if at all possible instead of this one. Possible exceptions are the start of an audio chain such as a device or file. In that case we determine the data layout so we can just get a pointer to the data and copy the data. getTotalLength will tell the total size of the allocated memory. One should not read or write beyond this value.

aflib_data_endian aflibData::getHostEndian ( ) const
 

Returns endian state of this computer platform.

long aflibData::getLength ( ) const
 

Same as getLength(length);.

void aflibData::getLength ( long & length ) const
 

Gets length of data. This returns the number of samples. It does not matter how many channels. It only means samples no matter how many channels.

void aflibData::getMinMax ( int & min_value,
int & max_value ) const
 

Returns absolute min and max values of data type selected.

long aflibData::getOrigLength ( ) const
 

Same as getOrigLength(length).

void aflibData::getOrigLength ( long & length ) const
 

Get the original length. This returns the original number of samples that was used to allocate space. If the samples are adjusted down then this is the original value and not the adjusted value. It does not matter how many channels. It only means samples no matter how many channels.

int aflibData::getSample ( long position,
int channel )
 

Gets a sample of audio data.

This will retrieve a single data value from interval memory and return it as an int. First position begins at 0. First channel begins at 0.

long aflibData::getTotalAdjustLength ( )
 

Gets the total length of memory that is adjusted.

long aflibData::getTotalLength ( )
 

Gets the total length of memory that is allocated.

aflibData & aflibData::operator= ( const aflibData & data )
 

Assignment operator.

This will set one data object with the same data as the other one. It will have newly allocated memory with an identical configuration and data.

void aflibData::setConfig ( const aflibConfig & config )
 

Set the audio configuration of the data.

This allows one to set the audio configuration of this data class. This can be used when it was not set in the constructor or one needs to change it. Any audio data stored will be lost and a new array allocated.

void aflibData::setSample ( int sample,
long position,
int channel )
 

Sets a sample of audio data.

This stores a single sample value into the data array based on the audio configuration data. First position begins at 0. First channel begins at 0.

void aflibData::zeroData ( )
 

This will zero all audio data in this object.


The documentation for this class was generated from the following files:
Generated at Tue Aug 7 22:18:07 2001 for Open Source Audio Library Project by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001