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. |
ExecutorInterface::ExecutorInterface | ( | AbstractExecutorCallback & | callback, | |
const OutputSet & | outputSet, | |||
size_t | maxQueueSize, | |||
const std::string & | executorName, | |||
PlayerType | playerType | |||
) |
[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) |
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.
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.
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.
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.
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.
[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.
[in] | freq | The desired frequency of tone signal |
[in] | duration | The desired duration of tone signal in milliseconds |