# HG changeset patch # User Claus Gittinger # Date 1581627958 -3600 # Node ID 04f5f5a5e6e62f1a0e5c22493c19f11df9fbd970 # Parent cad9ab22bee760b0969d4e01ee8138ccc0e8fe3c #FEATURE by cg class: AbstractOperatingSystem class added: #defaultVoiceMapping comment/format in: #speak:voiceName: #voiceInfo changed: #voiceMapping diff -r cad9ab22bee7 -r 04f5f5a5e6e6 AbstractOperatingSystem.st --- a/AbstractOperatingSystem.st Thu Feb 13 22:05:39 2020 +0100 +++ b/AbstractOperatingSystem.st Thu Feb 13 22:05:58 2020 +0100 @@ -7037,6 +7037,34 @@ "Created: / 23-07-2019 / 10:17:07 / Claus Gittinger" ! +defaultVoiceMapping + "return a mapping from common (OS-independent) voice names + to OS-specific names or IDs. + The speak:voiceName interface will recognize both. + For portable programs, always use the OS-independent name and + let every OS xlate to its internal name." + + "The mapping here maps all common names to the default" + + ^ { + ( 'male' -> nil ) . + ( 'female' -> nil ) . + ( 'computer' -> nil ) . + ( 'default' -> nil ) + } + + "on OSX, this could be: + ^ { + 'male' -> 'Alex' . + 'female' -> 'Fiona' . + 'computer' -> 'Zarvox' . + 'default' -> 'Fiona' + } + " + + "Modified (comment): / 29-08-2018 / 09:42:40 / Claus Gittinger" +! + initializeDefaultVoice "OS specific default voice setup" @@ -7141,6 +7169,10 @@ OperatingSystem speak:'hello world - this is a female voice' voiceName:'female' OperatingSystem speak:'hello world - this is a computer voice' voiceName:'computer' + non-portable (Windows only): + OperatingSystem speak:'hello world - this is a british female voice' voiceName:'Microsoft Zira Desktop' + OperatingSystem speak:'hello world - this is a german female voice' voiceName:'Microsoft Hedda Desktop' + non-portable (OSX only): OperatingSystem speak:'hello world - this is a scottish female voice' voiceName:'Fiona' OperatingSystem speak:'hello world - this is an irish female voice' voiceName:'Moira' @@ -7158,11 +7190,11 @@ Diaresis: OperatingSystem speak:'üben Österreich ärgerlich' voiceName:'Anna' - OperatingSystem speak:'español' voiceName:'Anna' - anna cannot speak spanish!! - OperatingSystem speak:'español' voiceName:'Fiona' - fiona neither!! + OperatingSystem speak:'español' voiceName:'Anna' - anna cannot speak spanish!! + OperatingSystem speak:'español' voiceName:'Fiona' - fiona neither!! OperatingSystem speak:'español' voiceName:'Diego' OperatingSystem speak:'español' voiceName:'Paulina' - OperatingSystem speak:'日本語' voiceName:'Kyoko' - yes, she can say 'Nihongo' + OperatingSystem speak:'日本語' voiceName:'Kyoko' - yes, she can say 'Nihongo' DefaultVoice := 'Fiona' DefaultVoice := 'Miora' @@ -7212,11 +7244,23 @@ #('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.') ) + + On Windows: + #( + ('default' 'en_US' 'the default system voice') + + #('Microsoft Zira Desktop' 'en_US' 'Isn''t it nice to have a computer that will talk to you?') + #('Microsoft Hedda Desktop' 'de_de' 'Danke, daß Sie mir zuhören') + ) " ^ #( ('default' 'en_US' 'the default system voice') ) + + " + OperatingSystem voiceInfo + " ! voiceMapping @@ -7229,21 +7273,7 @@ "The mapping here maps all common names to the default" VoiceMapping notNil ifTrue:[^ VoiceMapping]. - ^ { - ( 'male' -> nil ) . - ( 'female' -> nil ) . - ( 'computer' -> nil ) . - ( 'default' -> nil ) - } - - "on OSX, this could be: - ^ { - 'male' -> 'Alex' . - 'female' -> 'Fiona' . - 'computer' -> 'Zarvox' . - 'default' -> 'Fiona' - } - " + ^ self defaultVoiceMapping "Modified (comment): / 29-08-2018 / 09:42:40 / Claus Gittinger" !