This class manages a queue of items to play as WAV files or as text to speak using a speech synthesizer.
More...
|
void | addInitCallback (ArRetFunctor< bool > *cb) |
| Add a callback to be called when the sound queue begins to run in its thread. More...
|
|
void | addItem (ArSoundsQueue::Item item) |
| Add (a copy of) the given item to the queue.
|
|
void | addItem (ItemType type, const char *data, std::list< PlayItemFunctor * > callbacks, int priority=0, const char *params=0) |
| Create a new queue item with the given data and add to the queue.
|
|
void | addQueueEmptyCallback (ArFunctor *f) |
| Add a callback functor to be invoked when the sound queue becomes empty and the last sound has finished playing, that is, when a block of sounds/speech utterances ends. More...
|
|
void | addQueueNonemptyCallback (ArFunctor *f) |
| Add a callback functor to be invoked when a the sound queue becomes non-empty, that is, when a block of sounds/speech utterances begins.
|
|
void | addSoundFinishedCallback (ArFunctor *f) |
| Add a callback functor to be invoked when plackback of one sound or speech utterance finishes.
|
|
void | addSoundItemFinishedCallback (ArFunctor1< ArSoundsQueue::Item > *f) |
| Add a callback functor to be invoked when plackback of one sound or speech utterance finishes.
|
|
void | addSoundItemStartedCallback (ArFunctor1< ArSoundsQueue::Item > *f) |
| Add a callback functor to be invoked when playback of one sound or speech utterance starts.
|
|
void | addSoundStartedCallback (ArFunctor *f) |
| Add a callback functor to be invoked when playback of one sound or speech utterance starts.
|
|
| ArSoundsQueue () |
| INTERNAL_CLASSES.
|
|
| ArSoundsQueue (ArRetFunctor< bool > *speakInitCB, PlayItemFunctor *speakCB=0, InterruptItemFunctor *interruptSpeechCB=0, ArRetFunctor< bool > *playInitCB=0, PlayItemFunctor *playFileCB=0, InterruptItemFunctor *interruptFileCB=0) |
|
| ArSoundsQueue (ArSpeechSynth *speechSynthesizer, ArRetFunctor< bool > *playInitCB=0, PlayItemFunctor *playFileCB=0, InterruptItemFunctor *interruptFileCB=0) |
| Set default speech and WAV file callbacks for use by the convenience methods speak() and play(). More...
|
|
void | clearQueue () |
| Empty the queue. More...
|
|
ArSoundsQueue::Item | createDefaultFileItem (const char *filename=0) |
| Return an item set up for sound file playback with previously set default play callbacks. More...
|
|
ArSoundsQueue::Item | createDefaultSpeechItem (const char *speech=0) |
| Return an item set up for speech with previously set default speech callbacks. More...
|
|
std::set< int > | findPendingItems (const char *item) |
| Find items waiting in the queue. More...
|
|
size_t | getCurrentQueueSize () |
| Get the current size of the speech/sound playback queue.
|
|
ArFunctor * | getPauseCallback () |
| Create and return a new a functor for pause(), which other modules can use to pause this sounds queue.
|
|
ArFunctor * | getResumeCallback () |
| Create and return a new functor for resume(), which other modules can use to resume this sounds queue.
|
|
void | interrupt () |
| If sound is currently being played or speech is being spoken, interrupt it. (but continue processing the queue). SoundFinished callbacks will not be called.
|
|
bool | isInitialized () |
| Return true if all initialization callbacks have completed, false otherwise. More...
|
|
bool | isPaused () |
|
bool | isPlaying () |
| Returns true if an item is currently being played.
|
|
bool | isSpeaking () |
|
bool | isSpeakingOrPlaying (void) |
|
std::string | nextItem (int priority) |
|
std::string | nextItem (ItemType type) |
|
std::string | nextItem (ItemType type, int priority) |
|
void | pause () |
| Temporarily stop processing the sounds queue. More...
|
|
void | play (const char *filename) |
| Add a sound file to the queue for default sound file playback. More...
|
|
void | playf (const char *filename_fmt,...) |
| Add a sound file to the queue for default sound file playback. More...
|
|
void | removeItems (int priority) |
| Remove pending and current items with a priority less than that given.
|
|
void | removeItems (Item item) |
| Removes pending and current items with the same data and type as the given item.
|
|
void | removePendingItems (const char *data) |
| Remove pending items with the given data.
|
|
void | removePendingItems (const char *item, ItemType type) |
| Remove pending items with the given data and type.
|
|
void | removePendingItems (int priority) |
| Remove pending items with a priority less than that given.
|
|
void | removePendingItems (int priority, ItemType type) |
| Remove pending items with priority less the given priority and with the given type.
|
|
void | removePendingItems (ItemType type) |
| Remove pending items with the given type.
|
|
void | remQueueEmptyCallback (ArFunctor *f) |
| Remove a functor added by addQueueEmptyCallback()
|
|
void | remQueueNonemptyCallback (ArFunctor *f) |
| Remove a functor added by addQueueNonemptyCallback().
|
|
void | remSoundFinishedCallback (ArFunctor *f) |
| Remove a callback functor to be invoked when plackback of one sound or speech utterance finishes.
|
|
void | remSoundItemFinishedCallback (ArFunctor1< ArSoundsQueue::Item > *f) |
| Remove a callback functor to be invoked when plackback of one sound or speech utterance finishes.
|
|
void | remSoundItemStartedCallback (ArFunctor1< ArSoundsQueue::Item > *f) |
| Remove a callback functor to be invoked when playback one sound or speech utterance starts.
|
|
void | remSoundStartedCallback (ArFunctor *f) |
| Remove a callback functor to be invoked when playback one sound or speech utterance starts.
|
|
void | resume () |
| Resume processing the sounds queue.
|
|
void | run (void) |
| Begin processing the sounds queue synchronously (in this thread; does not return)
|
|
void | runAsync (void) |
| Begin processing the sounds queue in a background thread.
|
|
virtual void * | runThread (void *arg) |
| main function for thread
|
|
void | setDefaultPlayConditionCB (PlaybackConditionFunctor *f) |
| Set a playback condition functor used for default speech and sound file items. More...
|
|
void | setInterruptFileCallback (InterruptItemFunctor *cb) |
| Set the "default" callback to interrupt current wav file playback, for use by the play() convenience method. More...
|
|
void | setInterruptSpeechCallback (InterruptItemFunctor *cb) |
| Set the "default" callback to interrupt a current speech utterance, used by speak() More...
|
|
void | setInterruptWavFileCallback (InterruptItemFunctor *cb) |
|
void | setPlayFileCallback (PlayItemFunctor *cb) |
| As a convenience, you may set a "default" WAV file playback callback, and then simply use the play() method to add the file to the queue with this callback. More...
|
|
void | setPlayWavFileCallback (PlayItemFunctor *cb) |
|
void | setSpeakCallback (PlayItemFunctor *cb) |
| Convenience methods for special speech synthesis and WAV file queue items: More...
|
|
void | setSpeakInitCallback (ArRetFunctor< bool > *cb) |
|
void | speak (const char *str) |
| Add text string item to the queue for speech synthesis. More...
|
|
void | speakf (const char *fmt,...) |
| Add a formatted text string (like printf) to the queue configured for default speech synthesis. More...
|
|
void | speakWithPriority (int priority, const char *fmt,...) |
| Speak with alternate priority.
|
|
void | speakWithVoice (const char *voice, const char *fmt,...) |
| Speak with alternate voice.
|
|
void | stop () |
| End the processing thread. More...
|
|
| ArASyncTask () |
| Constructor.
|
|
virtual int | create (bool joinable=true, bool lowerPriority=true) |
| Create the task and start it going.
|
|
virtual const char * | getThreadActivity (void) |
| Gets a string that describes what the thread is doing, or NULL if it doesn't know. More...
|
|
virtual void * | runInThisThread (void *arg=0) |
| Internal function used with system threading system to run the new thread. More...
|
|
virtual void | stopRunning (void) |
| Stop the thread.
|
|
virtual | ~ArASyncTask () |
| Destructor.
|
|
| ArThread (ArFunctor *func, bool joinable=true, bool blockAllSignals=true) |
| Constructor - starts the thread.
|
|
| ArThread (bool blockAllSignals=true) |
| Constructor.
|
|
| ArThread (ThreadType thread, bool joinable, bool blockAllSignals=true) |
| Constructor - starts the thread.
|
|
virtual void | cancel (void) |
| Cancel the thread.
|
|
virtual int | detach (void) |
| Detatch the thread so it cant be joined.
|
|
bool | getBlockAllSignals (void) |
| Do we block all process signals at startup?
|
|
virtual ArFunctor * | getFunc (void) const |
| Get the functor that the thread runs.
|
|
virtual bool | getJoinable (void) const |
| Get the joinable status of the thread.
|
|
virtual ThreadType | getOSThread (void) const |
| Get the underlying os thread type.
|
|
pid_t | getPID (void) |
|
virtual bool | getRunning (void) const |
| Get the running status of the thread.
|
|
virtual bool | getRunningWithLock (void) |
| Get the running status of the thread, locking around the variable.
|
|
virtual const ThreadType * | getThread (void) const |
| Get the underlying thread type.
|
|
virtual const char * | getThreadName (void) |
| Gets the name of the thread.
|
|
pid_t | getTID (void) |
|
virtual bool | isThreadFinished () const |
| Returns whether the thread has been completed and can be deleted. More...
|
|
virtual bool | isThreadStarted () const |
| Returns whether the thread has been started. More...
|
|
virtual int | join (void **ret=NULL) |
| Join on the thread.
|
|
int | lock (void) |
| Lock the thread instance. More...
|
|
virtual void | logThreadInfo (void) |
| Logs the information about this thread.
|
|
virtual void | setRunning (bool running) |
| Set the running value on the thread.
|
|
virtual void | setThreadName (const char *name) |
| Sets the name of the thread.
|
|
virtual void | threadFinished (void) |
| Marks the thread as finished and logs useful debugging information. More...
|
|
virtual void | threadStarted (void) |
| Marks the thread as started and logs useful debugging information. More...
|
|
int | tryLock (void) |
| Try to lock the thread instance without blocking. More...
|
|
int | unlock (void) |
| Unlock the thread instance. More...
|
|
virtual | ~ArThread () |
| Destructor.
|
|
This class manages a queue of items to play as WAV files or as text to speak using a speech synthesizer.
The actual playback of sound and speech is done through callbacks (which you can supply in the constructor or afterwards). Some callbacks you can use are provided by classes like ArSoundPlayer (for sound file playback) and ArFestival (from the ArSpeechSynth_Festival library) and ArCepstral (from the ArSpeechSynth_Cepstral librrary) for speech synthesis.
Add sound files to the queue with play(), and text to speak with speak(). Use runAsync() to run the processing thread in the background, or run() to run synchronously in the current thread.
- See also
- ArSoundPlayer
-
soundsQueueExample.cpp
- Examples
- soundsQueueExample.cpp.