AmAudio Class Reference

base for classes that input or output audio. More...

#include <AmAudio.h>

Inheritance diagram for AmAudio:

AmAudioBridge AmAudioDelay AmAudioFile AmAudioQueue AmConferenceChannel AmPlaylist AmRtpAudio

Public Member Functions

virtual void close ()
virtual int get (unsigned int user_ts, unsigned char *buffer, unsigned int nb_samples)
virtual int put (unsigned int user_ts, unsigned char *buffer, unsigned int size)
unsigned int getFrameSize ()
void setRecordTime (unsigned int ms)
int incRecordTime (unsigned int samples)

Protected Member Functions

 AmAudio (AmAudioFormat *)
virtual int read (unsigned int user_ts, unsigned int size)=0
virtual int write (unsigned int user_ts, unsigned int size)=0
void stereo2mono (unsigned char *out_buf, unsigned char *in_buf, unsigned int &size)
int decode (unsigned int size)
int encode (unsigned int size)
unsigned int downMix (unsigned int size)
unsigned int samples2bytes (unsigned int nb_samples)
unsigned int bytes2samples (unsigned int bytes)

Protected Attributes

DblBuffer samples
auto_ptr< AmAudioFormatfmt

Detailed Description

base for classes that input or output audio.

AmAudio binds a format and converts the samples if needed.
Internal Format: PCM signed 16 bit (mono | stereo).


Member Function Documentation

unsigned int AmAudio::bytes2samples ( unsigned int  bytes  )  [protected]

Convert the size from bytes to samples, depending on the format.

void AmAudio::close (  )  [virtual]

Closes the audio pipe.

Reimplemented in AmAudioFile, and AmPlaylist.

int AmAudio::decode ( unsigned int  size  )  [protected]

Converts from the input format to the internal format.

  • input = front buffer
  • output = back buffer
Parameters:
size [in] size in bytes
Returns:
new size in bytes

unsigned int AmAudio::downMix ( unsigned int  size  )  [protected]

Converts to mono depending on the format.

Returns:
new size in bytes

int AmAudio::encode ( unsigned int  size  )  [protected]

Converts from the internal format to the output format.

  • input = front buffer
  • output = back buffer
Parameters:
size [in] size in bytes
Returns:
new size in bytes

int AmAudio::get ( unsigned int  user_ts,
unsigned char *  buffer,
unsigned int  nb_samples 
) [virtual]

Get some samples from input stream.

Warning:
For packet based payloads / file formats, use:
           nb_sample = input buffer size / sample size of the reference format
 
whereby the format with/from which the codec works is the reference one.
Returns:
# bytes read, else -1 if error (0 is OK)

Reimplemented in AmConferenceChannel, AmPlaylist, and AmRtpAudio.

int AmAudio::put ( unsigned int  user_ts,
unsigned char *  buffer,
unsigned int  size 
) [virtual]

Put some samples to the output stream.

Warning:
For packet based payloads / file formats, use:
           nb_sample = input buffer size / sample size of the reference format
 
whereby the format with/from which the codec works is the reference one.
Returns:
# bytes written, else -1 if error (0 is OK)

Reimplemented in AmConferenceChannel, and AmPlaylist.

virtual int AmAudio::read ( unsigned int  user_ts,
unsigned int  size 
) [protected, pure virtual]

Gets 'size' bytes directly from stream (Read,Pull).

Implemented in AmAudioQueue, AmAudioBridge, AmAudioDelay, AmAudioFile, AmConferenceChannel, AmPlaylist, and AmRtpAudio.

unsigned int AmAudio::samples2bytes ( unsigned int  nb_samples  )  [protected]

Convert the size from samples to bytes, depending on the format.

void AmAudio::stereo2mono ( unsigned char *  out_buf,
unsigned char *  in_buf,
unsigned int &  size 
) [protected]

Converts a buffer from stereo to mono.

Parameters:
size [in,out] size in bytes
  • Before call is size = input size
  • After the call is size = output size

virtual int AmAudio::write ( unsigned int  user_ts,
unsigned int  size 
) [protected, pure virtual]

Puts 'size' bytes directly from stream (Write,Push).

Implemented in AmAudioQueue, AmAudioBridge, AmAudioDelay, AmAudioFile, AmConferenceChannel, AmPlaylist, and AmRtpAudio.


Field Documentation

auto_ptr<AmAudioFormat> AmAudio::fmt [protected]

Audio format.

See also:
AmAudioFormat

Sample buffer.


The documentation for this class was generated from the following files:
Generated on Thu Mar 8 00:12:45 2007 for Sems by  doxygen 1.4.7
Home |  Recent changes |  Search |  Glossary |  Sitemap |  Login