#FEATURE by cg
class: AbstractOperatingSystem class
added:
#speak:voiceName:
#voiceInfo
changed: #speak:
--- a/AbstractOperatingSystem.st Sat May 19 14:04:51 2018 +0200
+++ b/AbstractOperatingSystem.st Sun May 20 09:20:23 2018 +0200
@@ -1140,7 +1140,6 @@
"Created: / 12.11.1998 / 14:39:20 / cg"
! !
-
!AbstractOperatingSystem class methodsFor:'executing OS commands-public'!
executeCommand:aCommandString
@@ -6596,9 +6595,44 @@
!
speak:aString
+ "say something in the default voice"
+
+ self speak:aString voiceName:nil.
+!
+
+speak:aString voiceName:aVoiceName
+ "voiceName should be in the list of supported voices as returned by
+ voiceInfo.
+ Use nil for the default (or only available) voice.
+ Usually, this is the user's preference voice setting."
+
"unsupported - simply stay silent"
^ self.
+!
+
+voiceInfo
+ "return a list of available voices plus info.
+ For each available voice, a triple is returned, containing:
+ voiceName language_territory comment/description
+
+ the fallback here returns an empty list, meaning that no voice
+ can be chosen. However, it may still be the case that a default voice
+ is present.
+
+ on OSX, this would look like:
+ #(
+ #('Agnes' 'en_US' 'Isn''t it nice to have a computer that will talk to you?')
+ #('Albert' 'en_US' 'I have a frog in my throat. No, I mean a real frog!!')
+ #('Alex' 'en_US' 'Most people recognize me by my voice.')
+ ...
+ #('Zarvox' 'en_US' 'That looks like a peaceful planet.')
+ #('Zosia' 'pl_PL' 'Witaj. Mam na imię Zosia, jestem głosem kobiecym dla języka polskiego.')
+ #('Zuzana' 'cs_CZ' 'Dobrý den, jmenuji se Zuzana. Jsem český hlas.')
+ )
+ "
+
+ ^ #()
! !
!AbstractOperatingSystem class methodsFor:'time and date'!