Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages | Examples

ArSpeechSynth Class Reference

#include <ArSpeech.h>

List of all members.


Detailed Description

Abstract interface to speech synthesis.

This class defines the abstract interface for speech synthesizers used with Aria. Implementations are provided in the separate ArSpeechSynth_Cepstral and ArSpeechSynth_Festival libraries. This class provides a common-denominator interface. Implementations (especially ArCepstral) may support more features, or behave differently; refer to their documentation for more information.

Definition at line 46 of file ArSpeech.h.

Public Member Functions

 ArSpeechSynth ()
virtual int getAudioSampleRate ()=0
ArRetFunctorC< bool, ArSpeechSynth > * getInitCallback ()
ArFunctorC< ArSpeechSynth > * getInterruptCallback ()
ArRetFunctor2C< bool, ArSpeechSynth,
const char *, const char * > * 
getSpeakCallback (void)
virtual bool init (void)=0
virtual void interrupt ()=0
virtual void lock ()
void setAudioCallback (ArRetFunctor2< bool, ArTypes::Byte2 *, int > *cb)
virtual void setAudioSampleRate (int rate)=0
virtual bool speak (const char *str, const char *voiceParams=NULL)
virtual bool speak (const char *str, const char *voiceParams, ArRetFunctor2< bool, ArTypes::Byte2 *, int > *audioOutputCB, unsigned short sampleRate=0)=0
virtual bool speakf (const char *fmt,...)=0
virtual void unlock ()

Protected Attributes

ArRetFunctor2< bool, ArTypes::Byte2 *,
int > * 
myAudioPlaybackCB
 If set, send audio to this callback instead of playing it directly.
ArRetFunctorC< bool, ArSpeechSynthmyInitCB
ArFunctorC< ArSpeechSynthmyInterruptCB
ArRetFunctor2C< bool, ArSpeechSynth,
const char *, const char * > 
mySpeakCB


Constructor & Destructor Documentation

ArSpeechSynth::ArSpeechSynth  ) 
 

Don't forget to call this from derived classes.

Definition at line 31 of file ArSpeech.cpp.


Member Function Documentation

ArRetFunctorC< bool, ArSpeechSynth > * ArSpeechSynth::getInitCallback  ) 
 

Returns:
a functor for use with ArSoundsQueue

Definition at line 43 of file ArSpeech.cpp.

ArFunctorC< ArSpeechSynth > * ArSpeechSynth::getInterruptCallback  ) 
 

Returns:
a functor for interrupt()

Definition at line 54 of file ArSpeech.cpp.

ArRetFunctor2C< bool, ArSpeechSynth, const char *, const char * > * ArSpeechSynth::getSpeakCallback void   ) 
 

Returns:
a functor for use with ArSoundsQueue

Definition at line 48 of file ArSpeech.cpp.

virtual bool ArSpeechSynth::init void   )  [pure virtual]
 

Perform synthesizer initialization, if neccesary. You must call this method.

virtual void ArSpeechSynth::interrupt  )  [pure virtual]
 

If any speech is currently ongoing, interrupt it.

virtual void ArSpeechSynth::lock  )  [inline, virtual]
 

Lock, if neccesary

Definition at line 112 of file ArSpeech.h.

void ArSpeechSynth::setAudioCallback ArRetFunctor2< bool, ArTypes::Byte2 *, int > *  cb  ) 
 

Instead of playing synthesized audio using the synthesizer's internal audio playback, call the given callback when a chunk of audio has been synthesized. Audio is passed to the callback in the first parameter as signed 16-bit samples (PCM16). The sample rate is 16kHz but may be changed with setAudioSampleRate(). The second parameter is the number of samples. The return value from the callback is ignored.

Definition at line 59 of file ArSpeech.cpp.

virtual void ArSpeechSynth::setAudioSampleRate int  rate  )  [pure virtual]
 

Change audio sample rate (Hz). Normal rate is 16000 Hz. Suggested values are 8000, 16000, or 44400

virtual bool ArSpeechSynth::speak const char *  str,
const char *  voiceParams,
ArRetFunctor2< bool, ArTypes::Byte2 *, int > *  audioOutputCB,
unsigned short  sampleRate = 0
[pure virtual]
 

Speaks the given text.

Parameters:
str The text to speak.
params Voice selection criteria expression
audioOutputCB If not NULL, send synthesized audio data to this callback (may be called several times). Otherwise, play using default AudioCallback, or directly out the speakers
sampleRate if given, temporarily use this sample rate for this speech, then restore. If 0, use current sample rate.

virtual bool ArSpeechSynth::speakf const char *  fmt,
  ...
[pure virtual]
 

Speaks the given string, using current voice and output settings, taking varargs and a format string (like printf)

virtual void ArSpeechSynth::unlock  )  [inline, virtual]
 

Unlock, if neccesary

Definition at line 114 of file ArSpeech.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 20 10:51:45 2007 for Aria by  doxygen 1.4.0