Repository: nvaccess/nvda

Issue:
Error sounds heard when navigating up in the synth settings ring
<!-- Please read the text in this edit field before filling it in.
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/blob/master/devDocs/githubIssueTemplateExplanationAndExamples.md
Please also note that the NVDA project has a Citizen and Contributor Code of Conduct which can be found at https://github.com/nvaccess/nvda/blob/master/CODE_OF_CONDUCT.md. NV Access expects that all contributors and other community members read and abide by the rules set out in this document while participating or contributing to this project. This includes creating or commenting on issues and pull requests. 

Each of the questions and sections below start with multiple hash symbols (#). Place your answers and information on the blank line below each question.
-->

### Steps to reproduce:
1. Switch to OneCore.
2. Navigate to the voice option with the synth settings ring, then move upwards until you reach the last voice.
### Actual behavior:
<!--
Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste here. 
Use braille viewer to copy and paste here.
You may additionally include an explanation.
-->
An error sound is heard when navigating up past the last voice. This doesn't seem to happen when navigating down.
### Expected behavior:
<!--
Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste here. 
Use braille viewer to copy and paste here.
You may additionally include an explanation.
-->
No error, last voice should be repeated like it was previously.
### NVDA logs, crash dumps and other attachments:
Log fragment: error executing script: <bound method GlobalCommands.script_increaseSynthSetting of <globalCommands.GlobalCommands object at 0x0813C710>> with gesture 'ctrl+shift+NVDA+up arrow'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 295, in executeScript
  File "globalCommands.pyc", line 292, in script_increaseSynthSetting
  File "synthSettingsRing.pyc", line 122, in increase
  File "synthSettingsRing.pyc", line 19, in increase
  File "synthSettingsRing.pyc", line 55, in _set_value
IndexError: list index out of range
### System configuration
#### NVDA installed/portable/running from source:
Installed
#### NVDA version:
alpha-27892,42dbabcc
#### Windows version:
Windows 11, build 25324.1000.
#### Name and version of other software in use when reproducing the issue:
N/A
#### Other information about your system:
N/A
### Other questions
#### Does the issue still occur after restarting your computer?
Yes.
#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Yes. This seems to have started occurring when #14704 was merged.
#### If NVDA add-ons are disabled, is your problem still occurring?
Yes.
#### Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?
Yes.
Error sounds heard when navigating up in the synth settings ring
<!-- Please read the text in this edit field before filling it in.
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/blob/master/devDocs/githubIssueTemplateExplanationAndExamples.md
Please also note that the NVDA project has a Citizen and Contributor Code of Conduct which can be found at https://github.com/nvaccess/nvda/blob/master/CODE_OF_CONDUCT.md. NV Access expects that all contributors and other community members read and abide by the rules set out in this document while participating or contributing to this project. This includes creating or commenting on issues and pull requests. 

Each of the questions and sections below start with multiple hash symbols (#). Place your answers and information on the blank line below each question.
-->

### Steps to reproduce:
1. Switch to OneCore.
2. Navigate to the voice option with the synth settings ring, then move upwards until you reach the last voice.
### Actual behavior:
<!--
Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste here. 
Use braille viewer to copy and paste here.
You may additionally include an explanation.
-->
An error sound is heard when navigating up past the last voice. This doesn't seem to happen when navigating down.
### Expected behavior:
<!--
Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste here. 
Use braille viewer to copy and paste here.
You may additionally include an explanation.
-->
No error, last voice should be repeated like it was previously.
### NVDA logs, crash dumps and other attachments:
Log fragment: error executing script: <bound method GlobalCommands.script_increaseSynthSetting of <globalCommands.GlobalCommands object at 0x0813C710>> with gesture 'ctrl+shift+NVDA+up arrow'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 295, in executeScript
  File "globalCommands.pyc", line 292, in script_increaseSynthSetting
  File "synthSettingsRing.pyc", line 122, in increase
  File "synthSettingsRing.pyc", line 19, in increase
  File "synthSettingsRing.pyc", line 55, in _set_value
IndexError: list index out of range
### System configuration
#### NVDA installed/portable/running from source:
Installed
#### NVDA version:
alpha-27892,42dbabcc
#### Windows version:
Windows 11, build 25324.1000.
#### Name and version of other software in use when reproducing the issue:
N/A
#### Other information about your system:
N/A
### Other questions
#### Does the issue still occur after restarting your computer?
Yes.
#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Yes. This seems to have started occurring when #14704 was merged.
#### If NVDA add-ons are disabled, is your problem still occurring?
Yes.
#### Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?
Yes.


Discussion:
Cc @leonardder

I think this  is tolerated and like many others, seems to be ignored.
 Brian

-- 
***@***.***
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
***@***.***, putting 'Brian Gaff'
in the display name field.
----- Original Message ----- 
From: "Mohamed Al-Hajamy" ***@***.***>
To: "nvaccess/nvda" ***@***.***>
Cc: "Subscribed" ***@***.***>
Sent: Friday, March 24, 2023 1:15 PM
Subject: [nvaccess/nvda] Error sounds heard when navigating up in the synth 
settings ring. (Issue #14741)


> <!-- Please read the text in this edit field before filling it in.
> Please thoroughly read NVDA's wiki article on how to fill in this 
> template, including how to provide the required files.
> Issues may be closed if the required information is not present.
> https://github.com/nvaccess/nvda/blob/master/devDocs/githubIssueTemplateExplanationAndExamples.md
> Please also note that the NVDA project has a Citizen and Contributor Code 
> of Conduct which can be found at 
> https://github.com/nvaccess/nvda/blob/master/CODE_OF_CONDUCT.md. NV Access 
> expects that all contributors and other community members read and abide 
> by the rules set out in this document while participating or contributing 
> to this project. This includes creating or commenting on issues and pull 
> requests.
>
> Each of the questions and sections below start with multiple hash symbols 
> (#). Place your answers and information on the blank line below each 
> question.
> -->
>
> ### Steps to reproduce:
> 1. Switch to OneCore.
> 2. Navigate to the voice option with the synth settings ring, then move 
> upwards until you reach the last voice.
> ### Actual behavior:
> <!--
> Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste 
> here.
> Use braille viewer to copy and paste here.
> You may additionally include an explanation.
> -->
> An error sound is heard when navigating up past the last voice. This 
> doesn't seem to happen when navigating down.
> ### Expected behavior:
> <!--
> Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste 
> here.
> Use braille viewer to copy and paste here.
> You may additionally include an explanation.
> -->
> No error, last voice should be repeated like it was previously.
> ### NVDA logs, crash dumps and other attachments:
> Log fragment: error executing script: <bound method 
> GlobalCommands.script_increaseSynthSetting of 
> <globalCommands.GlobalCommands object at 0x0813C710>> with gesture 
> 'ctrl+shift+NVDA+up arrow'
> Traceback (most recent call last):
>  File "scriptHandler.pyc", line 295, in executeScript
>  File "globalCommands.pyc", line 292, in script_increaseSynthSetting
>  File "synthSettingsRing.pyc", line 122, in increase
>  File "synthSettingsRing.pyc", line 19, in increase
>  File "synthSettingsRing.pyc", line 55, in _set_value
> IndexError: list index out of range
> ### System configuration
> #### NVDA installed/portable/running from source:
> Installed
> #### NVDA version:
> alpha-27892,42dbabcc
> #### Windows version:
> Windows 11, build 25324.1000.
> #### Name and version of other software in use when reproducing the issue:
> N/A
> #### Other information about your system:
> N/A
> ### Other questions
> #### Does the issue still occur after restarting your computer?
> Yes.
> #### Have you tried any other versions of NVDA? If so, please report their 
> behaviors.
> Yes. This seems to have started occurring when #14704 was merged.
> #### If NVDA add-ons are disabled, is your problem still occurring?
> Yes.
> #### Does the issue still occur after you run the COM Registration Fixing 
> Tool in NVDA's tools menu?
> Yes.
>
> -- 
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/14741
> You are receiving this because you are subscribed to this thread.
>
> Message ID: ***@***.***> 


Ugh, I've been thinking about a workaround for some hours, so @Brian1Gaff's suggestion is definitely incorrect.
Cc @leonardder

I think this  is tolerated and like many others, seems to be ignored.
 Brian

-- 
***@***.***
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
***@***.***, putting 'Brian Gaff'
in the display name field.
----- Original Message ----- 
From: "Mohamed Al-Hajamy" ***@***.***>
To: "nvaccess/nvda" ***@***.***>
Cc: "Subscribed" ***@***.***>
Sent: Friday, March 24, 2023 1:15 PM
Subject: [nvaccess/nvda] Error sounds heard when navigating up in the synth 
settings ring. (Issue #14741)


> <!-- Please read the text in this edit field before filling it in.
> Please thoroughly read NVDA's wiki article on how to fill in this 
> template, including how to provide the required files.
> Issues may be closed if the required information is not present.
> https://github.com/nvaccess/nvda/blob/master/devDocs/githubIssueTemplateExplanationAndExamples.md
> Please also note that the NVDA project has a Citizen and Contributor Code 
> of Conduct which can be found at 
> https://github.com/nvaccess/nvda/blob/master/CODE_OF_CONDUCT.md. NV Access 
> expects that all contributors and other community members read and abide 
> by the rules set out in this document while participating or contributing 
> to this project. This includes creating or commenting on issues and pull 
> requests.
>
> Each of the questions and sections below start with multiple hash symbols 
> (#). Place your answers and information on the blank line below each 
> question.
> -->
>
> ### Steps to reproduce:
> 1. Switch to OneCore.
> 2. Navigate to the voice option with the synth settings ring, then move 
> upwards until you reach the last voice.
> ### Actual behavior:
> <!--
> Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste 
> here.
> Use braille viewer to copy and paste here.
> You may additionally include an explanation.
> -->
> An error sound is heard when navigating up past the last voice. This 
> doesn't seem to happen when navigating down.
> ### Expected behavior:
> <!--
> Use "Speak command keys" (NVDA+4) and speech viewer to copy and paste 
> here.
> Use braille viewer to copy and paste here.
> You may additionally include an explanation.
> -->
> No error, last voice should be repeated like it was previously.
> ### NVDA logs, crash dumps and other attachments:
> Log fragment: error executing script: <bound method 
> GlobalCommands.script_increaseSynthSetting of 
> <globalCommands.GlobalCommands object at 0x0813C710>> with gesture 
> 'ctrl+shift+NVDA+up arrow'
> Traceback (most recent call last):
>  File "scriptHandler.pyc", line 295, in executeScript
>  File "globalCommands.pyc", line 292, in script_increaseSynthSetting
>  File "synthSettingsRing.pyc", line 122, in increase
>  File "synthSettingsRing.pyc", line 19, in increase
>  File "synthSettingsRing.pyc", line 55, in _set_value
> IndexError: list index out of range
> ### System configuration
> #### NVDA installed/portable/running from source:
> Installed
> #### NVDA version:
> alpha-27892,42dbabcc
> #### Windows version:
> Windows 11, build 25324.1000.
> #### Name and version of other software in use when reproducing the issue:
> N/A
> #### Other information about your system:
> N/A
> ### Other questions
> #### Does the issue still occur after restarting your computer?
> Yes.
> #### Have you tried any other versions of NVDA? If so, please report their 
> behaviors.
> Yes. This seems to have started occurring when #14704 was merged.
> #### If NVDA add-ons are disabled, is your problem still occurring?
> Yes.
> #### Does the issue still occur after you run the COM Registration Fixing 
> Tool in NVDA's tools menu?
> Yes.
>
> -- 
> Reply to this email directly or view it on GitHub:
> https://github.com/nvaccess/nvda/issues/14741
> You are receiving this because you are subscribed to this thread.
>
> Message ID: ***@***.***> 


Ugh, I've been thinking about a workaround for some hours, so @Brian1Gaff's suggestion is definitely incorrect.

Resolving patch:
diff --git a/source/synthSettingsRing.py b/source/synthSettingsRing.py
--- a/source/synthSettingsRing.py
+++ b/source/synthSettingsRing.py
@@ -44,11 +44,18 @@ def _get__values(self):
 		self._values = list(getattr(self.synth, f"available{self.setting.id.capitalize()}s").values())
 		return self._values
 
+	def _get_max(self):
+		return len(self._values) - 1
+
+	def _set_max(self, value):
+		# Max is set by L{SynthSetting} but should always be a calculated property.
+		pass
+
 	def _get_value(self):
 		curID=getattr(self.synth,self.setting.id)
 		for e,v in enumerate(self._values):
 			if curID==v.id:
-				return e 
+				return e
 
 	def _set_value(self,value):
 		"""Overridden to use code that supports updating speech dicts when changing voice"""
@@ -63,6 +70,7 @@ def _set_value(self,value):
 	def _getReportValue(self, val):
 		return self._values[val].displayName
 
+
 class BooleanSynthSetting(SynthSetting):
 
 	def __init__(self, synth, setting):
@@ -100,7 +108,7 @@ def _get_currentSettingValue(self):
 		return self.settings[self._current].reportValue
 
 	def _set_currentSettingValue(self,value):
-		if self._current is not None: 
+		if self._current is not None:
 			self.settings[_current].value = val
 
 	def next(self):
@@ -118,7 +126,7 @@ def previous(self):
 
 	def increase(self):
 		""" increases the currentSetting and returns its new value """
-		if self._current is not None: 
+		if self._current is not None:
 			return self.settings[self._current].increase()
 		return None
 


Test patch: