NUGU SDK Linux  1.7.5
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 
22 namespace NuguCapability {
23 
24 using namespace NuguClientKit;
25 
37 #define NUGU_TTS_ENGINE "skt"
42 enum class TTSState {
46 };
47 
51 typedef struct _TTSAttribute {
52  std::string tts_engine;
54 
59 class ITTSListener : virtual public ICapabilityListener {
60 public:
61  virtual ~ITTSListener() = default;
62 
69  virtual void onTTSState(TTSState state, const std::string& dialog_id) = 0;
70 
76  virtual void onTTSText(const std::string& text, const std::string& dialog_id) = 0;
77 
82  virtual void onTTSCancel(const std::string& dialog_id) = 0;
83 };
84 
89 class ITTSHandler : virtual public ICapabilityInterface {
90 public:
91  virtual ~ITTSHandler() = default;
92 
97  virtual void addListener(ITTSListener* listener) = 0;
98 
103  virtual void removeListener(ITTSListener* listener) = 0;
104 
108  virtual void stopTTS() = 0;
109 
116  virtual std::string requestTTS(const std::string& text, const std::string& play_service_id, const std::string& referrer_id = "") = 0;
117 
123  virtual bool setVolume(int volume) = 0;
124 
130  virtual bool setMute(bool mute) = 0;
131 
136  virtual void setAttribute(TTSAttribute&& attribute) = 0;
137 
142  virtual std::string getPlayServiceId() = 0;
143 };
144 
149 } // NuguCapability
150 
151 #endif /* __NUGU_TTS_INTERFACE_H__ */
tts handler interface
Definition: tts_interface.hh:89
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:59
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:81
capability listener interface
Definition: capability_interface.hh:59
struct NuguCapability::_TTSAttribute TTSAttribute
Attributes for setting TTS options.
TTSState
TTSState.
Definition: tts_interface.hh:42
Attributes for setting TTS options.
Definition: tts_interface.hh:51
std::string tts_engine
Definition: tts_interface.hh:52