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

aflibFile Class Reference

Base class for audio file/device reading and writing. More...

#include <aflibFile.h>

Inheritance diagram for aflibFile::

aflibAifcFile aflibAiffFile aflibAuFile aflibBladeFile aflibDevFile aflibLameFile aflibMpg123File aflibMpgFile aflibSolarisSparcDevFile aflibSoxFile aflibWavFile List of all members.

Public Methods

virtual ~aflibFile ()
 Destructor.

virtual aflibStatus afopen (const char *file, aflibConfig *cfg)
 Main API for opening a file or device in read mode. More...

virtual aflibStatus afcreate (const char *file, const aflibConfig &cfg)
 Main API for opening a file or device in write mode. More...

virtual aflibStatus afread (aflibData &data, long long position=-1)
 Main API function to read a segment of data. More...

virtual aflibStatus afwrite (aflibData &data, long long position=-1)
 Main API function to write a segment of audio data. More...

virtual bool setItem (const char *item, const void *value)
 Provides the ability to set format specific information. More...

virtual bool getItem (const char *item, void *value)
 Provides the ability to get format specific information. More...

const string& getFormat () const
 Return the current file or device format.

virtual void setInputConfig (const aflibConfig &cfg)
const aflibConfiggetInputConfig () const
void setOutputConfig (const aflibConfig &cfg)
const aflibConfiggetOutputConfig () const
void setValue1 (const string &value)
 Set a file format unique value number 1.

void setValue2 (const string &value)
 Set a file format unique value number 2.

void setValue3 (const string &value)
 Set a file format unique value number 3.

virtual bool isDataSizeSupported (aflib_data_size size)
virtual bool isEndianSupported (aflib_data_endian end)
virtual bool isSampleRateSupported (int &rate)
virtual bool isChannelsSupported (int &channels)

Static Public Methods

void returnSupportedFormats (list< string > &formats, list< string > &descriptions)
 Returns all currently supported formats. More...

aflibFile* open (aflibFileType type_enum, const string &file, aflibConfig *cfg=NULL, aflibStatus *status=NULL)
 Main static function to open a file or device for reading based on aflibFileType. More...

aflibFile* open (const string &format, const string &file, aflibConfig *cfg=NULL, aflibStatus *status=NULL)
 Main static function to open a file or device for reading based on format string. More...

aflibFile* create (aflibFileType type_enum, const string &file, const aflibConfig &cfg, aflibStatus *status=NULL)
 Main static function for writing to a device or file by type. More...

aflibFile* create (const string &format, const string &file, const aflibConfig &cfg, aflibStatus *status=NULL)
 Main static function for writing to a device or file by format. More...


Protected Methods

 aflibFile ()

Protected Attributes

long _total_size
long _one_second_size
long _current_place_size
string _value1
string _value2
string _value3

Detailed Description

Base class for audio file/device reading and writing.

This is the base class for all audio file and device objects. It provides the functionality for calling derived classes and defines the API for these derived classes. The main entry APIs are the open and create static functions. Users actually use these. This will in turn allocate an object of the proper derived class. There are no public constructors for this class. Also static is a function called returnSupportedFormats. It will return all the current supported file formats. Once an object is allocated and initialized then one can call getFormat to get the file format that is currently being used.

The functions afopen, afcreate, afread, and afwrite are all virtual and are designed to be overriden by the derived classes. Also there are three functions called setValue1, setValue2, and setValue3. These can be used to pass implementation dependant info to a file format.

This class supports the ability to dynamically load and free these derived objects. These derived objects will each be made into a library that will be loaded only when needed.

This class can be compiled with the flag NO_MODULES. If it is then the file objects will not be dynamically loaded. Instead applications will have to link against these libraries. Also only certain file formats will be supported.


Constructor & Destructor Documentation

aflibFile::~aflibFile ( ) [virtual]
 

Destructor.

aflibFile::aflibFile ( ) [protected]
 


Member Function Documentation

aflibStatus aflibFile::afcreate ( const char * file,
const aflibConfig & cfg ) [virtual]
 

Main API for opening a file or device in write mode.

This function is only used for module support. For no module support the derived classes afcreate function will be called instead. For module support this function will make a call to the derived classes function.

Reimplemented in aflibAifcFile, aflibAiffFile, aflibAuFile, aflibBladeFile, aflibLameFile, aflibMpgFile, aflibMpg123File, aflibDevFile, aflibSolarisSparcDevFile, aflibSoxFile, and aflibWavFile.

aflibStatus aflibFile::afopen ( const char * file,
aflibConfig * cfg ) [virtual]
 

Main API for opening a file or device in read mode.

This function is only used for module support. For no modules support the derived classes afopen function will be called instead. For module support this function will make a call to the derived classes function.

Reimplemented in aflibAifcFile, aflibAiffFile, aflibAuFile, aflibBladeFile, aflibLameFile, aflibMpgFile, aflibMpg123File, aflibDevFile, aflibSolarisSparcDevFile, aflibSoxFile, and aflibWavFile.

aflibStatus aflibFile::afread ( aflibData & data,
long long position = -1 ) [virtual]
 

Main API function to read a segment of data.

This function is only used for module support. For no module support the derived classes afread function will be called instead. For module support this function will make a call to the derived classes function.

Reimplemented in aflibAifcFile, aflibAiffFile, aflibAuFile, aflibBladeFile, aflibLameFile, aflibMpgFile, aflibMpg123File, aflibDevFile, aflibSolarisSparcDevFile, aflibSoxFile, and aflibWavFile.

aflibStatus aflibFile::afwrite ( aflibData & data,
long long position = -1 ) [virtual]
 

Main API function to write a segment of audio data.

This function is only used for module support. For no module support the derived classes afwrite function will be called instead. For module support this function will make a call to the derived class.

Reimplemented in aflibAifcFile, aflibAiffFile, aflibAuFile, aflibBladeFile, aflibLameFile, aflibMpgFile, aflibMpg123File, aflibDevFile, aflibSolarisSparcDevFile, aflibSoxFile, and aflibWavFile.

aflibFile * aflibFile::create ( const string & format,
const string & file,
const aflibConfig & cfg,
aflibStatus * status = NULL ) [static]
 

Main static function for writing to a device or file by format.

This is a static function of this class. Users call this function as the main API to open an audio file or device for writing. Since this is a static member function it is not associated with any aflibFile object and thus no data members can be accessed. The user passes in the file format to create. The user also specifies the file name. The specific type of audio data is specified in the cfg parameter. The status of this operation will be returned to the user as status.

aflibFile * aflibFile::create ( aflibFileType type_enum,
const string & file,
const aflibConfig & cfg,
aflibStatus * status = NULL ) [static]
 

Main static function for writing to a device or file by type.

This is a static function of this class. Users call this function as the main API to open an audio file or device for writing. Since this is a static member function it is not associated with any aflibFile object and thus no data members can be accessed. The user passes in the file type to create. The user also specifies the file name. The specific type of audio data is specified in the cfg parameter. The status of this operation will be returned to the user as status.

const string & aflibFile::getFormat ( ) const
 

Return the current file or device format.

const aflibConfig& aflibFile::getInputConfig ( ) const
 

bool aflibFile::getItem ( const char * item,
void * value ) [virtual]
 

Provides the ability to get format specific information.

This provides the ability to get specific information relating to a specific format. One passes an item that is a specific character string that will be recognized by a format. One also passes a void pointer to an allocated object of the correct type. This data will be filled with the correct information. The documentation for the specific item will say what format the data should be. TRUE will be returned if the item was processed successfully otherwise FALSE will be returned.

Reimplemented in aflibSoxFile.

const aflibConfig& aflibFile::getOutputConfig ( ) const
 

virtual bool aflibFile::isChannelsSupported ( int & channels ) [virtual]
 

Reimplemented in aflibSoxFile.

virtual bool aflibFile::isDataSizeSupported ( aflib_data_size size ) [virtual]
 

Reimplemented in aflibAifcFile, aflibAiffFile, aflibAuFile, aflibBladeFile, aflibLameFile, aflibMpgFile, aflibMpg123File, aflibDevFile, aflibSolarisSparcDevFile, aflibSoxFile, and aflibWavFile.

virtual bool aflibFile::isEndianSupported ( aflib_data_endian end ) [virtual]
 

Reimplemented in aflibAifcFile, aflibAiffFile, aflibAuFile, aflibBladeFile, aflibLameFile, aflibMpgFile, aflibMpg123File, aflibDevFile, aflibSolarisSparcDevFile, aflibSoxFile, and aflibWavFile.

virtual bool aflibFile::isSampleRateSupported ( int & rate ) [virtual]
 

Reimplemented in aflibAifcFile, aflibAiffFile, aflibAuFile, aflibBladeFile, aflibLameFile, aflibMpgFile, aflibMpg123File, aflibDevFile, aflibSolarisSparcDevFile, aflibSoxFile, and aflibWavFile.

aflibFile * aflibFile::open ( const string & format,
const string & file,
aflibConfig * cfg = NULL,
aflibStatus * status = NULL ) [static]
 

Main static function to open a file or device for reading based on format string.

This is a static function of this class. Users call this function as the main API to open an audio file or device for reading. Since this is a static member function it is not associated with any aflibFile object and thus no data members can be accessed. The user passes in the file type to be opened. This must be one of the file types supplied by the function aflibFile::returnSupportedFormats. Also passed is the file name which should contain the file and directory in which the file can be found. Passed back to the user will be a cfg structure filled that was allocated by the caller. This will tell information about the data. Also will be a status to indicate if any errors occurred.

aflibFile * aflibFile::open ( aflibFileType type_enum,
const string & file,
aflibConfig * cfg = NULL,
aflibStatus * status = NULL ) [static]
 

Main static function to open a file or device for reading based on aflibFileType.

This is a static function of this class. Users call this function as the main API to open an audio file or device for reading. Since this is a static member function it is not associated with any aflibFile object and thus no data members can be accessed. The user passes in the file type to be opened. This can be one of the defined types or AFLIB_AUTO_TYPE. This will search the list of supported formats for a match and use that format. If AFLIB_AUTO_TYPE is specified then it will open the file and use a format that matches that file type based on information supplied by each module. Also passed is the file name which should contain the file and directory in which the file can be found. Passed back to the user will be a cfg structure filled that was allocated by the caller. This will tell information about the data. Also will be a status to indicate if any errors occurred.

void aflibFile::returnSupportedFormats ( list< string > & formats,
list< string > & descriptions ) [static]
 

Returns all currently supported formats.

This public static function returns to the user two lists. The first is the list of supported formats. The second is a corresponding list of descriptions that relate to the formats returned.

virtual void aflibFile::setInputConfig ( const aflibConfig & cfg ) [virtual]
 

bool aflibFile::setItem ( const char * item,
const void * value ) [virtual]
 

Provides the ability to set format specific information.

This provides the ability to set specific information relating to a specific format. One passes an item that is a specific character string that will be recognized by a format. One also passes a void pointer to a data item that is the data to be set. The documentation for the specific item will say what format the data should be. TRUE will be returned if the item was processed successfully otherwise FALSE will be returned.

Reimplemented in aflibMpg123File, and aflibDevFile.

void aflibFile::setOutputConfig ( const aflibConfig & cfg )
 

void aflibFile::setValue1 ( const string & value )
 

Set a file format unique value number 1.

void aflibFile::setValue2 ( const string & value )
 

Set a file format unique value number 2.

void aflibFile::setValue3 ( const string & value )
 

Set a file format unique value number 3.


Member Data Documentation

long aflibFile::_current_place_size [protected]
 

long aflibFile::_one_second_size [protected]
 

long aflibFile::_total_size [protected]
 

string aflibFile::_value1 [protected]
 

string aflibFile::_value2 [protected]
 

string aflibFile::_value3 [protected]
 


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