Home | History | Annotate | Download | only in cros
      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_CROS_SPEECH_SYNTHESIS_LIBRARY_H_
      6 #define CHROME_BROWSER_CHROMEOS_CROS_SPEECH_SYNTHESIS_LIBRARY_H_
      7 #pragma once
      8 
      9 #include "base/memory/singleton.h"
     10 
     11 namespace chromeos {
     12 
     13 // This interface defines the interaction with the ChromeOS login library APIs.
     14 class SpeechSynthesisLibrary {
     15  public:
     16   typedef void(*InitStatusCallback)(bool success);
     17 
     18   virtual ~SpeechSynthesisLibrary() {}
     19 
     20   // Speaks the specified text.
     21   virtual bool Speak(const char* text) = 0;
     22 
     23   // Sets options for the subsequent speech synthesis requests.
     24   // Use the constants below.
     25   virtual bool SetSpeakProperties(const char* props) = 0;
     26 
     27   // Stops speaking the current utterance.
     28   virtual bool StopSpeaking() = 0;
     29 
     30   // Checks if the engine is currently speaking.
     31   virtual bool IsSpeaking() = 0;
     32 
     33   // Starts the speech synthesis service and indicates through a callback if
     34   // it started successfully.
     35   virtual void InitTts(InitStatusCallback) = 0;
     36 
     37   // Factory function, creates a new instance and returns ownership.
     38   // For normal usage, access the singleton via CrosLibrary::Get().
     39   static SpeechSynthesisLibrary* GetImpl(bool stub);
     40 
     41   // Constants to be used with SetSpeakProperties.
     42   static const char kSpeechPropertyLocale[];
     43   static const char kSpeechPropertyGender[];
     44   static const char kSpeechPropertyRate[];
     45   static const char kSpeechPropertyPitch[];
     46   static const char kSpeechPropertyVolume[];
     47   static const char kSpeechPropertyEquals[];
     48   static const char kSpeechPropertyDelimiter[];
     49 };
     50 
     51 }  // namespace chromeos
     52 
     53 #endif  // CHROME_BROWSER_CHROMEOS_CROS_SPEECH_SYNTHESIS_LIBRARY_H_
     54