Skip to content

Commit

Permalink
Version 25.1.1
Browse files Browse the repository at this point in the history
* Added support for NVDA 2025.1.
* Now the driver looks for the audio output in two config paths.
* Deleted the audio output change handler. This was created because in some cases the driver was not synchronized with the current audio output, it needs more testing but seems that this doesn't happen in wasapi mode.
* Git repo: added a better support for vscode. Update the path with the NVDA files if needed.
  • Loading branch information
davidacm committed Jan 30, 2025
1 parent 061fbfd commit 925c3d6
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ on:
push:
tags:
['*']
pull_request:
branches: [ main, master ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- run: echo -e "scons\nmarkdown">requirements.txt
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'
Expand Down Expand Up @@ -43,7 +44,7 @@ jobs:
run: awk '/^# / && !flag {flag=1; next} /^# / && flag {exit} flag && NF' changelog.md > newChanges.md
- name: Calculate sha256
run: sha256sum *.nvda-addon >> newChanges.md
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: packaged_addon
path: |
Expand All @@ -56,12 +57,12 @@ jobs:
needs: ["build"]
steps:
- name: download releases files
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
body_path: packaged_addon/newChanges.md
files: packaged_addon/*.nvda-addon
Expand Down
6 changes: 6 additions & 0 deletions .vscode/typings/__builtins__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def _(msg: str) -> str:
...


def pgettext(context: str, message: str) -> str:
...
36 changes: 9 additions & 27 deletions addon/synthDrivers/_ibmeci.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
import queue

import threading, time
import config, languageHandler, nvwave, addonHandler
import languageHandler, nvwave, addonHandler
from config import conf
from logHandler import log
from fileUtils import getFileVersionInfo
from ._settingsDB import appConfig, speechConfig
from ._settingsDB import appConfig

addonHandler.initTranslation()

Expand Down Expand Up @@ -297,7 +298,7 @@ def eciNew():
avLangs=(c_int*b.value)()
eci.eciGetAvailableLanguages(byref(avLangs),byref(b))
try:
handle=eci.eciNewEx(int(speechConfig.ibmtts['voice']))
handle=eci.eciNewEx(int(conf['speech']['ibmeci']['voice']))
except:
handle=eci.eciNewEx(getVoiceByLanguage(languageHandler.getLanguage())[0])
for i in ECIVoiceParam.params:
Expand Down Expand Up @@ -407,7 +408,7 @@ def initialize(indexCallback, doneCallback):
callbackQueue = queue.Queue()
callbackThread = CallbackThread()
callbackThread.start()
toggleProbileSwitchRegistration(config.post_configProfileSwitch.register)


def speak(text):
# deleted the following fix because is incompatible with NVDA's speech change command. Now send it from speak in ibmeci.py
Expand Down Expand Up @@ -450,7 +451,6 @@ def terminate():
idleTimer.cancel()
player.close()
callbackQueue= callbackThread= dll= eciQueue=eciThread= handle= idleTimer= onDoneSpeaking= onIndexReached= player = None
toggleProbileSwitchRegistration(config.post_configProfileSwitch.unregister)


def setVoice(vl):
Expand Down Expand Up @@ -547,7 +547,10 @@ def idlePlayer():

def createPlayer(sampleRate):
global currentSoundcardOutput, currentSampleRate
currentSoundcardOutput = speechConfig.outputDevice
try:
currentSoundcardOutput = conf['speech']['outputDevice']
except:
currentSoundcardOutput = conf["audio"]["outputDevice"]
currentSampleRate = sampleRate
if sampleRate == 0:
player = nvwave.WavePlayer(1, 8000, 16, outputDevice=currentSoundcardOutput)
Expand All @@ -558,24 +561,3 @@ def createPlayer(sampleRate):
else:
player = nvwave.WavePlayer(1, 11025, 16, outputDevice=currentSoundcardOutput)
return player

def handleSoundcardChange():
global currentSoundcardOutput, currentSampleRate, player
# if player is none, this driver is not active.
# This may occur because post_configProfileSwitch.unregister is delaied by 1 second.
if player and currentSoundcardOutput != speechConfig.outputDevice:
player.close()
player = createPlayer(currentSampleRate)

profileSwitchRegister = None
def toggleProbileSwitchRegistration(fn):
""" the register or unregister of the handler for config changes can't be done when a profile switch is being done.
this function helps to avoid that.
fn: the function to be called (usually register or unregister)
"""
global profileSwitchRegister
if profileSwitchRegister:
profileSwitchRegister.cancel()
profileSwitchRegister = None
profileSwitchRegister = threading.Timer(1, fn, [handleSoundcardChange])
profileSwitchRegister.start()
4 changes: 2 additions & 2 deletions buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description" : _("""This is the IBMTTS synthesizer driver for NVDA."""),
# version
"addon_version" : "23.12.1",
"addon_version" : "25.1.1",
# Author(s)
"addon_author" : u"David CM <dhf360@gmail.com>, x0 and others",
# URL for the add-on documentation support
Expand All @@ -29,7 +29,7 @@
# Minimum NVDA version supported (e.g. "2018.3.0")
"addon_minimumNVDAVersion" : "2019.3.0",
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
"addon_lastTestedNVDAVersion" : "2024.2.0",
"addon_lastTestedNVDAVersion" : "2025.1.0",
# Add-on update channel (default is stable or None)
"addon_updateChannel" : None,
# Add-on license such as GPL 2
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Version 25.1.1

* Added support for NVDA 2025.1.
* Now the driver looks for the audio output in two config paths.
* Deleted the audio output change handler. This was created because in some cases the driver was not synchronized with the current audio output, it needs more testing but seems that this doesn't happen in wasapi mode.

# Version 23.12.1

* Updated support for NVDA 2024.2.
Expand Down
40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[tool.ruff]
line-length = 110

builtins = [
# translation lookup
"_",
# translation lookup
"ngettext",
# translation lookup
"pgettext",
# translation lookup
"npgettext",
]

include = [
"*.py",
"sconstruct",
]

exclude = [
".git",
"__pycache__",
]

[tool.ruff.format]
indent-style = "tab"

[tool.ruff.lint.mccabe]
max-complexity = 15

[tool.ruff.lint]
ignore = [
# indentation contains tabs
"W191",
]

[tool.ruff.lint.per-file-ignores]
# sconstruct contains many inbuilt functions not recognised by the lint,
# so ignore F821.
"sconstruct" = ["F821"]

0 comments on commit 925c3d6

Please sign in to comment.