Documents (NVDA 2013.2jp ドキュメント点訳版) | 2013-11-07 22:38 |
nvdajp_addons (opwbe-addon-120718) | 2012-07-18 18:31 |
nvdajp_jtalk_addon (nvdajp-jtalk-130521) | 2013-05-21 17:56 |
nvdajp_kgs_addon (nvdajp-kgs-130521) | 2013-05-21 17:45 |
Download nvdajp-client-140119a.zip
Download nvdajp-client-130223.zip
nvdaController_isSpeaking() returns 32bit integer value.
It returns non-zero value if speech engine is speaking.
# 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!")
Pitch can be manipulated by nvdaController_getPitch() and nvdaController_setPitch() methods.
nvdaController_getPitch() returns 32bit integer. It returns the pitch level.
nvdaController_setPitch() returns 32bit integer. It returns zero if the operation is success. It takes an argument of 32bit integer, which is the pitch level.
# 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)
Rate (speed) can be manipulated by nvdaController_getRate() and nvdaController_setRate() methods.
nvdaController_getRate() returns 32bit integer. It returns the rate value.
nvdaController_setRate() returns 32bit integer. It returns zero if the operation is success. It takes an argument of 32bit integer, which is the rate value.
# 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)
Text can be announced using character descriptions via nvdaController_speakSpelling() method.
nvdaController_speakSpelling() returns 32bit integer. It returns zero if the operation is success. It takes an argument of wchar pointer, which is the Unicode string.
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)
The method nvdaController_setAppSleepMode was introduced since 2014.1jp (requires nvdajp-client-140119a.zip). It controls whether NVDA should sleep or not when the application is activated.
nvdaController_setAppSleepMode() returns 32bit integer. It returns zero if the operation is success. It takes an argument of 32bit integer, which should be 1 if enabling sleep mode, or 0 if disabling sleep mode.
# coding: utf-8 from __future__ import unicode_literals import time from ctypes import * import wx DLLPATH = r'..\client\nvdaControllerClient32.dll' clientLib = windll.LoadLibrary(DLLPATH) def nvdaRunning(): if clientLib: res = clientLib.nvdaController_testIfRunning() if res == 0: return True return False class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, title="TestApp", size=(300,200)) self.tc = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE) self.tc.Value = "hello\nline2\nline3\n" self.menubar = wx.MenuBar() self.fileMenu = wx.Menu() self.speakItem = self.fileMenu.Append(-1, '&Speak') self.Bind(wx.EVT_MENU, self.OnSpeak, self.speakItem) self.sleepItem = self.fileMenu.Append(-1, 'Sleep O&n') self.Bind(wx.EVT_MENU, self.OnSleep, self.sleepItem) self.wakeupItem = self.fileMenu.Append(-1, 'Sleep O&ff') self.Bind(wx.EVT_MENU, self.OnWakeup, self.wakeupItem) self.quitItem = self.fileMenu.Append(-1, '&Quit') self.Bind(wx.EVT_MENU, self.OnQuit, self.quitItem) self.menubar.Append(self.fileMenu, '&File') self.SetMenuBar(self.menubar) self.Centre() self.Show(True) def OnSpeak(self, event): if nvdaRunning(): res = clientLib.nvdaController_speakText(self.tc.Value) def OnSleep(self, event): if nvdaRunning(): res = clientLib.nvdaController_setAppSleepMode(1) print "setAppSleepMode(1):%d" % res def OnWakeup(self, event): if nvdaRunning(): res = clientLib.nvdaController_setAppSleepMode(0) print "setAppSleepMode(0):%d" % res def OnQuit(self, event): self.Close() app = wx.App(False) frame = MyFrame() frame.Show() app.MainLoop()