Skip to content

Commit d58596b

Browse files
authored
Merge 0c86e42 into 9157916
2 parents 9157916 + 0c86e42 commit d58596b

5 files changed

Lines changed: 43 additions & 33 deletions

File tree

source/config/configSpec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#: provide an upgrade step (@see profileUpgradeSteps.py). An upgrade step does not need to be added when
1414
#: just adding a new element to (or removing from) the schema, only when old versions of the config
1515
#: (conforming to old schema versions) will not work correctly with the new schema.
16-
latestSchemaVersion = 10
16+
latestSchemaVersion = 11
1717

1818
#: The configuration specification string
1919
#: @type: String
@@ -57,7 +57,7 @@
5757
# Audio settings
5858
[audio]
5959
audioDuckingMode = integer(default=0)
60-
wasapi = boolean(default=true)
60+
wasapi = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="disabled")
6161
soundVolumeFollowsVoice = boolean(default=false)
6262
soundVolume = integer(default=100, min=0, max=100)
6363

source/config/profileUpgradeSteps.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
ReportTableHeaders,
2424
ReportCellBorders,
2525
)
26-
from typing import (
27-
Dict,
28-
)
2926
import configobj.validate
3027
from configobj import ConfigObj
3128

@@ -354,3 +351,8 @@ def upgradeConfigFrom_9_to_10(profile: ConfigObj) -> None:
354351
profile['keyboard']['NVDAModifierKeys'] = val
355352
else:
356353
log.debug("use*AsNVDAModifierKey values not present, no action taken.")
354+
355+
356+
def upgradeConfigFrom_10_to_11(profile: ConfigObj) -> None:
357+
"""Change WASAPI to boolean feature flag in alpha snapshots"""
358+
profile["audio"]["wasapi"] = "default"

source/gui/nvdaControls.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,18 @@ def resetToConfigSpecDefault(self) -> None:
499499
"""
500500
self.SetSelection(self._getChoiceIndex(self.defaultValue))
501501

502+
def _getControlCurrentValue(self) -> enum.Enum:
503+
return list(self._translatedOptions.keys())[self.GetSelection()]
504+
505+
def _getControlCurrentFlag(self) -> FeatureFlag:
506+
flagValue = self._getControlCurrentValue()
507+
currentFlag = self._getConfigValue()
508+
return FeatureFlag(flagValue, currentFlag.behaviorOfDefault)
509+
502510
def saveCurrentValueToConf(self) -> None:
503511
""" Set the config value to the current value of the control.
504512
"""
505-
flagValue: enum.Enum = list(self._translatedOptions.keys())[self.GetSelection()]
513+
flagValue = self._getControlCurrentValue()
506514
keyPath = self._confPath
507515
if not keyPath or len(keyPath) < 1:
508516
raise ValueError("Key path not provided")

source/gui/settingsDialogs.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
List,
5656
Optional,
5757
Set,
58+
cast,
5859
)
5960
import core
6061
import keyboardHandler
@@ -3074,27 +3075,25 @@ def __init__(self, parent):
30743075
audioGroup = guiHelper.BoxSizerHelper(self, sizer=audio)
30753076
sHelper.addItem(audioGroup)
30763077

3077-
# Translators: This is the label for a checkbox control in the
3078-
# Advanced settings panel.
3078+
# Translators: This is the label for a checkbox control in the Advanced settings panel.
30793079
label = _("Use WASAPI for audio output (requires restart)")
3080-
self.wasapiCheckBox: wx.CheckBox = audioGroup.addItem(
3081-
wx.CheckBox(audioBox, label=label)
3082-
)
3083-
self.bindHelpEvent("WASAPI", self.wasapiCheckBox)
3084-
self.wasapiCheckBox.Bind(wx.EVT_CHECKBOX, self.onAudioCheckBoxChange)
3085-
self.wasapiCheckBox.SetValue(
3086-
config.conf["audio"]["wasapi"]
3087-
)
3088-
self.wasapiCheckBox.defaultValue = self._getDefaultValue(
3089-
["audio", "wasapi"])
3080+
self.wasapiComboBox = cast(nvdaControls.FeatureFlagCombo, audioGroup.addLabeledControl(
3081+
labelText=label,
3082+
wxCtrlClass=nvdaControls.FeatureFlagCombo,
3083+
keyPath=["audio", "wasapi"],
3084+
conf=config.conf,
3085+
))
3086+
self.bindHelpEvent("WASAPI", self.wasapiComboBox)
3087+
self.wasapiComboBox.Bind(wx.EVT_CHOICE, self._onWASAPIChange)
3088+
30903089
# Translators: This is the label for a checkbox control in the
30913090
# Advanced settings panel.
30923091
label = _("Volume of NVDA sounds follows voice volume (requires WASAPI)")
30933092
self.soundVolFollowCheckBox: wx.CheckBox = audioGroup.addItem(
30943093
wx.CheckBox(audioBox, label=label)
30953094
)
30963095
self.bindHelpEvent("SoundVolumeFollowsVoice", self.soundVolFollowCheckBox)
3097-
self.soundVolFollowCheckBox.Bind(wx.EVT_CHECKBOX, self.onAudioCheckBoxChange)
3096+
self.soundVolFollowCheckBox.Bind(wx.EVT_CHECKBOX, self._onWASAPIChange)
30983097
self.soundVolFollowCheckBox.SetValue(
30993098
config.conf["audio"]["soundVolumeFollowsVoice"]
31003099
)
@@ -3115,7 +3114,7 @@ def __init__(self, parent):
31153114
)
31163115
self.soundVolSlider.defaultValue = self._getDefaultValue(
31173116
["audio", "soundVolume"])
3118-
self.onAudioCheckBoxChange()
3117+
self._onWASAPIChange()
31193118

31203119
# Translators: This is the label for a group of advanced options in the
31213120
# Advanced settings panel
@@ -3178,8 +3177,8 @@ def onOpenScratchpadDir(self,evt):
31783177
path=config.getScratchpadDir(ensureExists=True)
31793178
os.startfile(path)
31803179

3181-
def onAudioCheckBoxChange(self, evt: Optional[wx.CommandEvent] = None):
3182-
wasapi = self.wasapiCheckBox.IsChecked()
3180+
def _onWASAPIChange(self, evt: Optional[wx.CommandEvent] = None):
3181+
wasapi = bool(self.wasapiComboBox._getControlCurrentFlag())
31833182
self.soundVolFollowCheckBox.Enable(wasapi)
31843183
self.soundVolSlider.Enable(
31853184
wasapi
@@ -3213,7 +3212,7 @@ def haveConfigDefaultsBeenRestored(self):
32133212
and self.loadChromeVBufWhenBusyCombo.isValueConfigSpecDefault()
32143213
and self.caretMoveTimeoutSpinControl.GetValue() == self.caretMoveTimeoutSpinControl.defaultValue
32153214
and self.reportTransparentColorCheckBox.GetValue() == self.reportTransparentColorCheckBox.defaultValue
3216-
and self.wasapiCheckBox.GetValue() == self.wasapiCheckBox.defaultValue
3215+
and self.wasapiComboBox.isValueConfigSpecDefault()
32173216
and self.soundVolFollowCheckBox.GetValue() == self.soundVolFollowCheckBox.defaultValue
32183217
and self.soundVolSlider.GetValue() == self.soundVolSlider.defaultValue
32193218
and set(self.logCategoriesList.CheckedItems) == set(self.logCategoriesList.defaultCheckedItems)
@@ -3242,7 +3241,7 @@ def restoreToDefaults(self):
32423241
self.loadChromeVBufWhenBusyCombo.resetToConfigSpecDefault()
32433242
self.caretMoveTimeoutSpinControl.SetValue(self.caretMoveTimeoutSpinControl.defaultValue)
32443243
self.reportTransparentColorCheckBox.SetValue(self.reportTransparentColorCheckBox.defaultValue)
3245-
self.wasapiCheckBox.SetValue(self.wasapiCheckBox.defaultValue)
3244+
self.wasapiComboBox.resetToConfigSpecDefault()
32463245
self.soundVolFollowCheckBox.SetValue(self.soundVolFollowCheckBox.defaultValue)
32473246
self.soundVolSlider.SetValue(self.soundVolSlider.defaultValue)
32483247
self.logCategoriesList.CheckedItems = self.logCategoriesList.defaultCheckedItems
@@ -3275,7 +3274,7 @@ def onSave(self):
32753274
config.conf["documentFormatting"]["reportTransparentColor"] = (
32763275
self.reportTransparentColorCheckBox.IsChecked()
32773276
)
3278-
config.conf["audio"]["wasapi"] = self.wasapiCheckBox.IsChecked()
3277+
self.wasapiComboBox.saveCurrentValueToConf()
32793278
config.conf["audio"]["soundVolumeFollowsVoice"] = self.soundVolFollowCheckBox.IsChecked()
32803279
config.conf["audio"]["soundVolume"] = self.soundVolSlider.GetValue()
32813280
config.conf["annotations"]["reportDetails"] = self.annotationsDetailsCheckBox.IsChecked()

user_docs/en/changes.t2t

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ What's New in NVDA
1313
- The Add-ons Manager has been removed and replaced by the Add-on Store.
1414
- For more information please read the updated user guide.
1515
-
16-
- Enhanced sound management:
17-
- NVDA now outputs audio via the Windows Audio Session API (WASAPI), which may improve the responsiveness, performance and stability of NVDA speech and sounds.
18-
This can be disabled in Advanced settings if audio problems are encountered. (#14697)
19-
- It is now possible to have the volume of NVDA sounds and beeps follow the volume setting of the voice you are using.
20-
This option can be enabled in Advanced settings. (#1409)
21-
- You can now separately control the volume of NVDA sounds.
22-
This can be configured in Advanced settings. (#1409)
23-
-
2416
- New input gestures:
2517
- An unbound gesture to cycle through the available languages for Windows OCR. (#13036)
2618
- An unbound gesture to cycle through the Braille show messages modes. (#14864)
@@ -57,6 +49,15 @@ What's New in NVDA
5749
- When colors are enabled Document Formatting, background colours are now reported in Microsoft Word. (#5866)
5850
- When using Excel shortcuts to toggle format such as bold, italic, underline and strike through of a cell in Excel, the result is now reported. (#14923)
5951
-
52+
- Experimental enhanced sound management:
53+
- NVDA can now output audio via the Windows Audio Session API (WASAPI), which may improve the responsiveness, performance and stability of NVDA speech and sounds. (#14697)
54+
- WASAPI usage can be enabled in Advanced settings.
55+
Additionally, if WASAPI is enabled, the following Advanced settings can also be configured.
56+
- An option to have the volume of NVDA sounds and beeps follow the volume setting of the voice you are using. (#1409)
57+
- An option to separately configure the volume of NVDA sounds. (#1409, #15038)
58+
-
59+
- There is a known issue with intermittent crashing when WASAPI is enabled. (#15150)
60+
-
6061
- In Mozilla Firefox and Google Chrome, NVDA now reports when a control opens a dialog, grid, list or tree if the author has specified this using aria-haspopup. (#14709)
6162
- It is now possible to use system variables (such as ``%temp%`` or ``%homepath%``) in the path specification while creating portable copies of NVDA. (#14680)
6263
- In Windows 10 May 2019 Update and later, NVDA can announce virtual desktop names when opening, changing, and closing them. (#5641)

0 commit comments

Comments
 (0)