projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altosui: Hide internal rom config UI helper function
[fw/altos]
/
ao-tools
/
altosui
/
AltosVoice.java
diff --git
a/ao-tools/altosui/AltosVoice.java
b/ao-tools/altosui/AltosVoice.java
index 0c34795c55083981df54cf56f9ff6dcdf74e6c8a..ebe9d5a81c0d5c8b1cab4084db70925dc59049b8 100644
(file)
--- a/
ao-tools/altosui/AltosVoice.java
+++ b/
ao-tools/altosui/AltosVoice.java
@@
-17,16
+17,14
@@
package altosui;
package altosui;
-
/*
import com.sun.speech.freetts.Voice;
+import com.sun.speech.freetts.Voice;
import com.sun.speech.freetts.VoiceManager;
import com.sun.speech.freetts.VoiceManager;
-import com.sun.speech.freetts.audio.JavaClipAudioPlayer;
*/
+import com.sun.speech.freetts.audio.JavaClipAudioPlayer;
import java.util.concurrent.LinkedBlockingQueue;
public class AltosVoice implements Runnable {
import java.util.concurrent.LinkedBlockingQueue;
public class AltosVoice implements Runnable {
-/*
VoiceManager voice_manager;
Voice voice;
VoiceManager voice_manager;
Voice voice;
-*/
LinkedBlockingQueue<String> phrases;
Thread thread;
LinkedBlockingQueue<String> phrases;
Thread thread;
@@
-36,29
+34,38
@@
public class AltosVoice implements Runnable {
try {
for (;;) {
String s = phrases.take();
try {
for (;;) {
String s = phrases.take();
-/* voice.speak(s); */
+ voice.speak(s);
}
} catch (InterruptedException e) {
}
}
}
} catch (InterruptedException e) {
}
}
- public void speak(String s) {
+
+ public void speak_always(String s) {
try {
try {
-/* if (voice != null) */
+ if (voice != null)
phrases.put(s);
} catch (InterruptedException e) {
}
}
phrases.put(s);
} catch (InterruptedException e) {
}
}
+ public void speak(String s) {
+ if (AltosPreferences.voice())
+ speak_always(s);
+ }
+
+ public void speak(String format, Object... parameters) {
+ speak(String.format(format, parameters));
+ }
+
public AltosVoice () {
public AltosVoice () {
-
/*
voice_manager = VoiceManager.getInstance();
+
voice_manager = VoiceManager.getInstance();
voice = voice_manager.getVoice(voice_name);
voice = voice_manager.getVoice(voice_name);
- if (voice != null)
*/
{
-/* voice.allocate(); */
+ if (voice != null) {
+ voice.allocate();
phrases = new LinkedBlockingQueue<String> ();
thread = new Thread(this);
thread.start();
phrases = new LinkedBlockingQueue<String> ();
thread = new Thread(this);
thread.start();
- speak("Rocket Flight Monitor Ready");
- } /* else {
+ } else {
System.out.printf("Voice manager failed to open %s\n", voice_name);
Voice[] voices = voice_manager.getVoices();
System.out.printf("Available voices:\n");
System.out.printf("Voice manager failed to open %s\n", voice_name);
Voice[] voices = voice_manager.getVoices();
System.out.printf("Available voices:\n");
@@
-66,6
+73,6
@@
public class AltosVoice implements Runnable {
System.out.println(" " + voices[i].getName()
+ " (" + voices[i].getDomain() + " domain)");
}
System.out.println(" " + voices[i].getName()
+ " (" + voices[i].getDomain() + " domain)");
}
- } */
+ }
}
}
}
}