1 //Create a class for speech synthesis
2 package SpeechSynthesis
3 import Timer.SimulatedTimer
5 public class SpeechSynthesises {
6 private int deviceNumbers
7 private List speechSynthesises
10 //For one device(We cannot have obj.id)-> We should have obj[0].id
11 private String id = "speechSynthesisID0"
12 private String label = "speechSynthesis0"
13 private String displayName = "speechSynthesis0"
14 private int level = 50
17 SpeechSynthesises(Closure sendEvent, int deviceNumbers, boolean init) {
18 this.sendEvent = sendEvent
19 this.deviceNumbers = deviceNumbers
20 this.speechSynthesises = []
27 speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level))
30 //Methods for closures
31 def count(Closure Input) {
32 speechSynthesises.count(Input)
35 speechSynthesises.size()
37 def each(Closure Input) {
38 speechSynthesises.each(Input)
40 def find(Closure Input) {
41 speechSynthesises.find(Input)
43 def sort(Closure Input) {
44 speechSynthesises.sort(Input)
46 def collect(Closure Input) {
47 speechSynthesises.collect(Input)
50 def setLevel(int level) {
51 if (level != this.level) {
53 speechSynthesises[0].setLevel(level)
57 def speak(String message) {
58 speechSynthesises[0].speak(message)