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
15 private boolean oneUser = true
18 SpeechSynthesises(Closure sendEvent, int deviceNumbers, boolean init) {
19 this.sendEvent = sendEvent
20 this.deviceNumbers = deviceNumbers
21 this.speechSynthesises = []
30 speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level, this.oneUser))
33 //Methods for closures
34 def count(Closure Input) {
35 speechSynthesises.count(Input)
38 speechSynthesises.size()
40 def each(Closure Input) {
41 speechSynthesises.each(Input)
43 def find(Closure Input) {
44 speechSynthesises.find(Input)
46 def sort(Closure Input) {
47 speechSynthesises.sort(Input)
49 def collect(Closure Input) {
50 speechSynthesises.collect(Input)
53 def setLevel(int level) {
54 if (level != this.level) {
56 speechSynthesises[0].setLevel(level)
60 def speak(String message) {
61 speechSynthesises[0].speak(message)
62 // As a conflict variable