Fawkes API  Fawkes Development Version
synth_thread.h
1 
2 /***************************************************************************
3  * synth_thread.h - Flite synthesis thread
4  *
5  * Created: Tue Oct 28 14:31:58 2008
6  * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __PLUGINS_FLITE_SYNTH_THREAD_H_
24 #define __PLUGINS_FLITE_SYNTH_THREAD_H_
25 
26 #include <core/threading/thread.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/logging.h>
29 #include <aspect/configurable.h>
30 #include <aspect/blackboard.h>
31 #include <aspect/clock.h>
32 #include <blackboard/interface_listener.h>
33 
34 #include <string>
35 
36 #include <flite/flite.h>
37 
38 namespace fawkes {
39  class SpeechSynthInterface;
40 }
41 
43 : public fawkes::Thread,
44  public fawkes::LoggingAspect,
46  public fawkes::ClockAspect,
49 {
50  public:
52 
53  virtual void init();
54  virtual void finalize();
55  virtual void loop();
56 
57  void say(const char *text);
58 
59  virtual bool bb_interface_message_received(fawkes::Interface *interface,
60  fawkes::Message *message) throw();
61 
62  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
63  protected: virtual void run() { Thread::run(); }
64 
65  private: /* methods */
66  void play_wave(cst_wave *wave);
67  float get_duration(cst_wave *wave);
68 
69  private:
70  fawkes::SpeechSynthInterface *__speechsynth_if;
71 
72  std::string __cfg_soundcard;
73 
74  cst_voice *__voice;
75 };
76 
77 
78 #endif
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: synth_thread.h:63
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
Thread class encapsulation of pthreads.
Definition: thread.h:42
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
Flite Synthesis Thread.
Definition: synth_thread.h:42
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35
BlackBoard interface listener.
SpeechSynthInterface Fawkes BlackBoard Interface.