• Showing Page History #99359

Show page source of ControllerClientEnhancement #88828

= Controller Client enhancement by NVDAJP =

Download nvdajp-client-130223.zip
  * http://en.sourceforge.jp/ticket/download.php?group_id=4221&tid=29342&file_id=4890

== isSpeakng ==

if speech engine is speaking, nvdaController_isSpeaking() returns True.

{{{
# coding: utf-8
import time
import ctypes
DLLPATH = '../newclient/nvdaHelper/build/x86/client/nvdaControllerClient32.dll'
clientLib=ctypes.windll.LoadLibrary(DLLPATH)
res=clientLib.nvdaController_testIfRunning()
if res!=0:
	errorMessage=str(ctypes.WinError(res))
	ctypes.windll.user32.MessageBoxW(0,u"Error: %s"%errorMessage,u"Error communicating with NVDA",0)
	exit(1)
clientLib.nvdaController_speakText(
u"This is test case.\n \
The case nvdaController_isSpeaking beep out when speaking with nvda! \
")
while True:
	time.sleep(0.5)
	ctypes.windll.user32.MessageBeep(0)
	if not clientLib.nvdaController_isSpeaking():
		break
ctypes.windll.user32.MessageBeep(1)
clientLib.nvdaController_cancelSpeech()
clientLib.nvdaController_speakText(u"Finished!")
}}}

== getPitch, setPitch ==

Pitch can be manipulated by nvdaController_getPitch() and nvdaController_setPitch() methods.

{{{
# coding: utf-8
import time
import ctypes
DLLPATH = '../newclient/nvdaHelper/build/x86/client/nvdaControllerClient32.dll'
clientLib=ctypes.windll.LoadLibrary(DLLPATH)
res=clientLib.nvdaController_testIfRunning()
if res!=0:
	errorMessage=str(ctypes.WinError(res))
	ctypes.windll.user32.MessageBoxW(0,u"Error: %s"%errorMessage,u"Error communicating with NVDA",0)
	exit(1)
oldPitch = clientLib.nvdaController_getPitch()
clientLib.nvdaController_speakText("current pitch is %s . now changes pitch"%oldPitch)
time.sleep(5)
clientLib.nvdaController_setPitch(oldPitch-50)
newPitch = clientLib.nvdaController_getPitch()
clientLib.nvdaController_speakText("pitch changed to %s"%newPitch)
time.sleep(5)
clientLib.nvdaController_setPitch(oldPitch+50)
newPitch = clientLib.nvdaController_getPitch()
clientLib.nvdaController_speakText("pitch changed to %s"%newPitch)
time.sleep(5)
clientLib.nvdaController_setPitch(oldPitch)
clientLib.nvdaController_speakText("pitch reverted to %s"%oldPitch)
}}}

== getRate, setRate ==

Rate (speed) can be manipulated by nvdaController_getRate() and nvdaController_setRate() methods.

{{{
# coding: utf-8
import time
import ctypes
DLLPATH = '../newclient/nvdaHelper/build/x86/client/nvdaControllerClient32.dll'
clientLib=ctypes.windll.LoadLibrary(DLLPATH)
res=clientLib.nvdaController_testIfRunning()
if res!=0:
	errorMessage=str(ctypes.WinError(res))
	ctypes.windll.user32.MessageBoxW(0,u"Error: %s"%errorMessage,u"Error communicating with NVDA",0)
	exit(1)
oldRate = clientLib.nvdaController_getRate()
clientLib.nvdaController_speakText("Rate is  %s . now changes"%oldRate)
time.sleep(5)
clientLib.nvdaController_setRate(oldRate-50)
newRate = clientLib.nvdaController_getRate()
clientLib.nvdaController_speakText("Rate changed to %s"%newRate)
time.sleep(5)
clientLib.nvdaController_setRate(oldRate+50)
newRate = clientLib.nvdaController_getRate()
clientLib.nvdaController_speakText("Rate changed to %s"%newRate)
time.sleep(5)
clientLib.nvdaController_setRate(oldRate)
clientLib.nvdaController_speakText("Rate reverted to %s"%oldRate)
}}}

== speakSpelling ==

Text can be announced using character descriptions via nvdaController_speakSpelling() method.

{{{
import time
import ctypes
DLLPATH = '../newClient/nvdaHelper/build/x86/client/nvdaControllerClient32.dll'
clientLib=ctypes.windll.LoadLibrary(DLLPATH)
res=clientLib.nvdaController_testIfRunning()
if res!=0:
	errorMessage=str(ctypes.WinError(res))
	ctypes.windll.user32.MessageBoxW(0,u"Error: %s"%errorMessage,u"Error communicating with NVDA",0)
for count in xrange(4):
	clientLib.nvdaController_speakSpelling(u"カタカナ ひらがな")
	time.sleep(5)
}}}