Skip to content

Commit

Permalink
Some update that needs to be here.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisleung committed Dec 6, 2007
1 parent 41a2662 commit 861029b
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/speech/Speech.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package speech;

import java.util.*;

import com.sun.speech.freetts.*;
import com.sun.speech.freetts.en.*;

import misc.*;
import util.HierarchyObject;

public class Speech extends Thread {
static private Speech m_instance = null;
Expand All @@ -16,6 +15,9 @@ public class Speech extends Thread {
private Object m_sync = null;
private boolean m_mute = false;

private HierarchyObject m_curObj = null;


static {
m_instance = new Speech();
}
Expand Down Expand Up @@ -54,6 +56,11 @@ public void run() {
m_voice.speak(curMsg);
m_sync.notify();
}

// Do notification here
if (m_curObJ != null) {
m_curObj = null;
}
}
}
}
Expand All @@ -66,13 +73,24 @@ public void setMessage(String msg) {
}
}

public void setObj(HierarchyObject obj) {
synchronized(m_ready) {
m_voice.getAudioPlayer().cancel();
m_msg = obj.getValue();
m_ready.notify();
}
}
static public void setSpeed(float speed) {
m_instance.m_voice.setRate(speed);
}

static public void speak(String msg) {
m_instance.setMessage(msg);
}

static public void speakObj(HierarchyObject obj) {
m_instance.setObj(obj);
}

static public void cancel() {
m_instance.m_voice.getAudioPlayer().cancel();
Expand Down

0 comments on commit 861029b

Please sign in to comment.