]> git.mxchange.org Git - flightgear.git/blobdiff - src/Sound/VoiceSynthesizer.hxx
Interim windows build fix
[flightgear.git] / src / Sound / VoiceSynthesizer.hxx
index 4e49a38bf1cbe8dbe511e37c7b43cf979239fe10..17fb4bc1ffabaa8564ba03791824b4e825c01198 100644 (file)
@@ -1,10 +1,21 @@
 /*
- * 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_
 
@@ -20,7 +31,7 @@ struct _Flite_HTS_Engine;
 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 {
@@ -31,7 +42,9 @@ public:
 
 struct SynthesizeRequest {
   SynthesizeRequest() {
-    speed = volume = pitch = 1.0;
+    speed = 0.5;
+    volume = 1.0;
+    pitch = 0.5;
     listener = NULL;
   }
   SynthesizeRequest( const SynthesizeRequest & other ) {
@@ -63,9 +76,20 @@ struct SynthesizeRequest {
  */
 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:
@@ -76,6 +100,8 @@ private:
 
   typedef SGBlockingQueue<SynthesizeRequest> SynthesizeRequestList;
   SynthesizeRequestList _requests;
+
+  double _volume;
 };
 
 #endif /* VOICESYNTHESIZER_HXX_ */