NUGU SDK Linux  1.7.6
tts_interface.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __NUGU_TTS_INTERFACE_H__
18 #define __NUGU_TTS_INTERFACE_H__
19 
21 #include <nugu.h>
22 
23 namespace NuguCapability {
24 
25 using namespace NuguClientKit;
26 
38 #define NUGU_TTS_ENGINE "skt"
43 enum class TTSState {
47 };
48 
52 typedef struct _TTSAttribute {
53  std::string tts_engine;
55 
60 class NUGU_API ITTSListener : virtual public ICapabilityListener {
61 public:
62  virtual ~ITTSListener() = default;
63 
70  virtual void onTTSState(TTSState state, const std::string& dialog_id) = 0;
71 
77  virtual void onTTSText(const std::string& text, const std::string& dialog_id) = 0;
78 
83  virtual void onTTSCancel(const std::string& dialog_id) = 0;
84 };
85 
90 class NUGU_API ITTSHandler : virtual public ICapabilityInterface {
91 public:
92  virtual ~ITTSHandler() = default;
93 
98  virtual void addListener(ITTSListener* listener) = 0;
99 
104  virtual void removeListener(ITTSListener* listener) = 0;
105 
109  virtual void stopTTS() = 0;
110 
117  virtual std::string requestTTS(const std::string& text, const std::string& play_service_id, const std::string& referrer_id = "") = 0;
118 
124  virtual bool setVolume(int volume) = 0;
125 
131  virtual bool setMute(bool mute) = 0;
132 
137  virtual void setAttribute(TTSAttribute&& attribute) = 0;
138 
143  virtual std::string getPlayServiceId() = 0;
144 };
145 
150 } // NuguCapability
151 
152 #endif /* __NUGU_TTS_INTERFACE_H__ */
tts handler interface
Definition: tts_interface.hh:90
virtual void setAttribute(TTSAttribute &&attribute)=0
Set attribute about speech synthesizer.
virtual bool setMute(bool mute)=0
set pcm player's mute
virtual bool setVolume(int volume)=0
set pcm player's volume
virtual void removeListener(ITTSListener *listener)=0
Remove the ITTSListener object.
virtual std::string getPlayServiceId()=0
Get current play service id.
virtual void addListener(ITTSListener *listener)=0
Add the ITTSListener object.
virtual std::string requestTTS(const std::string &text, const std::string &play_service_id, const std::string &referrer_id="")=0
request the sentence to speech.
virtual void stopTTS()=0
Stop currently speech.
tts listener interface
Definition: tts_interface.hh:60
virtual void onTTSText(const std::string &text, const std::string &dialog_id)=0
Report the speech sentence to the User.
virtual void onTTSCancel(const std::string &dialog_id)=0
Report canceled the text speech to the User.
virtual void onTTSState(TTSState state, const std::string &dialog_id)=0
Report changes in the speech state to the user.
capability interface
Definition: capability_interface.hh:82
capability listener interface
Definition: capability_interface.hh:60
struct NuguCapability::_TTSAttribute TTSAttribute
Attributes for setting TTS options.
TTSState
TTSState.
Definition: tts_interface.hh:43
Attributes for setting TTS options.
Definition: tts_interface.hh:52
std::string tts_engine
Definition: tts_interface.hh:53