sipxmedialib  Version 3.3
Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
MpAudioBuf Struct Reference

Buffer for raw audio data. More...

#include <MpAudioBuf.h>

Inheritance diagram for MpAudioBuf:
Inheritance graph
[legend]
Collaboration diagram for MpAudioBuf:
Collaboration graph
[legend]

Public Member Functions

Manipulators
void setSpeechType (MpSpeechType type)
 Set audio data type. More...
 
bool setSamplesNumber (int samplesNum)
 Set current number of samples in audio data. More...
 
void setTimecode (unsigned timecode)
 Set time code for this frame. More...
 
void setAmplitude (MpAudioSample amplitude)
 Set amplitude of the data in the buffer. More...
 
void setClipping (UtlBoolean clipping)
 Is data in the buffer clipped? More...
 
void setEnergy (int energy)
 Set normalized frame energy level. More...
 
void setSpeechParams (const MpSpeechParams &params)
 Set all speech parameters at once. More...
 
Accessors
MpSpeechType getSpeechType () const
 Get audio data type. More...
 
const MpAudioSamplegetSamplesPtr () const
 Get pointer to audio data. More...
 
MpAudioSamplegetSamplesWritePtr ()
 Get writable pointer to audio data. More...
 
unsigned getSamplesNumber () const
 Get current number of samples in audio data. More...
 
unsigned getTimecode () const
 Get time code for this frame. More...
 
MpAudioSample getAmplitude () const
 Get amplitude of the data in the buffer. More...
 
UtlBoolean getClipping () const
 Is data in the buffer clipped? More...
 
int getEnergy () const
 Get normalized frame energy. More...
 
const MpSpeechParamsgetSpeechParams () const
 Get speech parameters as a structure (const version) More...
 
MpSpeechParamsgetSpeechParams ()
 Get speech parameters as a structure. More...
 
Inquiry
int compareSamples (const MpAudioBufPtr &frame, unsigned int tolerance=0) const
 compare two frames of audio to see if they are the same or similar More...
 
- Public Member Functions inherited from MpDataBuf
void setData (const MpArrayBufPtr &pData)
 Set new payload data. More...
 
char * getDataWritePtr ()
 Return pointer to payload data. More...
 
const char * getDataPtr () const
 Return pointer to payload data. More...
 
MpArrayBufPtr getData () const
 Get payload data. More...
 
- Public Member Functions inherited from MpBuf
void attach ()
 Increments reference counter. More...
 
void detach ()
 Decrements reference counter and free buffer if needed. More...
 
void setFlowGraph (MpFlowGraphBase *flowgraph)
 
MP_BUFFERS_TREE getType () const
 Get buffer type. More...
 
MpBufPoolgetBufferPool () const
 Get parent pool of this buffer. More...
 

Static Public Attributes

static MpBufPoolsmpDefaultPool = NULL
 Default pool for this type of buffer. More...
 
- Static Public Attributes inherited from MpDataBuf
static MpBufPoolsmpDefaultPool = NULL
 Default pool for MpDataBuf objects. More...
 

Protected Member Functions

void init ()
 This is called in place of constructor. More...
 
- Protected Member Functions inherited from MpDataBuf
void init ()
 This is called in place of constructor. More...
 

Protected Attributes

MpSpeechParams mParams
 Parameters of the frame data. More...
 
- Protected Attributes inherited from MpDataBuf
MpArrayBufPtr mpData
 Payload data. More...
 
- Protected Attributes inherited from MpBuf
MP_BUFFERS_TREE mType
 Buffer class type. Used for type safety. More...
 
int mRefCounter
 Reference counter for use with MpBufPtr. More...
 
MpBufPoolmpPool
 Parent memory pool. More...
 
MpFlowGraphBasempFlowGraph
 Debug pointer to flowgraph in which this buf is used. More...
 
void(* mpDestroy )(MpBuf *)
 
void(* mpInitClone )(MpBuf *)
 

Private Member Functions

 MpAudioBuf (const MpBuf &)
 Disable copy (and other) constructor. More...
 
MpAudioBufoperator= (const MpBuf &)
 Disable assignment operator. More...
 

Friends

class MpAudioBufPtr
 

Additional Inherited Members

- Static Protected Member Functions inherited from MpDataBuf
static void sDestroy (MpBuf *pBuffer)
 Destructor for MpDataBuf. More...
 
static void sInitClone (MpBuf *pBuffer)
 Function that initialize buffer after cloning. It makes clone of mpData. More...
 
- Static Protected Member Functions inherited from MpBuf
static void sInitClone (MpBuf *pBuffer)
 Function that initialize buffer after cloning. It adjusts reference counters. More...
 

Detailed Description

Buffer for raw audio data.

This is only the header for audio data. It contain some speech-related parameters and pointer to external data (cause it is based on MpDataBuf).

Constructor & Destructor Documentation

MpAudioBuf ( const MpBuf )
private

Disable copy (and other) constructor.

This struct will be initialized by init() member.

Member Function Documentation

void setSpeechType ( MpSpeechType  type)
inline

Set audio data type.

bool setSamplesNumber ( int  samplesNum)
inline

Set current number of samples in audio data.

Set data size with MpAudioSample size kept in mind.

See also
MpArrayBuf::setDataSize() for more details
void setTimecode ( unsigned  timecode)
inline

Set time code for this frame.

void setAmplitude ( MpAudioSample  amplitude)
inline

Set amplitude of the data in the buffer.

void setClipping ( UtlBoolean  clipping)
inline

Is data in the buffer clipped?

void setEnergy ( int  energy)
inline

Set normalized frame energy level.

void setSpeechParams ( const MpSpeechParams params)
inline

Set all speech parameters at once.

MpSpeechType getSpeechType ( ) const
inline

Get audio data type.

const MpAudioSample* getSamplesPtr ( ) const
inline

Get pointer to audio data.

MpAudioSample* getSamplesWritePtr ( )
inline

Get writable pointer to audio data.

unsigned getSamplesNumber ( ) const
inline

Get current number of samples in audio data.

unsigned getTimecode ( ) const
inline

Get time code for this frame.

MpAudioSample getAmplitude ( ) const
inline

Get amplitude of the data in the buffer.

UtlBoolean getClipping ( ) const
inline

Is data in the buffer clipped?

int getEnergy ( ) const
inline

Get normalized frame energy.

const MpSpeechParams& getSpeechParams ( ) const
inline

Get speech parameters as a structure (const version)

MpSpeechParams& getSpeechParams ( )
inline

Get speech parameters as a structure.

int compareSamples ( const MpAudioBufPtr frame,
unsigned int  tolerance = 0 
) const

compare two frames of audio to see if they are the same or similar

Parameters
tolerance- the allowed difference between the corresponding samples in the two frames which are considered to still be the same.
Returns
0, positive or negative value. Zero means the samples are similar within the tolerance.
void init ( )
protected

This is called in place of constructor.

MpAudioBuf& operator= ( const MpBuf )
private

Disable assignment operator.

Buffers may be copied. But do we need this?

Friends And Related Function Documentation

friend class MpAudioBufPtr
friend

Member Data Documentation

MpBufPool * smpDefaultPool = NULL
static

Default pool for this type of buffer.

MpSpeechParams mParams
protected

Parameters of the frame data.