Adding conflict variable in SpeechSynthesis device.
authorrtrimana <rtrimana@uci.edu>
Tue, 6 Aug 2019 22:33:26 +0000 (15:33 -0700)
committerrtrimana <rtrimana@uci.edu>
Tue, 6 Aug 2019 22:33:26 +0000 (15:33 -0700)
SpeechSynthesis/SpeechSynthesis.groovy
SpeechSynthesis/SpeechSynthesises.groovy

index acc2d80545cee93895eeb840085192cddb4da16c..fb91378307726a2a98bc8fb5e433aa5d2796ba4e 100644 (file)
@@ -7,13 +7,15 @@ public class SpeechSynthesis {
        private String label
        private String displayName
        private int level
+       private boolean oneUser
 
 
-       SpeechSynthesis(String id, String label, String displayName, int level) {
+       SpeechSynthesis(String id, String label, String displayName, int level, boolean oneUser) {
                this.id = id
                this.label = label
                this.displayName = displayName
                this.level = level
+               this.oneUser = oneUser
        }
 
        def setLevel(int level) {
@@ -25,5 +27,11 @@ public class SpeechSynthesis {
 
        def speak(String message) {
                println("Speech synthesis with id:$id, SPEAKING:\"$message\"!")
+               // As a conflict variable
+               if (oneUser) {
+                       oneUser = false
+               } else {
+                       oneUser = true
+               }
        }
 }
index 50417cc8615a278a5bb8fce4f87ce69122c29b9b..69601c48d37019a82048cd8f82c8f7e6cca3de17 100644 (file)
@@ -12,6 +12,7 @@ public class SpeechSynthesises {
        private String label = "speechSynthesis0"
        private String displayName = "speechSynthesis0"
        private int level = 50
+       private boolean oneUser = true
 
                
        SpeechSynthesises(Closure sendEvent, int deviceNumbers, boolean init) {
@@ -21,10 +22,12 @@ public class SpeechSynthesises {
 
                if (init) {
                        this.level = 50
+                       this.oneUser = true
                } else {
                        this.level = 60
+                       this.oneUser = false
                }
-               speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level))
+               speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level, this.oneUser))
        }
 
        //Methods for closures
@@ -56,6 +59,12 @@ public class SpeechSynthesises {
 
        def speak(String message) {
                speechSynthesises[0].speak(message)
+               // As a conflict variable
+               if (oneUser) {
+                       oneUser = false
+               } else {
+                       oneUser = true
+               }
        }
 
        def getAt(int ix) {