Esempio n. 1
0
def changeVoice(synth, voice):
	# This function can be called with no voice if the synth doesn't support the voice setting (only has one voice).
	if voice:
		synth.voice = voice
	c=config.conf["speech"][synth.name]
	#start or update the synthSettingsRing
	if globalVars.settingsRing: globalVars.settingsRing.updateSupportedSettings(synth)
	else:  globalVars.settingsRing = SynthSettingsRing(synth)
	speechDictHandler.loadVoiceDict(synth)
def changeVoice(synth, voice):
	synth.voice = voice
	c=config.conf["speech"][synth.name]
	c.configspec=synth.getConfigSpec()
	config.conf.validate(config.val, copy = True,section = c)
	#start or update the synthSettingsRing
	if globalVars.settingsRing: globalVars.settingsRing.updateSupportedSettings(synth)
	else:  globalVars.settingsRing = SynthSettingsRing(synth)
	speechDictHandler.loadVoiceDict(synth)
Esempio n. 3
0
def changeVoice(synth, voice):
	# This function can be called with no voice if the synth doesn't support the voice setting (only has one voice).
	if voice:
		synth.voice = voice
	c=config.conf["speech"][synth.name]
	#start or update the synthSettingsRing
	if globalVars.settingsRing: globalVars.settingsRing.updateSupportedSettings(synth)
	else:  globalVars.settingsRing = SynthSettingsRing(synth)
	speechDictHandler.loadVoiceDict(synth)
def setSynth(name):
	global _curSynth
	if name is None: 
		_curSynth.terminate()
		_curSynth=None
		return True
	if name=='auto':
		name='espeak'
	if _curSynth:
		_curSynth.cancel()
		_curSynth.terminate()
		prevSynthName = _curSynth.name
		_curSynth = None
	else:
		prevSynthName = None
	try:
		newSynth=_getSynthDriver(name)()
		updatedConfig=config.updateSynthConfig(newSynth)
		if not updatedConfig:
			newSynth.loadSettings()
		else:
			if newSynth.isSupported("voice"):
				#We need to call changeVoice here so voice dictionaries can be managed
				changeVoice(newSynth,newSynth.voice)
			newSynth.saveSettings() #save defaults
		_curSynth=newSynth
		#start or update the synthSettingsRing (for those synths which do not support 'voice')
		if not newSynth.isSupported('voice'):
			if globalVars.settingsRing: globalVars.settingsRing.updateSupportedSettings(newSynth)
			else:  globalVars.settingsRing = SynthSettingsRing(newSynth)
			speechDictHandler.loadVoiceDict(newSynth)
		config.conf["speech"]["synth"]=name
		log.info("Loaded synthDriver %s"%name)
		return True
	except:
		log.error("setSynth", exc_info=True)
		if prevSynthName:
			setSynth(prevSynthName)
		elif name not in ('espeak','silence'):
			setSynth('espeak')
		elif name=='espeak':
			setSynth('silence')
		return False