org.alchar.jdtk
Class DECtalk

java.lang.Object
  extended by org.alchar.jdtk.DECtalk

public class DECtalk
extends Object

This class provides a API to the DECtalk software speech synthesizer. Due to the internal threading implementation in the speech synthesizer, direct access to the library by means of JNI is not possible. A client/server API is used instead.


Field Summary
static int MSG_INDEX_MARK
           
static int MSG_STATUS
           
 
Method Summary
 void addBuffer(int maxChars, int maxPhones, int maxIndices)
          Add a memory buffer with the given parameters.
 void addCallBackListener(CallBackListener listener)
          Add a call back listener to the listener list of this object.
 void cbIndexMark(int dmy, int mark)
          Process a call back for an index mark.
 void cbStatus(int type, int dmy)
          Process a call back for a status message.
 void closeInMemory()
          Close the current (in-memory) output buffer.
 void closeLogFile()
          Close a previously opened log file.
 void closeWaveOutputFile()
          Close a previously opened wave output file.
 Caps getCaps()
          Return the capabilities of the synthesizer.
static DECtalk getDECtalk()
          Return a reference to the singleton DECtalk object.
 int getLanguage()
          Return the currently selected language.
 int getRate()
          Return the speaking rate.
 int getSpeaker()
          Return the currently selected speaker.
 Status getStatus()
          Return the status of the synthesizer.
 int getVolume(int channel)
          Return the volume.
 void loadUserDict(String fileName)
          Load a user dictionary from the given filename.
static void main(String[] argv)
          Method to implement a standalone test utility.
 void openInMem(String fileName, int format)
          Open an (in-memory) output buffer for the given output format.
 void openLogFile(String fileName, int flags)
          Open a log file with the given filename and options flag.
 void openWaveOutFile(String fileName, int format)
          Open an output file with the given filename for the given output format.
 void pause()
          Pause the synthesizer output.
 void removeCallBackListener(CallBackListener listener)
          Remove a call back listener from the listener list of this object.
 void reset(boolean fullReset)
          Reste the synthesizer.
 void resume()
          Resume the synthesizer output.
 Object returnBuffer()
          Return the current (in-memory) buffer.
 void sendAudioStarted(CallBackEvent ev)
          Send an audio started call back event.
 void sendAudioStopped(CallBackEvent ev)
          Send an audio stopped call back event.
 void sendIndexMark(CallBackEvent ev)
          Send an index mark call back event.
 void setLanguage(int language)
          Set the language.
 void setRate(int rate)
          Set the speaking rate.
 void setSpeaker(int speaker)
          Set the speaker.
 void setVolume(int channel, int level)
          Set the volume for the given channel.
 void shutdown()
          Terminate the execution of the speech synthesizer.
 void speak(String text)
          Speak the given string with nirmal priority.
 void speakImmediately(String text)
          Speak the given string with higher priority.
 void startup()
          Initialize the synthesizer.
 void sync()
          Force completion of queued text processing.
 void unloadUserDict()
          Unload a previously loaded user dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_INDEX_MARK

public static final int MSG_INDEX_MARK
See Also:
Constant Field Values

MSG_STATUS

public static final int MSG_STATUS
See Also:
Constant Field Values
Method Detail

getDECtalk

public static DECtalk getDECtalk()
Return a reference to the singleton DECtalk object.

Returns:
DECtalk object

addCallBackListener

public void addCallBackListener(CallBackListener listener)
Add a call back listener to the listener list of this object.

Parameters:
listener - Call back listener

removeCallBackListener

public void removeCallBackListener(CallBackListener listener)
Remove a call back listener from the listener list of this object.

Parameters:
listener - Call back listener

cbIndexMark

public void cbIndexMark(int dmy,
                        int mark)
Process a call back for an index mark.

Parameters:
dmy - Dummy
mark - Index mark id

sendIndexMark

public void sendIndexMark(CallBackEvent ev)
Send an index mark call back event.

Parameters:
ev - Call back event

cbStatus

public void cbStatus(int type,
                     int dmy)
Process a call back for a status message.

Parameters:
type - Status type
dmy - Dummy

sendAudioStarted

public void sendAudioStarted(CallBackEvent ev)
Send an audio started call back event.

Parameters:
ev - Call back event

sendAudioStopped

public void sendAudioStopped(CallBackEvent ev)
Send an audio stopped call back event.

Parameters:
ev - Call back event

addBuffer

public void addBuffer(int maxChars,
                      int maxPhones,
                      int maxIndices)
               throws DECtalkException
Add a memory buffer with the given parameters.
This method has not been implemented.

Parameters:
maxChars - Maximum number of characters
maxPhones - Maximum number of phonemes
maxIndices - Maximum number of index marks
Throws:
DECtalkException - Operation failed

closeInMemory

public void closeInMemory()
                   throws DECtalkException
Close the current (in-memory) output buffer.
This method has not been implemented.

Throws:
DECtalkException - Operation failed

closeLogFile

public void closeLogFile()
                  throws DECtalkException
Close a previously opened log file.

Throws:
DECtalkException - Operation failed

closeWaveOutputFile

public void closeWaveOutputFile()
                         throws DECtalkException
Close a previously opened wave output file.

Throws:
DECtalkException - Operation failed

getCaps

public Caps getCaps()
             throws DECtalkException
Return the capabilities of the synthesizer.

Returns:
Caps object
Throws:
DECtalkException - Operation failed

getLanguage

public int getLanguage()
                throws DECtalkException
Return the currently selected language.

Returns:
Language id
Throws:
DECtalkException - Operation failed

getRate

public int getRate()
            throws DECtalkException
Return the speaking rate.

Returns:
Rate
Throws:
DECtalkException - Operation failed

getSpeaker

public int getSpeaker()
               throws DECtalkException
Return the currently selected speaker.

Returns:
Speaker id
Throws:
DECtalkException - Operation failed

getStatus

public Status getStatus()
                 throws DECtalkException
Return the status of the synthesizer.

Returns:
Status object
Throws:
DECtalkException - Operation failed

getVolume

public int getVolume(int channel)
              throws DECtalkException
Return the volume.

Parameters:
channel - Channel id
Returns:
Volume level
Throws:
DECtalkException - Operation failed

loadUserDict

public void loadUserDict(String fileName)
                  throws DECtalkException
Load a user dictionary from the given filename. Only one user dictionary can be loaded at a given time.
This method has not been implemented.

Parameters:
fileName - File name
Throws:
DECtalkException - Operation failed

openInMem

public void openInMem(String fileName,
                      int format)
               throws DECtalkException
Open an (in-memory) output buffer for the given output format.
This method has not been implemented.

Parameters:
format - Output format id
Throws:
DECtalkException - Operation failed

openLogFile

public void openLogFile(String fileName,
                        int flags)
                 throws DECtalkException
Open a log file with the given filename and options flag.

Parameters:
fileName - File name
flags - Flags
Throws:
DECtalkException - Operation failed

openWaveOutFile

public void openWaveOutFile(String fileName,
                            int format)
                     throws DECtalkException
Open an output file with the given filename for the given output format.

Parameters:
fileName - File name
format - Output format id
Throws:
DECtalkException - Operation failed

pause

public void pause()
           throws DECtalkException
Pause the synthesizer output.

Throws:
DECtalkException - Operation failed

reset

public void reset(boolean fullReset)
           throws DECtalkException
Reste the synthesizer.

Parameters:
fullReset - True if state should not be kept
Throws:
DECtalkException - Operation failed

resume

public void resume()
            throws DECtalkException
Resume the synthesizer output.

Throws:
DECtalkException - Operation failed

returnBuffer

public Object returnBuffer()
                    throws DECtalkException
Return the current (in-memory) buffer.
This method has not been implemented.

Returns:
Output buffer
Throws:
DECtalkException - Operation failed

setLanguage

public void setLanguage(int language)
                 throws DECtalkException
Set the language.

Parameters:
language - Language id
Throws:
DECtalkException - Operation failed

setRate

public void setRate(int rate)
             throws DECtalkException
Set the speaking rate.

Parameters:
rate - Rate
Throws:
DECtalkException - Operation failed

setSpeaker

public void setSpeaker(int speaker)
                throws DECtalkException
Set the speaker.

Parameters:
speaker - Speaker id
Throws:
DECtalkException - Operation failed

setVolume

public void setVolume(int channel,
                      int level)
               throws DECtalkException
Set the volume for the given channel.

Parameters:
channel - Channel id
level - Volume level
Throws:
DECtalkException - Operation failed

shutdown

public void shutdown()
              throws DECtalkException
Terminate the execution of the speech synthesizer.

Throws:
DECtalkException - Operation failed

speak

public void speak(String text)
           throws DECtalkException
Speak the given string with nirmal priority.

Parameters:
text - Text to be spoken
Throws:
DECtalkException - Operation failed

speakImmediately

public void speakImmediately(String text)
                      throws DECtalkException
Speak the given string with higher priority.

Parameters:
text - Text to be spoken
Throws:
DECtalkException - Operation failed

startup

public void startup()
             throws DECtalkException
Initialize the synthesizer.

Throws:
DECtalkException - Operation failed

sync

public void sync()
          throws DECtalkException
Force completion of queued text processing. This method will not return until all queued text has been spoken. If the speech synthesizer was paused, this method will cause it to resume.

Throws:
DECtalkException - Operation failed

unloadUserDict

public void unloadUserDict()
                    throws DECtalkException
Unload a previously loaded user dictionary. Only one user dictionary can be loaded at a given time.
This method has not been implemented.

Throws:
DECtalkException - Operation failed

main

public static void main(String[] argv)
Method to implement a standalone test utility.

Parameters:
argv - Argument array


Copyright © 2007-2009 Kris Van Hees. All Rights Reserved.