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

ost::AudioCodec Class Reference

The codec class is a virtual used for transcoding audio samples between linear frames (or other known format) and an encoded "sample" buffer. process codec interface. More...

#include <audio.h>

Inheritance diagram for ost::AudioCodec::

ost::AudioSample List of all members.

Public Methods

virtual void Encode (unsigned short *buffer, unsigned samples=0, int channel=0)=0
 Encode a linear sample frame into the codec sample buffer. More...

virtual bool Encode (AudioSample *sample)=0
 Encode an "AudioSamples" object into the new encoding scheme if conversion is supported. More...

virtual unsigned Decode (unsigned short *buffer, int channel=0)=0
 Decode the sample frame into linear samples. More...

virtual bool Decode (AudioSample *sample)=0
 Decode into an :AudioSample" if the conversion is supported. More...

virtual unsigned Load (unsigned char *data, unsigned length)
 Load a codec from a byte stream data source. More...

virtual unsigned Save (unsigned char *data, unsigned length)
 Save a codec to a byte stream data source. More...

unsigned getLength (void)
 Get current number of samples of data, based on load or encode. More...

unsigned getFrameSize (void)
 Get size of the audio frame. More...

virtual unsigned getChannels (void)
 Check if stereo/multi-channel codec. More...


Protected Methods

 AudioCodec (unsigned frames, audioencoding_t encoding, unsigned rate)

Protected Attributes

unsigned length

Detailed Description

The codec class is a virtual used for transcoding audio samples between linear frames (or other known format) and an encoded "sample" buffer. process codec interface.

This class is only abstract and describes the core interface for loadable codec modules. This class is normally merged with AudioSample. A derived AudioCodecXXX will typically include a AudioRegisterXXX static class to automatically initialize and register the codec with the codec registry.

Author:
David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

ost::AudioCodec::AudioCodec unsigned   frames,
audioencoding_t   encoding,
unsigned   rate
[protected]
 


Member Function Documentation

virtual bool ost::AudioCodec::Decode AudioSample *   sample [pure virtual]
 

Decode into an :AudioSample" if the conversion is supported.

Returns:
true if successful.
Parameters:
object   to save into.

virtual unsigned ost::AudioCodec::Decode unsigned short *   buffer,
int   channel = 0
[pure virtual]
 

Decode the sample frame into linear samples.

Returns:
number of samples extracted.
Parameters:
sample   buffer to save linear samples into.
channel   number or 0 for all channels.

virtual bool ost::AudioCodec::Encode AudioSample *   sample [pure virtual]
 

Encode an "AudioSamples" object into the new encoding scheme if conversion is supported.

Returns:
true if successful.
Parameters:
object   source.

virtual void ost::AudioCodec::Encode unsigned short *   buffer,
unsigned   samples = 0,
int   channel = 0
[pure virtual]
 

Encode a linear sample frame into the codec sample buffer.

Parameters:
linear   sample buffer to encode.
number   of samples, or use default count.
channel   number or 0 for all channels.

virtual unsigned ost::AudioCodec::Load unsigned char *   data,
unsigned   length
[virtual]
 

Load a codec from a byte stream data source.

This is used for streaming of compressed codec's where frames are of irregular sizes.

Returns:
number of bytes actually read into codec workspace.
Parameters:
pointer   to byte data stream.
number   of data bytes.

virtual unsigned ost::AudioCodec::Save unsigned char *   data,
unsigned   length
[virtual]
 

Save a codec to a byte stream data source.

This is used for streaming of compressed codec's where frames are of irregular sizes.

Returns:
number of bytes actually written to workspace.
Parameters:
pointer   to byte data stream.
size   of byte data stream.

virtual unsigned ost::AudioCodec::getChannels void   [virtual]
 

Check if stereo/multi-channel codec.

unsigned ost::AudioCodec::getFrameSize void  
 

Get size of the audio frame.

unsigned ost::AudioCodec::getLength void   [inline]
 

Get current number of samples of data, based on load or encode.

Returns:
length.


Member Data Documentation

unsigned ost::AudioCodec::length [protected]
 


The documentation for this class was generated from the following file:
Generated at Sat Nov 3 09:46:02 2001 for ccAudio by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001