org.eclipse.actf.ai.tts

## Interface ITTSEngine

All Known Subinterfaces:
  ISAPIEngine

    public interface ITTSEngine

ITTSEngine interface defines low level text synthesis interface to be implemented by text-to-speech engine

### Field Summary

Fields
`static String` `GENDER_FEMALE`
`static String` `GENDER_MALE`
`static String` `LANG_ENGLISH` Deprecated.
`static String` `LANG_JAPANESE` Deprecated.
`static Set<String>` `LANGSET`
`static int` `TTSFLAG_DEFAULT` Append speak request at end of speak requests
`static int` `TTSFLAG_FLUSH` Flash all pending speak request prior to request speak

### Method Summary

Methods
`boolean` `canSpeakToFile()` Returns `true` if TTS engine supports to speak text into WAV file, and `false` otherwise.
`void` `dispose()` Dispose TTS engine
`int` `getSpeed()` Get current speaking speed
`boolean` `isAvailable()` Returns current availability of TTS engine
`boolean` `isDisposed()` Returns `true` if the TTSEngine has been disposed, and `false` otherwise.
`void` `setEventListener(IVoiceEventListener eventListener)` Set event listener in order to receive index event
`void` `setGender(String gender)` Set voice gender
`void` `setLanguage(String language)` Set voice language
`void` `setSpeed(int speed)` Set speaking speed
`void` `speak(String text, int flags, int index)` Speak the contents of a text string
`boolean` `speakToFile(String text, File file)` Speak the contents of a text string into WAV file
`void` `stop()` Flash all pending speak request

### Field Detail

#### TTSFLAG_DEFAULT

    static final int TTSFLAG_DEFAULT

Append speak request at end of speak requests

See Also:
  Constant Field Values

#### TTSFLAG_FLUSH

    static final int TTSFLAG_FLUSH

Flash all pending speak request prior to request speak

See Also:
  Constant Field Values

#### LANG_ENGLISH

    @Deprecated
    static final String LANG_ENGLISH

Deprecated.

See Also:
  Constant Field Values

#### LANG_JAPANESE

    @Deprecated
    static final String LANG_JAPANESE

Deprecated.

See Also:
  Constant Field Values

#### LANGSET

    static final Set<String> LANGSET

#### GENDER_MALE

    static final String GENDER_MALE

See Also:
  Constant Field Values

#### GENDER_FEMALE

    static final String GENDER_FEMALE

See Also:
  Constant Field Values

### Method Detail

#### speak

    void speak(String text,
             int flags,
             int index)

Speak the contents of a text string

Parameters:
  `text` - text string to be spoken
  `flags` - text speak flags. see TTSFLAG_*
  `index` - positive int value to be reported via IVoiceEventListener when start speaking text. TTS engine should also report -1 when completed. index event should not reported when negative index is specified

#### stop

    void stop()

Flash all pending speak request

#### setEventListener

    void setEventListener(IVoiceEventListener eventListener)

Set event listener in order to receive index event

Parameters:
  `eventListener` -

#### dispose

    void dispose()

Dispose TTS engine

#### isDisposed

    boolean isDisposed()

Returns `true` if the TTSEngine has been disposed, and `false` otherwise.

Returns:
  `true` when the TTSEngine is disposed and `false` otherwise

#### getSpeed

    int getSpeed()

Get current speaking speed

See Also:
  `IVoice.getSpeed()`

#### setSpeed

    void setSpeed(int speed)

Set speaking speed

See Also:
  `IVoice.setSpeed(int)`

#### setLanguage

    void setLanguage(String language)

Set voice language

Parameters:
  `language` -

#### setGender

    void setGender(String gender)

Set voice gender

Parameters:
  `gender` -

#### isAvailable

    boolean isAvailable()

Returns current availability of TTS engine

Returns:
  true when TTS engine is available false when TTS engine is not available

#### canSpeakToFile

    boolean canSpeakToFile()

Returns `true` if TTS engine supports to speak text into WAV file, and `false` otherwise.

Returns:
  `true` if TTS engine supports to speak text into WAV file, and `false` otherwise.

#### speakToFile

    boolean speakToFile(String text,
                      File file)

Speak the contents of a text string into WAV file

Parameters:
  `text` - text string to be spoken
  `file` - target File to write WAV data.
Returns:
  `true` if WAV file is successfully generated, and `false` otherwise.