
Chapter 10.5. Prof. Bob is Ready to Answer Your Questions


This code comes from the website for the book:

  Killer Game Programming in Java
  Andrew Davison
  O'Reilly, May 2005
  ISBN: 0-596-00730-2
  http://www.oreilly.com/catalog/killergame/
  http://fivedots.coe.psu.ac.th/~ad/jg

However, this example and the associated chapter do _NOT_ appear 
in the printed book.

Contact Address:
  Dr. Andrew Davison
  Dept. of Computer Engineering
  Prince of Songkla University
  Hat Yai, Songkhla 90112, Thailand
  E-mail: ad@fivedots.coe.psu.ac.th


If you use this code, please mention my name, and include a link
to the book's Web site.

Thanks,
  Andrew

---------------------------------
Compilation: 

$ javac *.java

   /* You must have freeTTS installed for the compilation to succeed
      (see below for details).
      If you get "Warning" messages, please see the note below.
   */

---------------------------------
Execution: 

$ java ProfBob

Two configuration files, keyResponses.txt and vagueResponses.txt,
should be located in the current directory.

Prof. Bob's face and mouth images, face.jpg and mouth.jpg, 
should also be located in the current directory.


---------------------------------
Notes on freeTTS
http://freetts.sourceforge.net/

If you're not planning to modify and recompile freeTTS, then you
only need to download its binary file. I downloaded
  freeTTS-1.2.1-bin.zip (12.6 Mb)

If you're planning to program with the JSAPI, then download its 
documentation from http://java.sun.com/products/java-media/speech/
which includes a programmers guide.

Follow the freeTTS installation instructions CLOSELY. 
If you still have problems, then here are some things that caught me 
out:

1. Make sure you set the JAVA_HOME environment variable. On my machine, it is:

   set JAVA_HOME=c:\Progra~1\java\jdk1.5.0


2. Make sure you set the CLASSPATH environment variable. On my machine it is:

   set CLASSPATH=d:\freetts-1.2.1\lib\jsapi.jar;d:\freetts-1.2.1\lib\freetts.jar;%CLASSPATH%

   Note that I included jsapi.jar _and_ freetts.jar.

   Your IDE may also need CLASSPATH to mention the current directory:
   set CLASSPATH=d:\freetts-1.2.1\lib\jsapi.jar;d:\freetts-1.2.1\lib\freetts.jar;.;%CLASSPATH%
                                                                                 ^^

3. Test freeTTS before you try out ProfBob.

   Go to freeTTS's bin/ directory and try executing HelloWorld.jar:

   $ java -jar HelloWorld.jar

   Go to freeTTS's lib/ directory and try executing freeTTS.jar

   $ java -jar freeTTS.jar
   
   $ java -jar freeTTS.jar -help


---------------------------------
Note on "unchecked or unsafe operation" Warnings

I have not used J2SE 5.0's type-safe collections, so that this code 
will compile in early versions of J2SE (e.g. version 1.4).

The warning messages are always related to my use of collections
(e.g. ArrayList) without specifying a type for the objects they will
contain at run time.

No. of Warnings generated in J2SE 5.0 for the ProfBob example: 5
KeyResponses: 2
Responder: 2
VagueResponses: 1

---------------------------------
Last updated: 24th June 2005