def __init__(self):
        super(SynthDriver, self).__init__()
        self._dll = NVDAHelper.getHelperLocalWin10Dll()
        self._dll.ocSpeech_getCurrentVoiceLanguage.restype = ctypes.c_wchar_p
        # Set initial values for parameters that can't be queried when prosody is not supported.
        # This initialises our cache for the value.
        # When prosody is supported, the values are used for cachign reasons.
        self._rate = 50
        self._pitch = 50
        self._volume = 100

        if self.supportsProsodyOptions:
            self._dll.ocSpeech_getPitch.restype = ctypes.c_double
            self._dll.ocSpeech_getVolume.restype = ctypes.c_double
            self._dll.ocSpeech_getRate.restype = ctypes.c_double
        else:
            log.debugWarning("Prosody options not supported")
        self._handle = self._dll.ocSpeech_initialize()
        self._callbackInst = ocSpeech_Callback(self._callback)
        self._dll.ocSpeech_setCallback(self._handle, self._callbackInst)
        self._dll.ocSpeech_getVoices.restype = NVDAHelper.bstrReturn
        self._dll.ocSpeech_getCurrentVoiceId.restype = ctypes.c_wchar_p
        self._player = None
        # Initialize state.
        self._queuedSpeech = []
        self._wasCancelled = False
        self._isProcessing = False
        # Initialize the voice to a sane default
        self.voice = self._getDefaultVoice()
Beispiel #2
0
    def __init__(self):
        super().__init__()
        self._dll = NVDAHelper.getHelperLocalWin10Dll()
        self._dll.ocSpeech_getCurrentVoiceLanguage.restype = ctypes.c_wchar_p
        # Set initial values for parameters that can't be queried when prosody is not supported.
        # This initialises our cache for the value.
        # When prosody is supported, the values are used for cachign reasons.
        self._rate = 50
        self._pitch = 50
        self._volume = 100

        if self.supportsProsodyOptions:
            self._dll.ocSpeech_getPitch.restype = ctypes.c_double
            self._dll.ocSpeech_getVolume.restype = ctypes.c_double
            self._dll.ocSpeech_getRate.restype = ctypes.c_double
        else:
            log.debugWarning("Prosody options not supported")

        self._earlyExitCB = False
        self._callbackInst = ocSpeech_Callback(self._callback)
        self._ocSpeechToken: Optional[
            ctypes.POINTER] = self._dll.ocSpeech_initialize(self._callbackInst)
        self._dll.ocSpeech_getVoices.restype = NVDAHelper.bstrReturn
        self._dll.ocSpeech_getCurrentVoiceId.restype = ctypes.c_wchar_p
        self._player = None
        # Initialize state.
        self._queuedSpeech: List[Union[str,
                                       Tuple[Callable[[ctypes.POINTER, float],
                                                      None], float]]] = []

        self._wasCancelled = False
        self._isProcessing = False
        # Initialize the voice to a sane default
        self.voice = self._getDefaultVoice()
        self._consecutiveSpeechFailures = 0
Beispiel #3
0
	def __init__(self):
		super(SynthDriver, self).__init__()
		self._dll = NVDAHelper.getHelperLocalWin10Dll()
		self._dll.ocSpeech_getCurrentVoiceLanguage.restype = ctypes.c_wchar_p
		# Set initial values for parameters that can't be queried when prosody is not supported.
		# This initialises our cache for the value.
		# When prosody is supported, the values are used for cachign reasons.
		self._rate = 50
		self._pitch = 50
		self._volume = 100

		if self.supportsProsodyOptions:
			self._dll.ocSpeech_getPitch.restype = ctypes.c_double
			self._dll.ocSpeech_getVolume.restype = ctypes.c_double
			self._dll.ocSpeech_getRate.restype = ctypes.c_double
		else:
			log.debugWarning("Prosody options not supported")
		self._handle = self._dll.ocSpeech_initialize()
		self._callbackInst = ocSpeech_Callback(self._callback)
		self._dll.ocSpeech_setCallback(self._handle, self._callbackInst)
		self._dll.ocSpeech_getVoices.restype = NVDAHelper.bstrReturn
		self._dll.ocSpeech_getCurrentVoiceId.restype = ctypes.c_wchar_p
		self._player= None
		# Initialize state.
		self._queuedSpeech = []
		self._wasCancelled = False
		self._isProcessing = False
		# Initialize the voice to a sane default
		self.voice=self._getDefaultVoice()
Beispiel #4
0
    def __init__(self, language=None):
        """
		@param language: The language code of the desired recognition language,
			C{None} to use the user's configured language.
		"""
        if language:
            self.language = language
        else:
            self.language = getConfigLanguage()
        self._dll = NVDAHelper.getHelperLocalWin10Dll()
Beispiel #5
0
	def __init__(self, language=None):
		"""
		@param language: The language code of the desired recognition language,
			C{None} to use the user's configured language.
		"""
		if language:
			self.language = language
		else:
			self.language = getConfigLanguage()
		self._dll = NVDAHelper.getHelperLocalWin10Dll()
Beispiel #6
0
def getLanguages():
    """Return the available recognition languages.
	@return: A list of language codes suitable to be passed to L{UwpOcr}'s constructor.
		These need to be normalized with L{languageHandler.normalizeLanguage}
		for use as NVDA language codes.
	@rtype: list of str
	"""
    dll = NVDAHelper.getHelperLocalWin10Dll()
    dll.uwpOcr_getLanguages.restype = NVDAHelper.bstrReturn
    langs = dll.uwpOcr_getLanguages()
    return langs.split(";")[:-1]
Beispiel #7
0
def getLanguages():
	"""Return the available recognition languages.
	@return: A list of language codes suitable to be passed to L{UwpOcr}'s constructor.
		These need to be normalized with L{languageHandler.normalizeLanguage}
		for use as NVDA language codes.
	@rtype: list of unicode
	"""
	dll = NVDAHelper.getHelperLocalWin10Dll()
	dll.uwpOcr_getLanguages.restype = NVDAHelper.bstrReturn
	langs = dll.uwpOcr_getLanguages()
	return langs.split(";")[:-1]
Beispiel #8
0
	def __init__(self):
		super(SynthDriver, self).__init__()
		self._dll = NVDAHelper.getHelperLocalWin10Dll()
		self._dll.ocSpeech_getCurrentVoiceLanguage.restype = ctypes.c_wchar_p
		self._handle = self._dll.ocSpeech_initialize()
		self._callbackInst = ocSpeech_Callback(self._callback)
		self._dll.ocSpeech_setCallback(self._handle, self._callbackInst)
		self._dll.ocSpeech_getVoices.restype = NVDAHelper.bstrReturn
		self._dll.ocSpeech_getCurrentVoiceId.restype = ctypes.c_wchar_p
		self._player = nvwave.WavePlayer(1, SAMPLES_PER_SEC, BITS_PER_SAMPLE, outputDevice=config.conf["speech"]["outputDevice"])
		# Initialize state.
		self._queuedSpeech = []
		self._wasCancelled = False
		self._isProcessing = False
		# Set initial values for parameters that can't be queried.
		# This initialises our cache for the value.
		self.rate = 50
		self.pitch = 50
		self.volume = 100
Beispiel #9
0
	def __init__(self):
		super(SynthDriver, self).__init__()
		self._dll = NVDAHelper.getHelperLocalWin10Dll()
		self._dll.ocSpeech_getCurrentVoiceLanguage.restype = ctypes.c_wchar_p
		self._handle = self._dll.ocSpeech_initialize()
		self._callbackInst = ocSpeech_Callback(self._callback)
		self._dll.ocSpeech_setCallback(self._handle, self._callbackInst)
		self._dll.ocSpeech_getVoices.restype = NVDAHelper.bstrReturn
		self._dll.ocSpeech_getCurrentVoiceId.restype = ctypes.c_wchar_p
		self._player= None
		# Initialize state.
		self._queuedSpeech = []
		self._wasCancelled = False
		self._isProcessing = False
		# Initialize the voice to a sane default
		self.voice=self._getDefaultVoice()
		# Set initial values for parameters that can't be queried.
		# This initialises our cache for the value.
		self.rate = 50
		self.pitch = 50
		self.volume = 100
Beispiel #10
0
	def __init__(self):
		super(SynthDriver, self).__init__()
		self._dll = NVDAHelper.getHelperLocalWin10Dll()
		self._dll.ocSpeech_getCurrentVoiceLanguage.restype = ctypes.c_wchar_p
		self._handle = self._dll.ocSpeech_initialize()
		self._callbackInst = ocSpeech_Callback(self._callback)
		self._dll.ocSpeech_setCallback(self._handle, self._callbackInst)
		self._dll.ocSpeech_getVoices.restype = NVDAHelper.bstrReturn
		self._dll.ocSpeech_getCurrentVoiceId.restype = ctypes.c_wchar_p
		self._player= None
		# Initialize state.
		self._queuedSpeech = []
		self._wasCancelled = False
		self._isProcessing = False
		# Initialize the voice to a sane default
		self.voice=self._getDefaultVoice()
		# Set initial values for parameters that can't be queried.
		# This initialises our cache for the value.
		self.rate = 50
		self.pitch = 50
		self.volume = 100
Beispiel #11
0
 def __init__(self):
     super(SynthDriver, self).__init__()
     self._dll = NVDAHelper.getHelperLocalWin10Dll()
     self._dll.ocSpeech_getCurrentVoiceLanguage.restype = ctypes.c_wchar_p
     self._handle = self._dll.ocSpeech_initialize()
     self._callbackInst = ocSpeech_Callback(self._callback)
     self._dll.ocSpeech_setCallback(self._handle, self._callbackInst)
     self._dll.ocSpeech_getVoices.restype = NVDAHelper.bstrReturn
     self._dll.ocSpeech_getCurrentVoiceId.restype = ctypes.c_wchar_p
     self._player = nvwave.WavePlayer(
         1,
         SAMPLES_PER_SEC,
         BITS_PER_SAMPLE,
         outputDevice=config.conf["speech"]["outputDevice"])
     # Initialize state.
     self._queuedSpeech = []
     self._wasCancelled = False
     self._isProcessing = False
     # Set initial values for parameters that can't be queried.
     # This initialises our cache for the value.
     self.rate = 50
     self.pitch = 50
     self.volume = 100