org.firstinspires.ftc.robotcore.external.android

## Class AndroidTextToSpeech

- java.lang.Object
- - org.firstinspires.ftc.robotcore.external.android.AndroidTextToSpeech

-     public class AndroidTextToSpeech
      extends java.lang.Object

  A class that provides access to the Android TextToSpeech.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AndroidTextToSpeech()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Shuts down the TextToSpeech engine.
    `java.lang.String` | `getCountryCode()` Returns the current country code.
    `java.lang.String` | `getLanguageCode()` Returns the current language code.
    `java.lang.String` | `getStatus()` Returns the TextToSpeech initialization status.
    `void` | `initialize()` Initialize the TextToSpeech engine.
    `boolean` | `isLanguageAndCountryAvailable(java.lang.String languageCode, java.lang.String countryCode)` Returns true if the given language is supported.
    `boolean` | `isLanguageAvailable(java.lang.String languageCode)` Returns true if the given language is supported.
    `boolean` | `isSpeaking()` Returns true if the TextToSpeech engine is busy speaking.
    `void` | `setLanguage(java.lang.String languageCode)` Sets the language.
    `void` | `setLanguageAndCountry(java.lang.String languageCode, java.lang.String countryCode)` Sets the language and country.
    `void` | `setPitch(float pitch)` Sets the speech pitch.
    `void` | `setSpeechRate(float speechRate)` Sets the speech rate.
    `void` | `speak(java.lang.String text)` Speaks the given text.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AndroidTextToSpeech

          public AndroidTextToSpeech()

  - ### Method Detail

    - #### initialize

          public void initialize()

      Initialize the TextToSpeech engine.

    - #### getStatus

          public java.lang.String getStatus()

      Returns the TextToSpeech initialization status.

    - #### getLanguageCode

          public java.lang.String getLanguageCode()

      Returns the current language code.
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### getCountryCode

          public java.lang.String getCountryCode()

      Returns the current country code.
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### isSpeaking

          public boolean isSpeaking()

      Returns true if the TextToSpeech engine is busy speaking.
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### setPitch

          public void setPitch(float pitch)

      Sets the speech pitch. 1.0 is the normal pitch. Lower values will lower the tone of the synthesized voice. Greater values will increase the tone of the synthesized voice.
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### setSpeechRate

          public void setSpeechRate(float speechRate)

      Sets the speech rate. 1.0 is the normal speech rate. Lower values will slow down the speech (0.5 is half the normal speech rate). Greater values will accelerate the speech (2.0 is twice the normal speech rate).
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### isLanguageAvailable

          public boolean isLanguageAvailable(java.lang.String languageCode)

      Returns true if the given language is supported. The languageCode must be an ISO 639 alpha-2 or alpha-3 language code, or a language subtag up to 8 characters in length.
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### isLanguageAndCountryAvailable

          public boolean isLanguageAndCountryAvailable(java.lang.String languageCode,
                                                       java.lang.String countryCode)

      Returns true if the given language is supported. The languageCode must be an ISO 639 alpha-2 or alpha-3 language code, or a language subtag up to 8 characters in length. The countryCode must be an ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code.
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### setLanguage

          public void setLanguage(java.lang.String languageCode)

      Sets the language. The languageCode must be an ISO 639 alpha-2 or alpha-3 language code, or a language subtag up to 8 characters in length.
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### setLanguageAndCountry

          public void setLanguageAndCountry(java.lang.String languageCode,
                                            java.lang.String countryCode)

      Sets the language and country. The languageCode must be an ISO 639 alpha-2 or alpha-3 language code, or a language subtag up to 8 characters in length. The countryCode must be an ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code.
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### speak

          public void speak(java.lang.String text)

      Speaks the given text.
      Throws:
        `java.lang.IllegalStateException` - if initialized has not been called yet.

    - #### close

          public void close()

      Shuts down the TextToSpeech engine.