Skip to content

NVDA driver compatibility with NVDA 2025.1 and older - #917

Merged
Olga-Yakovleva merged 3 commits into
RHVoice:masterfrom
zstanecic:nvda-2025.1compat
Mar 8, 2025
Merged

Olga-Yakovleva merged 3 commits into
RHVoice:masterfrom
zstanecic:nvda-2025.1compat

Conversation

@zstanecic

Copy link
Copy Markdown
Contributor

context

In the future NVDA 2025.1, audio devices in the NVDA user configuration will be stored as endpoint Ids instead of friendly names.

development strategy:

Changed the audio device lookup and selection strategy. We are trying two approaches: one from the old stable NVDA, and one which will be introduced in 2025.1
So, in the synth driver, we are using the following statements:
try:
player = nvwave.WavePlayer(channels=1, samplesPerSec=self.__sample_rate, bitsPerSample=16, outputDevice=config.conf["speech"]["outputDevice"])
except:
player = nvwave.WavePlayer(channels=1, samplesPerSec=self.__sample_rate, bitsPerSample=16, outputDevice=config.conf["audio"]["outputDevice"])
So, from now on, the new key for the ouptput device is not located in speech, but in audio, and I am maintaining the backwards compatibility, as seen in the above try/except block.

testing strategy:

This fix was tested on the current stable NVDA version, 2024.1.0, as well as on the latest alpha version, from which the NVDA 2025.1 release is developing
nvaccess/nvda#17547

…stable versions of NVDA.

From now, NVDA uses audio endpoints to store the audio device names. The compatibllity with previous NVDA versions is maintained.
@beqabeqa473

Copy link
Copy Markdown
Contributor

instead of try except make condition for buildVersion and set corresponding config section.

@zstanecic

Copy link
Copy Markdown
Contributor Author

Thank you @beqabeqa473
I thought about how to do it in a more aesthetic way, but honestly the try except method was the first thing which came to my mind first.
Thank you for your advice. I will try it and go with the review action very soon.

@zstanecic

zstanecic commented Jan 7, 2025 •

Copy link
Copy Markdown
Contributor Author

Okay, done, and testd if it works. I have tested it on stable NVDA versions, as well as the versions in development.
I made the condition against buildVersion.version_year.
So, anything less than 2025 will use the old key, and newer wersions will use the new key.
Any objections @beqabeqa473 or is this okay?

@beqabeqa473

Copy link
Copy Markdown
Contributor

Yes, there is code repetition in creating nvwave player, make one field of config section like config.conf["audio"] and then in condition reassign it to config.conf["speech"]
after that, create nvwave once and in output use config section from field

@beqabeqa473 beqabeqa473 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In SynthDriver class just before self.__player add line
self.outputDeviceSection = config.conf["speech"] if buildVersion.version_year < 2025 else config.conf["audio"]

in AudioPlayer class, where you made changes, remove them and add
player = nvwave.WavePlayer(channels=1, samplesPerSec=self.__sample_rate, bitsPerSample=16, outputDevice=self.synth.outputDeviceSection["outputDevice"])

Please test changes before committing as i might have some typoes because i am writing from phone.

@zstanecic

Copy link
Copy Markdown
Contributor Author

Okay. Resolved, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants