#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Tue, 10 Dec 2019 13:36:48 +0100
changeset 25092 8d863897143f
parent 25091 b18f5cd8e7e6
child 25093 84880a517d07
#FEATURE by cg class: AbstractOperatingSystem class comment/format in: #voiceCommandSpec changed: #speak:voiceName:
AbstractOperatingSystem.st
--- a/AbstractOperatingSystem.st	Mon Dec 09 22:38:23 2019 +0100
+++ b/AbstractOperatingSystem.st	Tue Dec 10 13:36:48 2019 +0100
@@ -7062,7 +7062,7 @@
      and call that external program for the speech generation.
      Returns true if ok, false if not"
 
-    |mapping voiceUsed stringArg|
+    |mapping voiceUsed|
 
     (voiceName isNil or:[voiceName = 'default']) ifTrue:[
         voiceUsed := DefaultVoice
@@ -7072,17 +7072,26 @@
     mapping := self voiceMapping detect:[:v | v key = voiceUsed] ifNone:[(voiceName -> voiceName)].
     voiceUsed := mapping value.
 
-    self voiceCommandSpec triplesDo:[:cmd :cmdLineForDefaultVoice :cmdLineForVoice |
-        |cmdLine|
-        
+    self voiceCommandSpec do:[:entry |
+        |cmd cmdLineForDefaultVoice cmdLineForVoice cmdLineForSsmlVoice cmdLine stringArg|
+
+        cmd := entry at:1.
         (self canExecuteCommand:cmd) ifTrue:[
-            (voiceUsed isNil or:[voiceUsed = 'default']) ifTrue:[
-                cmdLine := cmdLineForDefaultVoice
-            ] ifFalse:[    
-                cmdLine := cmdLineForVoice
+            cmdLineForDefaultVoice := entry at:2.
+            cmdLineForVoice := entry at:3.
+            cmdLineForSsmlVoice := entry at:4 ifAbsent:nil.
+            (aString startsWith:'<speak') ifTrue:[
+                cmdLine := cmdLineForSsmlVoice bindWith:voiceUsed with:aString.
+            ] ifFalse:[
+                (voiceUsed isNil or:[voiceUsed = 'default']) ifTrue:[
+                    cmdLine := cmdLineForDefaultVoice
+                ] ifFalse:[    
+                    cmdLine := cmdLineForVoice
+                ].  
+                stringArg := aString copyReplaceAll:(Character nl) withAll:'\n'.
+                cmdLine := cmdLine bindWith:voiceUsed with:stringArg.
             ].  
-            stringArg := aString copyReplaceAll:(Character nl) withAll:'\n'.
-            ^ self executeCommand:(cmdLine bindWith:voiceUsed with:stringArg).
+            ^ self executeCommand:cmdLine.
         ].    
     ].
     
@@ -7140,6 +7149,7 @@
         "/      -command 
         "/      -commandline for default voice
         "/      -commandline for specific voice
+        "/      -commandline for ssml voice
     )    
 !