/*
- * VoiceSynthesizer.hxx
- *
- * Created on: Apr 24, 2014
- * Author: flightgear
+ * VoiceSynthesizer.hxx - wraps flite+hts_engine
+ * Copyright (C) 2014 Torsten Dreyer - torsten (at) t3r (dot) de
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
#ifndef VOICESYNTHESIZER_HXX_
#define VOICESYNTHESIZER_HXX_
class VoiceSynthesizer {
public:
virtual ~VoiceSynthesizer() {};
- virtual SGSoundSample * synthesize( const std::string & text ) = 0;
+ virtual SGSoundSample * synthesize( const std::string & text, double volume, double speed, double pitch ) = 0;
};
class SoundSampleReadyListener {
struct SynthesizeRequest {
SynthesizeRequest() {
- speed = volume = pitch = 1.0;
+ speed = 0.5;
+ volume = 1.0;
+ pitch = 0.5;
listener = NULL;
}
SynthesizeRequest( const SynthesizeRequest & other ) {
*/
class FLITEVoiceSynthesizer : public VoiceSynthesizer {
public:
+
+ typedef enum {
+ CMU_US_ARCTIC_SLT = 0,
+ CSTR_UK_FEMALE,
+
+ VOICE_UNKNOWN // keep this at the end
+ } voice_t;
+
+ static std::string getVoicePath( voice_t voice );
+ static std::string getVoicePath( const std::string & voice );
+
FLITEVoiceSynthesizer( const std::string & voice );
~FLITEVoiceSynthesizer();
- virtual SGSoundSample * synthesize( const std::string & text );
+ virtual SGSoundSample * synthesize( const std::string & text, double volume, double speed, double pitch );
virtual void synthesize( SynthesizeRequest & request );
private:
SynthesizeRequestList _requests;
double _volume;
- bool _keepScratchFile;
};
#endif /* VOICESYNTHESIZER_HXX_ */