ExecutorInterface Class Reference

The interface to executor process. More...

Inheritance diagram for ExecutorInterface:

AbstractExecutorOutput

List of all members.

Public Member Functions

 ExecutorInterface (AbstractExecutorCallback &callback, const OutputSet &outputSet, size_t maxQueueSize, const std::string &executorName, PlayerType playerType)
 The constructor.
int getExecutorStderrDescriptor () const
 Returns the file descriptor of executor stderr stream.
int getExecutorStdoutDescriptor () const
 Returns the file descriptor of executor stdout stream.
void readExecutorStderrData ()
 Notifies there is data to read from executor stderr stream.
void readExecutorStdoutData ()
 Notifies there is data to read from executor stdout stream.
void sayOrEnqueue (const TextItem &textItem)
 Sends command to say part of text.
void stop ()
 Sends command to stop speech and clear queue.
void stopExecutor ()
 Stops executor process and picks up zombie.
void tone (size_t freq, size_t duration)
 Sends tone command.
virtual ~ExecutorInterface ()
 The destructor.


Detailed Description

This class performs all communication tasks with external executor process. Executor process receives such commands as"say", "stop" and "tone". It implements queue behavior and stores "say" command in internal queue if if was received during playback. Executor sends some feedback info, like "silence" message, if there are no more items in queue to speak, or notifications about queue size limit exceeds. It stored in separated executable file and can be changed via configuration file parameter.

See also:
AbstractExecutorCallback AbstractExecutorOutput

Constructor & Destructor Documentation

ExecutorInterface::ExecutorInterface ( AbstractExecutorCallback callback,
const OutputSet outputSet,
size_t  maxQueueSize,
const std::string &  executorName,
PlayerType  playerType 
)

Parameters:
[in] callback The reference to object for executor events handling
[in] outputSet The set of outputs to generate command lines and text preprocessing
[in] maxQueueSize The maximum number of items in queue (0 - not limited)
executorName The file name of executor to run
[in] playerType Used player type (alsa, pulseaudio, pcspeaker)


Member Function Documentation

int ExecutorInterface::getExecutorStderrDescriptor (  )  const [virtual]

This method returns file descriptor of executor stderr stream. This descriptor must be added to the main pselect() call to know when we have data to read.

Returns:
The file descriptor of executor stderr stream
See also:
AbstractExecutorOutput

Implements AbstractExecutorOutput.

int ExecutorInterface::getExecutorStdoutDescriptor (  )  const [virtual]

This method returns file descriptor of executor stdout stream. This descriptor must be added to the main pselect() call to know when we have data to read.

Returns:
The file descriptor of executor stdout stream
See also:
AbstractExecutorOutput

Implements AbstractExecutorOutput.

void ExecutorInterface::readExecutorStderrData (  )  [virtual]

This method notifies implementation to read accessible data from executor error stream. This notification is sent by MainLoop class when it receives corresponding information from main pselect() system call.

See also:
abstractExecutorOutput

Implements AbstractExecutorOutput.

void ExecutorInterface::readExecutorStdoutData (  )  [virtual]

This method notifies implementation to read accessible data from executor output stream. This notification is sent by MainLoop class when it receives corresponding information from main pselect() system call.

See also:
AbstractExecutorOutput

Implements AbstractExecutorOutput.

void ExecutorInterface::sayOrEnqueue ( const TextItem textItem  ) 

This method sends the "SAY" command to executor process. If executor is in idle mode, part of text being sent will be spoken immediately or will be stored in queue otherwise.

Parameters:
[in] textItem The text item to enqueue

void ExecutorInterface::stop (  ) 

This method sends "STOP" command to executor process. On receiving it executor must stop any playback and clear queue.

void ExecutorInterface::stopExecutor (  ) 

This method closes executor input pipe and waits its termination to pick up zombie. It is called on SIGPIPE signal receiving or at write() function failure. Executor process stopping does not mean daemon disfunctioning. Executor is always automatically spawned on "SAY" or "TONE" commands.

void ExecutorInterface::tone ( size_t  freq,
size_t  duration 
)

This method sends command to queue to produce tone signal by specified duration and frequency. This signal is not speech signal it is generated with sin() function and then played via audio output library.

Parameters:
[in] freq The desired frequency of tone signal
[in] duration The desired duration of tone signal in milliseconds


Generated on Thu May 6 16:10:58 2010 for VoiceMan by  doxygen 1.5.9