/usr/include/Aria/ArSpeech.h is in libaria-dev 2.8.0+repack-1.2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009, 2010 MobileRobots Inc.
Copyright (C) 2011, 2012, 2013 Adept Technology
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you wish to redistribute ARIA under different terms, contact
Adept MobileRobots for information about a commercial version of ARIA at
robots@mobilerobots.com or
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
/* $Id: ArSpeech.h,v 1.15 2007-08-27 21:48:33 reed Exp $ */
#ifndef ARSPEECH_H
#define ARSPEECH_H
#include "ariaTypedefs.h"
#include "ArFunctor.h"
#include "ArConfig.h"
#include <list>
#include <string>
/** @brief 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.
*
* This class registers one parameter with the global ArConfig object in the
* "Speech Synthesis" section: The parameter is named "voice" and sets the voice
* used for speech synthesis, if multiple voices is supported and the
* new voice can be loaded.
*/
class ArSpeechSynth
{
public:
/** Don't forget to call this from derived classes. */
AREXPORT ArSpeechSynth();
AREXPORT virtual ~ArSpeechSynth();
/** Perform synthesizer initialization, if necessary. You must call
* this method.
*
* (Subclass implementations should call this method *after* initializing their
* speech engine.)
*/
AREXPORT virtual bool init();
/** Use the given ArConfig object to read parameters such as voice, speaking
* rate, volume.
*/
AREXPORT virtual void addToConfig(ArConfig *config);
/** Speaks the given text.
* @param str The text to speak.
* @param voiceParams Voice selection criteria expression
* (implementation-specific)
* @param 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
* @param sampleRate if given, temporarily use this sample rate for this
* speech, then restore. If 0, use current sample rate.
*/
AREXPORT virtual bool speak(const char *str, const char* voiceParams, ArRetFunctor2<bool, ArTypes::Byte2*, int>* audioOutputCB, unsigned short sampleRate = 0) = 0;
/** Speaks the given text.
* @param str The text to speak.
* @param voiceParams Voice selection criteria expression
* (implementation-specific)
*/
AREXPORT virtual bool speak(const char *str, const char* voiceParams = NULL);
/** Speaks the given string, using current voice and output settings,
* taking varargs and a format string (like printf)
*/
AREXPORT virtual bool speakf(const char* fmt, ...) = 0;
/** If any speech is currently ongoing, interrupt it.
*/
AREXPORT virtual void interrupt() = 0;
/** @return a functor for init() to use with ArSoundsQueue */
AREXPORT ArRetFunctorC<bool, ArSpeechSynth>* getInitCallback();
/** @return a functor for speak() to use with ArSoundsQueue */
AREXPORT ArRetFunctor2C<bool, ArSpeechSynth, const char*, const char*>* getSpeakCallback(void) ;
/** @return a functor for interrupt() */
AREXPORT ArFunctorC<ArSpeechSynth>* getInterruptCallback();
/** 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.
*/
AREXPORT void setAudioCallback(ArRetFunctor2<bool, ArTypes::Byte2*, int>* cb);
/** Change audio sample rate (Hz). Normal rate is 16000 Hz.
* Suggested values are 8000, 16000, or 44400
*/
AREXPORT virtual void setAudioSampleRate(int rate) = 0;
AREXPORT virtual int getAudioSampleRate() = 0;
/** Lock, if neccesary */
AREXPORT virtual void lock() { }
/** Unlock, if neccesary */
AREXPORT virtual void unlock() { }
/** Set the current voice by name.
* Replaces fully any previous required voice criteria.
* @sa getVoiceNames
*/
AREXPORT virtual bool setVoice(const char* name) = 0;
/** Get name of current voice, if set with setVoice (else returns NULL) */
AREXPORT virtual const char* getCurrentVoiceName() = 0;
/** Return a list of available voice names, if possible. */
AREXPORT virtual std::list<std::string> getVoiceNames() = 0;
protected:
ArRetFunctor2C<bool, ArSpeechSynth, const char*, const char*> mySpeakCB;
ArRetFunctorC<bool, ArSpeechSynth> myInitCB;
ArFunctorC<ArSpeechSynth> myInterruptCB;
ArRetFunctor2<bool, ArTypes::Byte2*, int> *myAudioPlaybackCB; ///< If set, send audio to this callback instead of playing it directly
private:
ArRetFunctorC<bool, ArSpeechSynth> myProcessConfigCB;
char myConfigVoice[32];
bool processConfig();
void addVoiceConfigParam(ArConfig *config);
};
#endif
|