Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Speak.activity/voice.py
diff options
context:
space:
mode:
Diffstat (limited to 'Speak.activity/voice.py')
-rw-r--r--Speak.activity/voice.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Speak.activity/voice.py b/Speak.activity/voice.py
index fd58b5e..6cc6f9c 100644
--- a/Speak.activity/voice.py
+++ b/Speak.activity/voice.py
@@ -69,7 +69,7 @@ expectedVoiceNames = [
]
_allVoices = {}
-DEFAULT = None
+_defaultVoice = None
class Voice:
def __init__(self, language, name):
@@ -94,10 +94,15 @@ def allVoices():
return _allVoices
-def _defaultVoice():
+def defaultVoice():
"""Try to figure out the default voice, from the current locale ($LANG).
Fall back to espeak's voice called Default."""
+ global _defaultVoice
+
+ if _defaultVoice:
+ return _defaultVoice
+
voices = allVoices()
def fit(a,b):
@@ -122,6 +127,5 @@ def _defaultVoice():
best = voice
print "Best voice for LANG %s seems to be %s %s" % (lang, best.language, best.friendlyname)
+ _defaultVoice = best
return best
-
-DEFAULT = _defaultVoice()