OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_SPEECH_SYNTHESIZER_CLIENT_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_SPEECH_SYNTHESIZER_CLIENT_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/callback.h" |
| 12 |
| 13 namespace dbus { |
| 14 class Bus; |
| 15 } |
| 16 |
| 17 namespace chromeos { |
| 18 |
| 19 // SpeechSynthesizerClient is used to communicate with the speech synthesizer. |
| 20 // All method should be called from the origin thread (UI thread) which |
| 21 // initializes the DBusThreadManager instance. |
| 22 class SpeechSynthesizerClient { |
| 23 public: |
| 24 // A callback function called when the result of IsSpeaking is ready. |
| 25 // The argument indicates if the speech synthesizer is speaking or not. |
| 26 typedef base::Callback<void(bool)> IsSpeakingCallback; |
| 27 |
| 28 virtual ~SpeechSynthesizerClient() {} |
| 29 |
| 30 // Speaks the specified text. |
| 31 virtual void Speak(const std::string& text) = 0; |
| 32 |
| 33 // Sets options for the subsequent speech synthesis requests. |
| 34 // Use the constants below. |
| 35 virtual void SetSpeakProperties(const std::string& props) = 0; |
| 36 |
| 37 // Stops speaking the current utterance. |
| 38 virtual void StopSpeaking() = 0; |
| 39 |
| 40 // Checks if the engine is currently speaking. |
| 41 // |callback| will be called on the origin thread later with the result. |
| 42 virtual void IsSpeaking(IsSpeakingCallback callback) = 0; |
| 43 |
| 44 // Factory function, creates a new instance and returns ownership. |
| 45 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 46 static SpeechSynthesizerClient* Create(dbus::Bus* bus); |
| 47 |
| 48 // Constants to be used with SetSpeakProperties. |
| 49 static const char kSpeechPropertyLocale[]; |
| 50 static const char kSpeechPropertyGender[]; |
| 51 static const char kSpeechPropertyRate[]; |
| 52 static const char kSpeechPropertyPitch[]; |
| 53 static const char kSpeechPropertyVolume[]; |
| 54 static const char kSpeechPropertyEquals[]; |
| 55 static const char kSpeechPropertyDelimiter[]; |
| 56 }; |
| 57 |
| 58 } // namespace chromeos |
| 59 |
| 60 #endif // CHROME_BROWSER_CHROMEOS_DBUS_SPEECH_SYNTHESIZER_CLIENT_H_ |
OLD | NEW |