Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

WvSpeexDecoder Class Reference

#include <wvspeex.h>

List of all members.


Detailed Description

Decodes PCM audio using the Speex audio packet format.

Inbut buffer must contain a sequence of Speex packets.

Output buffer will contain a sequence of signed 'float' type values in machine order representing unnormalized PCM audio data.

Missing audio due to lost or damaged packets may be filled in by making predictions (guesses) based on residual energy information from previous ones. The number of lost or damaged packets must be known in order to calculate how much new audio must be synthesized. This technique works well to conceal occasional dropouts but not long strings of lost packets. Still, Speech is still surprizingly recognizable with average packet losses of up to 25% to 50!

Warning: Never invoke encode() unless the input buffer contains exactly zero or one Speex packets. Speex packets do not contain any delimiters therefore it is not possible to locate the boundary between adjacent packets unless they are encapsulated as individual datagrams in some fashion. Multiple adjacent packets cannot be decoded at once.

For archival purposes or for streaming, consider using WvOggSpeexDecoder.

For encoding music or other non-speech audio, consider using WvOggVorbisDecoder.


Public Member Functions

 WvSpeexDecoder (int samplingrate, unsigned int channels=1, WvSpeex::CodecMode mode=WvSpeex::DEFAULT_MODE)
 Creates a Speex Decoder.
virtual bool missing (OBuffer &outbuf)
 Synthesizes one audio frame to compensate for a missing packet.
virtual unsigned int channels () const
 Returns the number of channels in the stream.
int samplingrate () const
 Returns the sampling rate of the stream.
virtual size_t samplesperframe () const
 Returns the number of samples per frame.
WvSpeex::CodecMode mode () const
 Returns the current encoding mode.
bool postfilter () const
 Determines if the perceptual enhancement post-filter is enabled.
void setpostfilter (bool enable)
 Enables or disables the perceptual enhancement post-filter.

Protected Member Functions

virtual bool _typedencode (IBuffer &inbuf, OBuffer &outbuf, bool flush)
virtual bool _typedfinish (OBuffer &outbuf)


Constructor & Destructor Documentation

WvSpeexDecoder::WvSpeexDecoder int  samplingrate,
unsigned int  channels = 1,
WvSpeex::CodecMode  mode = WvSpeex::DEFAULT_MODE
 

Creates a Speex Decoder.

For now, if the input bitstream is stereo, outputs the left channel only. This behaviour may change later on.

"samplingrate" is the number of samples per second, preferably one of 8000, 16000, or 32000 "channels" is number of channels (must be 1 for now), defaults to 1 "mode" is the Speex codec mode to use or WvSpeex::DEFAULT_MODE to select one automatically based on the sampling rate, this is the default


Member Function Documentation

bool WvSpeexDecoder::missing OBuffer &  outbuf  )  [virtual]
 

Synthesizes one audio frame to compensate for a missing packet.

"outbuf" is the output buffer Returns: true on success

See also:
encode

virtual unsigned int WvSpeexDecoder::channels  )  const [inline, virtual]
 

Returns the number of channels in the stream.

Returns: the number of channels, non-negative

int WvSpeexDecoder::samplingrate  )  const [inline]
 

Returns the sampling rate of the stream.

Returns: the sampling rate

virtual size_t WvSpeexDecoder::samplesperframe  )  const [inline, virtual]
 

Returns the number of samples per frame.

Returns: the frame size

WvSpeex::CodecMode WvSpeexDecoder::mode  )  const
 

Returns the current encoding mode.

Returns: the encoding mode

bool WvSpeexDecoder::postfilter  )  const
 

Determines if the perceptual enhancement post-filter is enabled.

Returns: true if it is enabled

void WvSpeexDecoder::setpostfilter bool  enable  ) 
 

Enables or disables the perceptual enhancement post-filter.

"enable" is true or false


The documentation for this class was generated from the following files:
Generated on Fri May 20 11:17:52 2005 for WvStreams by  doxygen 1.4.2