com.speech4j.speech
Class TTSMode

java.lang.Object
  |
  +--com.speech4j.speech.NativeObject
        |
        +--com.speech4j.speech.TTSMode

public class TTSMode
extends NativeObject

Represents CTTSMode class.

Version:
1.3
Author:
Pavel Vlasov

Field Summary
static byte CHARSET_ENGINEPHONETIC
          An engine-specific phonetic character set
static byte CHARSET_IPAPHONETIC
          The IPA character set
static byte CHARSET_TEXT
          The text character set
static byte VPS_ABBREVIATION
          Shortened form of a word -- for example, "hr." is an abbreviation for "hour."
static byte VPS_ADJECTIVE
          Word that modifies a noun -- for example, "green" describes color in "green grass."
static byte VPS_ADVERB
          Word that modifies a verb, an adjective, or another adverb -- for example, "quickly" describes speed in "quickly run."
static byte VPS_CARDINAL
          Number used in simple counting -- for example, "one," "two," or "three."
static byte VPS_CONJUNCTION
          Word used to join sentences, clauses, or phrases -- for example, "dogs and cats."
static byte VPS_CONTRACTION
          Shortened form of one or two words with the omitted letter or letters indicated by an apostrophe -- for example, "can't" is the contraction for "cannot."
static byte VPS_DETERMINER
          Limiting noun modifier that precedes an adjective modifying the same noun -- for example, "her" in "her new house."
static byte VPS_INTERJECTION
          Word or phrase that expresses emotion -- for example, "indeed" or "heavens."
static byte VPS_NOUN
          Word that names a person, place, thing, or abstraction -- for example, "astronaut," "New York," "printer," or "history."
static byte VPS_ORDINAL
          Number used to show order -- for example, "first," "second," or "third."
static byte VPS_PREPOSITION
          Word that precedes a noun or pronoun to form an adjectival or adverbial phrase -- for example, "aboard" in "aboard the ship."
static byte VPS_PRONOUN
          Word that substitutes for a noun -- for example, "it" in "it fell apart."
static byte VPS_PROPERNOUN
          Noun that names a specific person or place -- for example, "Katherine" or "Cleveland."
static byte VPS_PUNCTUATION
          Marks that clarify the meaning and structure of writing -- for example, a period (.) indicates the end of a sentence.
static byte VPS_QUANTIFIER
          Limiting noun modifier that expresses quantity and precedes an adjective modifying the same noun -- for example, "four" in "the four ripe strawberries."
static byte VPS_UNKNOWN
          Part of speech is unknown, or the application or engine does not store this information.
static byte VPS_VERB
          Word that expresses an act or a state of being -- for example, "eat" or "be."
 
Constructor Summary
TTSMode()
           
 
Method Summary
 void aboutDlg()
          Invokes aboutDlg(null).
 void aboutDlg(java.lang.String title)
          See CTTSMode::AboutDlg()
 void add(byte charSet, java.lang.String text, java.lang.String pronounce, byte partOfSpeech)
          See CTTSMode::Add()
 void addSink(TTSNotifySink sink)
          Adds sink (event listener).
 void audioPause()
          See CTTSMode::AudioPause()
 void audioReset()
          See CTTSMode::AudioReset()
 void audioResume()
          See CTTSMode::AudioResume()
 void create()
          Creates native object.
 void destroy()
          Releases the corresponding native object.
protected  void finalize()
          Invokes destroy() to release undelining native object.
 void generalDlg()
          Invokes generalDlg(null).
 void generalDlg(java.lang.String title)
          See CTTSMode::GeneralDlg()
 java.lang.String get(byte charSet, java.lang.String text, short sense, ByteWrap partOfSpeech)
          See CTTSMode::Get()
 TTSModeInfo getMode()
          Creates new TTSModeInfo , calls next(TTSModeInfo) and retruns info.
 void getMode(TTSModeInfo info)
          See CTTSMode::ModeGet()
 short getPitch()
          See CTTSMode::PitchGet()
 long getPosn()
          See CTTSMode::PosnGet()
 int getRealTime()
          See CTTSMode::RealTimeGet()
 int getSpeed()
          See CTTSMode::SpeedGet()
 int getVolume()
          See CTTSMode::VolumeGet()
 void init()
          See CTTSMode::Init()
 void init(byte[] mode)
          See CTTSMode::Init(GUID gMode)
 void init(java.lang.String mode)
          Invokes init(string2Bytes(mode))
 void initAudioDestMM(int device)
          See CTTSMode::InitAudioDestMM()
 void initAudioDestObject(AudioDest audio)
          See CTTSMode::InitAudioDestObject()
 void inject(java.lang.String tag)
          See CTTSMode::Inject()
 void lexiconDlg()
          Invokes lexiconDlg(null).
 void lexiconDlg(java.lang.String title)
          See CTTSMode::LexiconDlg()
 java.lang.String phoneme(byte charSet, int flags, java.lang.String text)
          See CTTSMode::Phoneme()
 void remove(java.lang.String text, short sense)
          See CTTSMode::Remove()
 void removeSink(TTSNotifySink sink)
          Removes sink (event listener)
 void setPitch(short pitch)
          See CTTSMode::PitchSet()
 void setRealTime(int realTime)
          See CTTSMode::RealTimeSet()
 void setSpeed(int speed)
          See CTTSMode::SpeedSet()
 void setVolume(int volume)
          See CTTSMode::VolumeSet()
 void speak(java.lang.String speak)
          Invokes speak(speak, false, null)
 void speak(java.lang.String speak, boolean tagged, TTSBufNotifySink sink)
          See CTTSMode::Speak()
 void speakAndWait(java.lang.String speak, boolean tagged)
          Speaks the text.
 void textData(byte charSet, int flags, java.lang.String text)
          Invokes textData(charSet, flags, text, null)
 void textData(byte charSet, int flags, java.lang.String text, TTSBufNotifySink sink)
          See CTTSMode::TextData()
 void translateDlg()
          Invokes translateDlg(null).
 void translateDlg(java.lang.String title)
          See CTTSMode::TranslateDlg()
 
Methods inherited from class com.speech4j.speech.NativeObject
bytes2String, cleanup, getObjID, processMessages, stopProcessingMessages, string2Bytes, testSpeech
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARSET_TEXT

public static final byte CHARSET_TEXT
The text character set

See Also:
Constant Field Values

CHARSET_IPAPHONETIC

public static final byte CHARSET_IPAPHONETIC
The IPA character set

See Also:
Constant Field Values

CHARSET_ENGINEPHONETIC

public static final byte CHARSET_ENGINEPHONETIC
An engine-specific phonetic character set

See Also:
Constant Field Values

VPS_UNKNOWN

public static final byte VPS_UNKNOWN
Part of speech is unknown, or the application or engine does not store this information.

See Also:
Constant Field Values

VPS_NOUN

public static final byte VPS_NOUN
Word that names a person, place, thing, or abstraction -- for example, "astronaut," "New York," "printer," or "history."

See Also:
Constant Field Values

VPS_VERB

public static final byte VPS_VERB
Word that expresses an act or a state of being -- for example, "eat" or "be."

See Also:
Constant Field Values

VPS_ADVERB

public static final byte VPS_ADVERB
Word that modifies a verb, an adjective, or another adverb -- for example, "quickly" describes speed in "quickly run."

See Also:
Constant Field Values

VPS_ADJECTIVE

public static final byte VPS_ADJECTIVE
Word that modifies a noun -- for example, "green" describes color in "green grass."

See Also:
Constant Field Values

VPS_PROPERNOUN

public static final byte VPS_PROPERNOUN
Noun that names a specific person or place -- for example, "Katherine" or "Cleveland."

See Also:
Constant Field Values

VPS_PRONOUN

public static final byte VPS_PRONOUN
Word that substitutes for a noun -- for example, "it" in "it fell apart."

See Also:
Constant Field Values

VPS_CONJUNCTION

public static final byte VPS_CONJUNCTION
Word used to join sentences, clauses, or phrases -- for example, "dogs and cats."

See Also:
Constant Field Values

VPS_CARDINAL

public static final byte VPS_CARDINAL
Number used in simple counting -- for example, "one," "two," or "three."

See Also:
Constant Field Values

VPS_ORDINAL

public static final byte VPS_ORDINAL
Number used to show order -- for example, "first," "second," or "third."

See Also:
Constant Field Values

VPS_DETERMINER

public static final byte VPS_DETERMINER
Limiting noun modifier that precedes an adjective modifying the same noun -- for example, "her" in "her new house."

See Also:
Constant Field Values

VPS_QUANTIFIER

public static final byte VPS_QUANTIFIER
Limiting noun modifier that expresses quantity and precedes an adjective modifying the same noun -- for example, "four" in "the four ripe strawberries."

See Also:
Constant Field Values

VPS_PUNCTUATION

public static final byte VPS_PUNCTUATION
Marks that clarify the meaning and structure of writing -- for example, a period (.) indicates the end of a sentence.

See Also:
Constant Field Values

VPS_CONTRACTION

public static final byte VPS_CONTRACTION
Shortened form of one or two words with the omitted letter or letters indicated by an apostrophe -- for example, "can't" is the contraction for "cannot."

See Also:
Constant Field Values

VPS_INTERJECTION

public static final byte VPS_INTERJECTION
Word or phrase that expresses emotion -- for example, "indeed" or "heavens."

See Also:
Constant Field Values

VPS_ABBREVIATION

public static final byte VPS_ABBREVIATION
Shortened form of a word -- for example, "hr." is an abbreviation for "hour."

See Also:
Constant Field Values

VPS_PREPOSITION

public static final byte VPS_PREPOSITION
Word that precedes a noun or pronoun to form an adjectival or adverbial phrase -- for example, "aboard" in "aboard the ship."

See Also:
Constant Field Values
Constructor Detail

TTSMode

public TTSMode()
Method Detail

finalize

protected void finalize()
Invokes destroy() to release undelining native object.

Overrides:
finalize in class java.lang.Object

textData

public void textData(byte charSet,
                     int flags,
                     java.lang.String text)
              throws SpeechException
Invokes textData(charSet, flags, text, null)

Parameters:
charSet - Character set. Can be CHARSET_ENGINEPHONETIC, CHARSET_IPAPHONETIC, CHARSET_TEXT
flags - Flags
text - Text to speak
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or TextData() returns nonzero error code.

speak

public void speak(java.lang.String speak)
           throws SpeechException
Invokes speak(speak, false, null)

Parameters:
speak - Text to speak
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Speak returns nonzero error code.

create

public void create()
            throws SpeechException
Creates native object.

Throws:
SpeechException - If a corresponding native object already exists.

destroy

public void destroy()
Releases the corresponding native object. Can be invoked many times. Nothing happens if the native object already released.


initAudioDestObject

public void initAudioDestObject(AudioDest audio)
                         throws SpeechException
See CTTSMode::InitAudioDestObject()

Parameters:
audio - Audio destination
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or InitAudioDestObject() returns nonzero error code.

initAudioDestMM

public void initAudioDestMM(int device)
                     throws SpeechException
See CTTSMode::InitAudioDestMM()

Parameters:
device - MMDevice number
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or InitAudioDestMM() returns nonzero error code.

init

public void init()
          throws SpeechException
See CTTSMode::Init()

Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Init() returns nonzero error code.

init

public void init(byte[] mode)
          throws SpeechException
See CTTSMode::Init(GUID gMode)

Parameters:
mode - Mode ID
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Init() returns nonzero error code.

init

public void init(java.lang.String mode)
          throws SpeechException
Invokes init(string2Bytes(mode))

Parameters:
mode - Mode ID
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Init() returns nonzero error code.

getPitch

public short getPitch()
               throws SpeechException
See CTTSMode::PitchGet()

Returns:
Pitch
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or PitchGet() returns nonzero error code.

setPitch

public void setPitch(short pitch)
              throws SpeechException
See CTTSMode::PitchSet()

Parameters:
pitch - Pitch
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or PitchSet() returns nonzero error code.

getRealTime

public int getRealTime()
                throws SpeechException
See CTTSMode::RealTimeGet()

Returns:
Real time setting
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or RealTimeGet() returns nonzero error code.

setRealTime

public void setRealTime(int realTime)
                 throws SpeechException
See CTTSMode::RealTimeSet()

Parameters:
realTime - Real time setting
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or RealTimeSet() returns nonzero error code.

getSpeed

public int getSpeed()
             throws SpeechException
See CTTSMode::SpeedGet()

Returns:
Average speed of text-to-speech mode
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or SpeedGet() returns nonzero error code.

setSpeed

public void setSpeed(int speed)
              throws SpeechException
See CTTSMode::SpeedSet()

Parameters:
speed - Speed of a text-to-speech mode.
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or SpeedSet() returns nonzero error code.

getVolume

public int getVolume()
              throws SpeechException
See CTTSMode::VolumeGet()

Returns:
Volume
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or VolumeGet() returns nonzero error code.

setVolume

public void setVolume(int volume)
               throws SpeechException
See CTTSMode::VolumeSet()

Parameters:
volume - Volume
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or VolumeSet() returns nonzero error code.

audioPause

public void audioPause()
                throws SpeechException
See CTTSMode::AudioPause()

Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or AudioPause() returns nonzero error code.

audioReset

public void audioReset()
                throws SpeechException
See CTTSMode::AudioReset()

Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or AudioReset() returns nonzero error code.

audioResume

public void audioResume()
                 throws SpeechException
See CTTSMode::AudioResume()

Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or AudioResume() returns nonzero error code.

inject

public void inject(java.lang.String tag)
            throws SpeechException
See CTTSMode::Inject()

Parameters:
tag - Tag to inject
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Inject() returns nonzero error code.

getMode

public void getMode(TTSModeInfo info)
             throws SpeechException
See CTTSMode::ModeGet()

Parameters:
info - TTSModeInfo to put data to
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or ModeGet() returns nonzero error code.

getMode

public TTSModeInfo getMode()
                    throws SpeechException
Creates new TTSModeInfo , calls next(TTSModeInfo) and retruns info. See CTTSEnum::Next()

Returns:
TTSModeInfo
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or ModeGet() returns nonzero error code.

phoneme

public java.lang.String phoneme(byte charSet,
                                int flags,
                                java.lang.String text)
                         throws SpeechException
See CTTSMode::Phoneme()

Parameters:
charSet - Character set. Can be CHARSET_ENGINEPHONETIC, CHARSET_IPAPHONETIC, CHARSET_TEXT
flags - Flags
text - Text
Returns:
Phonetic representation of the text
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Phoneme() returns nonzero error code.

getPosn

public long getPosn()
             throws SpeechException
See CTTSMode::PosnGet()

Returns:
Position
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or PosnGet() returns nonzero error code.

textData

public void textData(byte charSet,
                     int flags,
                     java.lang.String text,
                     TTSBufNotifySink sink)
              throws SpeechException
See CTTSMode::TextData()

Parameters:
charSet - Character set. Can be CHARSET_ENGINEPHONETIC, CHARSET_IPAPHONETIC, CHARSET_TEXT
flags - Flags
text - Text to speak
sink - TTSBufNotifySink
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or TextData() returns nonzero error code.

speak

public void speak(java.lang.String speak,
                  boolean tagged,
                  TTSBufNotifySink sink)
           throws SpeechException
See CTTSMode::Speak()

Parameters:
speak - Text to speak
tagged - Indicates tagged text
sink - Event sink
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Speak() returns nonzero error code.

speakAndWait

public void speakAndWait(java.lang.String speak,
                         boolean tagged)
                  throws SpeechException
Speaks the text. Does not return until all text is spoken.

Parameters:
speak - Text.
tagged - Indicates tagged text.
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Speak() returns nonzero error code.

aboutDlg

public void aboutDlg(java.lang.String title)
              throws SpeechException
See CTTSMode::AboutDlg()

Parameters:
title - Dialog window title
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or AboutDlg() returns nonzero error code.

generalDlg

public void generalDlg(java.lang.String title)
                throws SpeechException
See CTTSMode::GeneralDlg()

Parameters:
title - Dialog window title
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or GeneralDlg() returns nonzero error code.

lexiconDlg

public void lexiconDlg(java.lang.String title)
                throws SpeechException
See CTTSMode::LexiconDlg()

Parameters:
title - Dialog window title
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or LexiconDlg() returns nonzero error code.

translateDlg

public void translateDlg(java.lang.String title)
                  throws SpeechException
See CTTSMode::TranslateDlg()

Parameters:
title - Dialog window title
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or TranslateDlg() returns nonzero error code.

aboutDlg

public void aboutDlg()
              throws SpeechException
Invokes aboutDlg(null).

Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or AboutDlg() returns nonzero error code.

generalDlg

public void generalDlg()
                throws SpeechException
Invokes generalDlg(null).

Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or GeneralDlg() returns nonzero error code.

lexiconDlg

public void lexiconDlg()
                throws SpeechException
Invokes lexiconDlg(null).

Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or LexiconDlg() returns nonzero error code.

translateDlg

public void translateDlg()
                  throws SpeechException
Invokes translateDlg(null).

Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or TranslateDlg() returns nonzero error code.

addSink

public void addSink(TTSNotifySink sink)
             throws SpeechException,
                    java.lang.NullPointerException
Adds sink (event listener).

Parameters:
sink - TTSNotifySink
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or sink registration fails.
java.lang.NullPointerException - If sink is null.

removeSink

public void removeSink(TTSNotifySink sink)
                throws SpeechException
Removes sink (event listener)

Parameters:
sink - TTSNotifySink
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or sink unregistration fails.

add

public void add(byte charSet,
                java.lang.String text,
                java.lang.String pronounce,
                byte partOfSpeech)
         throws SpeechException
See CTTSMode::Add()

Parameters:
charSet - Character set. Can be CHARSET_ENGINEPHONETIC, CHARSET_IPAPHONETIC, CHARSET_TEXT
text - Text
pronounce - Phonetic transcription
partOfSpeech - Part of speech. Can be one of the following:
  • VPS_UNKNOWN
  • VPS_NOUN
  • VPS_VERB
  • VPS_ADVERB
  • VPS_ADJECTIVE
  • VPS_PROPERNOUN
  • VPS_PRONOUN
  • VPS_CONJUNCTION
  • VPS_CARDINAL
  • VPS_ORDINAL
  • VPS_DETERMINER
  • VPS_QUANTIFIER
  • VPS_PUNCTUATION
  • VPS_CONTRACTION
  • VPS_INTERJECTION
  • VPS_ABBREVIATION
  • VPS_PREPOSITION
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Add() returns nonzero error code.

get

public java.lang.String get(byte charSet,
                            java.lang.String text,
                            short sense,
                            ByteWrap partOfSpeech)
                     throws SpeechException
See CTTSMode::Get()

Parameters:
charSet - Character set. Can be CHARSET_ENGINEPHONETIC, CHARSET_IPAPHONETIC, CHARSET_TEXT
text - Text
sense - Sense. Starts with 0.
partOfSpeech - Part of speech. Can be one of the following:
  • VPS_UNKNOWN
  • VPS_NOUN
  • VPS_VERB
  • VPS_ADVERB
  • VPS_ADJECTIVE
  • VPS_PROPERNOUN
  • VPS_PRONOUN
  • VPS_CONJUNCTION
  • VPS_CARDINAL
  • VPS_ORDINAL
  • VPS_DETERMINER
  • VPS_QUANTIFIER
  • VPS_PUNCTUATION
  • VPS_CONTRACTION
  • VPS_INTERJECTION
  • VPS_ABBREVIATION
  • VPS_PREPOSITION
Returns:
Pronunciation string
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Get() returns nonzero error code.

remove

public void remove(java.lang.String text,
                   short sense)
            throws SpeechException
See CTTSMode::Remove()

Parameters:
text - Text
sense - Sense.
Throws:
SpeechException - If a corresponding native object does not exist (create() has not been invoked or destroy() has been invoked) or Remove() returns nonzero error code.


Copyright © 2003 Pavel Vlasov. All Rights Reserved.