Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SpeechSynthInterface.h
1 
2 /***************************************************************************
3  * SpeechSynthInterface.h - Fawkes BlackBoard Interface - SpeechSynthInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2008 Tim Niemueller
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. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __INTERFACES_SPEECHSYNTHINTERFACE_H_
25 #define __INTERFACES_SPEECHSYNTHINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(SpeechSynthInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  private:
42 #pragma pack(push,4)
43  /** Internal data storage, do NOT modify! */
44  typedef struct {
45  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
46  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
47  char text[1024]; /**<
48  Last spoken string. Must be properly null-terminated.
49  */
50  uint32_t msgid; /**<
51  The ID of the message that is currently being processed,
52  or 0 if no message is being processed.
53  */
54  bool final; /**<
55  True, if the last text has been spoken, false if it is still running.
56  */
57  float duration; /**<
58  Length in seconds that it takes to speek the current text, -1 if
59  unknown. This is the total duration of the current string, *not* the
60  duration of already spoken or yet to speak text!
61  */
62  } SpeechSynthInterface_data_t;
63 #pragma pack(pop)
64 
65  SpeechSynthInterface_data_t *data;
66 
67  public:
68  /* messages */
69  class SayMessage : public Message
70  {
71  private:
72 #pragma pack(push,4)
73  /** Internal data storage, do NOT modify! */
74  typedef struct {
75  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
76  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
77  char text[1024]; /**<
78  Last spoken string. Must be properly null-terminated.
79  */
80  } SayMessage_data_t;
81 #pragma pack(pop)
82 
83  SayMessage_data_t *data;
84 
85  public:
86  SayMessage(const char * ini_text);
87  SayMessage();
88  ~SayMessage();
89 
90  SayMessage(const SayMessage *m);
91  /* Methods */
92  char * text() const;
93  void set_text(const char * new_text);
94  size_t maxlenof_text() const;
95  virtual Message * clone() const;
96  };
97 
98  virtual bool message_valid(const Message *message) const;
99  private:
102 
103  public:
104  /* Methods */
105  char * text() const;
106  void set_text(const char * new_text);
107  size_t maxlenof_text() const;
108  uint32_t msgid() const;
109  void set_msgid(const uint32_t new_msgid);
110  size_t maxlenof_msgid() const;
111  bool is_final() const;
112  void set_final(const bool new_final);
113  size_t maxlenof_final() const;
114  float duration() const;
115  void set_duration(const float new_duration);
116  size_t maxlenof_duration() const;
117  virtual Message * create_message(const char *type) const;
118 
119  virtual void copy_values(const Interface *other);
120  virtual const char * enum_tostring(const char *enumtype, int val) const;
121 
122 };
123 
124 } // end namespace fawkes
125 
126 #endif
void set_duration(const float new_duration)
Set duration value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:43
void set_final(const bool new_final)
Set final value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
size_t maxlenof_text() const
Get maximum length of text value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
size_t maxlenof_duration() const
Get maximum length of duration value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void set_text(const char *new_text)
Set text value.
size_t maxlenof_msgid() const
Get maximum length of msgid value.
size_t maxlenof_text() const
Get maximum length of text value.
char * text() const
Get text value.
SayMessage Fawkes BlackBoard Interface Message.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
size_t maxlenof_final() const
Get maximum length of final value.
void set_msgid(const uint32_t new_msgid)
Set msgid value.
uint32_t msgid() const
Get msgid value.
virtual Message * clone() const
Clone this message.
bool is_final() const
Get final value.
void set_text(const char *new_text)
Set text value.
virtual Message * create_message(const char *type) const
Create message based on type name.
float duration() const
Get duration value.
const char * type() const
Get type of interface.
Definition: interface.cpp:635
SpeechSynthInterface Fawkes BlackBoard Interface.