OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <math.h> | 5 #include <math.h> |
6 #include <sapi.h> | 6 #include <sapi.h> |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "base/win/scoped_comptr.h" | 12 #include "base/win/scoped_comptr.h" |
13 #include "chrome/browser/speech/tts_controller.h" | 13 #include "chrome/browser/speech/tts_controller.h" |
14 #include "chrome/browser/speech/tts_platform.h" | 14 #include "chrome/browser/speech/tts_platform.h" |
15 | 15 |
16 class TtsPlatformImplWin : public TtsPlatformImpl { | 16 class TtsPlatformImplWin : public TtsPlatformImpl { |
17 public: | 17 public: |
18 virtual bool PlatformImplAvailable() { | 18 bool PlatformImplAvailable() override { |
19 return true; | 19 return true; |
20 } | 20 } |
21 | 21 |
22 virtual bool Speak( | 22 bool Speak( |
23 int utterance_id, | 23 int utterance_id, |
24 const std::string& utterance, | 24 const std::string& utterance, |
25 const std::string& lang, | 25 const std::string& lang, |
26 const VoiceData& voice, | 26 const VoiceData& voice, |
27 const UtteranceContinuousParameters& params); | 27 const UtteranceContinuousParameters& params) override; |
28 | 28 |
29 virtual bool StopSpeaking(); | 29 bool StopSpeaking() override; |
30 | 30 |
31 virtual void Pause(); | 31 void Pause() override; |
32 | 32 |
33 virtual void Resume(); | 33 void Resume() override; |
34 | 34 |
35 virtual bool IsSpeaking(); | 35 bool IsSpeaking() override; |
36 | 36 |
37 virtual void GetVoices(std::vector<VoiceData>* out_voices) override; | 37 void GetVoices(std::vector<VoiceData>* out_voices) override; |
38 | 38 |
39 // Get the single instance of this class. | 39 // Get the single instance of this class. |
40 static TtsPlatformImplWin* GetInstance(); | 40 static TtsPlatformImplWin* GetInstance(); |
41 | 41 |
42 static void __stdcall SpeechEventCallback(WPARAM w_param, LPARAM l_param); | 42 static void __stdcall SpeechEventCallback(WPARAM w_param, LPARAM l_param); |
43 | 43 |
44 private: | 44 private: |
45 TtsPlatformImplWin(); | 45 TtsPlatformImplWin(); |
46 virtual ~TtsPlatformImplWin() {} | 46 ~TtsPlatformImplWin() override {} |
47 | 47 |
48 void OnSpeechEvent(); | 48 void OnSpeechEvent(); |
49 | 49 |
50 base::win::ScopedComPtr<ISpVoice> speech_synthesizer_; | 50 base::win::ScopedComPtr<ISpVoice> speech_synthesizer_; |
51 | 51 |
52 // These apply to the current utterance only. | 52 // These apply to the current utterance only. |
53 std::wstring utterance_; | 53 std::wstring utterance_; |
54 int utterance_id_; | 54 int utterance_id_; |
55 int prefix_len_; | 55 int prefix_len_; |
56 ULONG stream_number_; | 56 ULONG stream_number_; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 TtsPlatformImplWin* TtsPlatformImplWin::GetInstance() { | 248 TtsPlatformImplWin* TtsPlatformImplWin::GetInstance() { |
249 return Singleton<TtsPlatformImplWin, | 249 return Singleton<TtsPlatformImplWin, |
250 LeakySingletonTraits<TtsPlatformImplWin> >::get(); | 250 LeakySingletonTraits<TtsPlatformImplWin> >::get(); |
251 } | 251 } |
252 | 252 |
253 // static | 253 // static |
254 void TtsPlatformImplWin::SpeechEventCallback( | 254 void TtsPlatformImplWin::SpeechEventCallback( |
255 WPARAM w_param, LPARAM l_param) { | 255 WPARAM w_param, LPARAM l_param) { |
256 GetInstance()->OnSpeechEvent(); | 256 GetInstance()->OnSpeechEvent(); |
257 } | 257 } |
OLD | NEW |