Skip to content

Commit 8ccf634

Browse files
authored
Merge a346a5f into 6a43521
2 parents 6a43521 + a346a5f commit 8ccf634

5 files changed

Lines changed: 41 additions & 49 deletions

File tree

source/config/configSpec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
WASAPI = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="enabled")
5656
soundVolumeFollowsVoice = boolean(default=false)
5757
soundVolume = integer(default=100, min=0, max=100)
58-
keepAudioAwakeTimeSeconds = integer(default=30, min=0, max=3600)
58+
audioAwakeTime = integer(default=30, min=0, max=3600)
5959
whiteNoiseVolume = integer(default=0, min=0, max=100)
6060
6161
# Braille settings

source/gui/settingsDialogs.py

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# A part of NonVisual Desktop Access (NVDA)
2-
# Copyright (C) 2006-2023 NV Access Limited, Peter Vágner, Aleksey Sadovoy,
2+
# Copyright (C) 2006-2024 NV Access Limited, Peter Vágner, Aleksey Sadovoy,
33
# Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter,
44
# Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler, Thomas Stivers,
55
# Julien Cochuyt, Peter Vágner, Cyrille Bougot, Mesar Hameed, Łukasz Golonka, Aaron Cannon,
@@ -2711,6 +2711,24 @@ def makeSettings(self, settingsSizer: wx.BoxSizer) -> None:
27112711
self.soundVolSlider.SetValue(config.conf["audio"]["soundVolume"])
27122712

27132713
self._onSoundVolChange(None)
2714+
2715+
audioAwakeTimeLabelText = _(
2716+
# Translators: The label for a setting in Audio settings panel
2717+
# to change how long the audio device is kept awake after speech
2718+
2719+
"Time to &keep audio device awake after speech (seconds)"
2720+
)
2721+
minTime = int(config.conf.getConfigValidation(("audio", "audioAwakeTime")).kwargs["min"])
2722+
maxTime = int(config.conf.getConfigValidation(("audio", "audioAwakeTime")).kwargs["max"])
2723+
self.audioAwakeTimeEdit = sHelper.addLabeledControl(
2724+
audioAwakeTimeLabelText,
2725+
nvdaControls.SelectOnFocusSpinCtrl,
2726+
min=minTime,
2727+
max=maxTime,
2728+
initial=config.conf["audio"]["audioAwakeTime"]
2729+
)
2730+
self.bindHelpEvent("AudioAwakeTime", self.audioAwakeTimeEdit)
2731+
self.audioAwakeTimeEdit.Enable(nvwave.usingWasapiWavePlayer())
27142732

27152733
def onSave(self):
27162734
if config.conf["speech"]["outputDevice"] != self.deviceList.GetStringSelection():
@@ -2732,6 +2750,8 @@ def onSave(self):
27322750
index = self.duckingList.GetSelection()
27332751
config.conf["audio"]["audioDuckingMode"] = index
27342752
audioDucking.setAudioDuckingMode(index)
2753+
2754+
config.conf["audio"]["audioAwakeTime"] = self.audioAwakeTimeEdit.GetValue()
27352755

27362756
def onPanelActivated(self):
27372757
self._onSoundVolChange(None)
@@ -3238,29 +3258,8 @@ def __init__(self, parent):
32383258
keyPath=["audio", "WASAPI"],
32393259
conf=config.conf,
32403260
))
3241-
self.wasapiComboBox .Bind(wx.EVT_CHOICE, self._onWasapiChange)
32423261
self.bindHelpEvent("WASAPI", self.wasapiComboBox)
32433262

3244-
silenceDurationLabelText = _(
3245-
# Translators: The label for a setting in advanced panel
3246-
# to change the duration of keeping audio device awake
3247-
"Duration in seconds of keeping audio device awake"
3248-
)
3249-
minDuration = int(config.conf.getConfigValidation(
3250-
("audio", "keepAudioAwakeTimeSeconds")
3251-
).kwargs["min"])
3252-
maxDuration = int(config.conf.getConfigValidation(("audio", "keepAudioAwakeTimeSeconds")).kwargs["max"])
3253-
self.silenceDurationEdit = audioGroup.addLabeledControl(
3254-
silenceDurationLabelText,
3255-
nvdaControls.SelectOnFocusSpinCtrl,
3256-
min=minDuration,
3257-
max=maxDuration,
3258-
initial=config.conf["audio"]["keepAudioAwakeTimeSeconds"]
3259-
)
3260-
self.silenceDurationEdit.defaultValue = self._getDefaultValue(["audio", "keepAudioAwakeTimeSeconds"])
3261-
self.bindHelpEvent("KeepAudioAwakeDuration", self.silenceDurationEdit)
3262-
self._onWasapiChange(None)
3263-
32643263
# Translators: This is the label for a group of advanced options in the
32653264
# Advanced settings panel
32663265
label = _("Debug logging")
@@ -3351,12 +3350,6 @@ def onOpenScratchpadDir(self,evt):
33513350
path=config.getScratchpadDir(ensureExists=True)
33523351
os.startfile(path)
33533352

3354-
def _onWasapiChange(self, evt: wx.CommandEvent) -> None:
3355-
self.silenceDurationEdit.Enable(
3356-
config.conf["audio"]["WASAPI"]
3357-
and self.wasapiComboBox._getControlCurrentValue().value != 2 # wasapi not disabled
3358-
)
3359-
33603353
def _getDefaultValue(self, configPath):
33613354
return config.conf.getConfigValidation(configPath).default
33623355

@@ -3412,7 +3405,6 @@ def restoreToDefaults(self):
34123405
self.caretMoveTimeoutSpinControl.SetValue(self.caretMoveTimeoutSpinControl.defaultValue)
34133406
self.reportTransparentColorCheckBox.SetValue(self.reportTransparentColorCheckBox.defaultValue)
34143407
self.wasapiComboBox.resetToConfigSpecDefault()
3415-
self.silenceDurationEdit.SetValue(self.silenceDurationEdit.defaultValue)
34163408
self.logCategoriesList.CheckedItems = self.logCategoriesList.defaultCheckedItems
34173409
self.playErrorSoundCombo.SetSelection(self.playErrorSoundCombo.defaultValue)
34183410
self._defaultsRestored = True
@@ -3445,7 +3437,6 @@ def onSave(self):
34453437
self.reportTransparentColorCheckBox.IsChecked()
34463438
)
34473439
self.wasapiComboBox.saveCurrentValueToConf()
3448-
config.conf["audio"]["keepAudioAwakeTimeSeconds"] = self.silenceDurationEdit.GetValue()
34493440
config.conf["annotations"]["reportDetails"] = self.annotationsDetailsCheckBox.IsChecked()
34503441
config.conf["annotations"]["reportAriaDescription"] = self.ariaDescCheckBox.IsChecked()
34513442
self.brailleLiveRegionsCombo.saveCurrentValueToConf()

source/nvwave.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -836,13 +836,13 @@ def __init__(
836836
self._lastActiveTime: typing.Optional[float] = None
837837
self._isPaused: bool = False
838838
if (
839-
config.conf["audio"]["keepAudioAwakeTimeSeconds"] > 0
839+
config.conf["audio"]["audioAwakeTime"] > 0
840840
and WasapiWavePlayer._silenceDevice != outputDevice
841841
):
842842
# The output device has changed. (Re)initialize silence.
843843
if self._silenceDevice is not None:
844844
NVDAHelper.localLib.wasSilence_terminate()
845-
if config.conf["audio"]["keepAudioAwakeTimeSeconds"] > 0:
845+
if config.conf["audio"]["audioAwakeTime"] > 0:
846846
NVDAHelper.localLib.wasSilence_init(outputDevice)
847847
WasapiWavePlayer._silenceDevice = outputDevice
848848

@@ -925,9 +925,9 @@ def feed(
925925
self._doneCallbacks[feedId.value] = onDone
926926
self._lastActiveTime = time.time()
927927
self._scheduleIdleCheck()
928-
if config.conf["audio"]["keepAudioAwakeTimeSeconds"] > 0:
928+
if config.conf["audio"]["audioAwakeTime"] > 0:
929929
NVDAHelper.localLib.wasSilence_playFor(
930-
1000 * config.conf["audio"]["keepAudioAwakeTimeSeconds"],
930+
1000 * config.conf["audio"]["audioAwakeTime"],
931931
c_float(config.conf["audio"]["whiteNoiseVolume"] / 100.0),
932932
)
933933

user_docs/en/changes.t2t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ What's New in NVDA
2121
-
2222
-
2323
- Added support for the BrailleEdgeS2 braille device. (#16033)
24-
- NVDA will play silence after every speech sequence in order to prevent the start of the next speech being clipped with some audio devices such as Bluetooth headphones. (#14386, @jcsteh, @mltony)
24+
- NVDA will keep the audio device awake after speech stops, in order to prevent the start of the next speech being clipped with some audio devices such as Bluetooth headphones. (#14386, @jcsteh, @mltony)
2525
-
2626

2727

user_docs/en/userGuide.t2t

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,20 @@ This slider allows you to set the volume of NVDA sounds and beeps.
19431943
This setting only takes effect when "Volume of NVDA sounds follows voice volume" is disabled.
19441944
This option is not available if you have started NVDA with [WASAPI disabled for audio output #WASAPI] in Advanced Settings.
19451945

1946+
==== Time to keep audio device awake after speech ====[AudioAwakeTime]
1947+
1948+
This edit box specifies how long NVDA keeps the audio device awake after speech ends.
1949+
This allows NVDA to avoid certain speech glitches like dropped parts of words.
1950+
This can happen due to audio devices (especially Bluetooth and wireless devices) entering standby mode.
1951+
This might also be helpful in other use cases, such as when running NVDA inside a virtual machine (e.g. Citrix Virtual Desktop), or on certain laptops.
1952+
1953+
Lower values may allow audio to be cut-off more often, as a device may enter standby mode too soon, causing the start of the following speech to be clipped.
1954+
Setting the value too high may cause the battery of the sound output device to discharge faster, as it stays active for longer while no sound is being sent.
1955+
1956+
1957+
You can set the time to zero in order to disable this feature.
1958+
This option is not available if you have started NVDA with [WASAPI disabled for audio output #WASAPI] in Advanced Settings.
1959+
19461960
+++ Vision +++[VisionSettings]
19471961
The Vision category in the NVDA Settings dialog allows you to enable, disable and configure [visual aids #Vision].
19481962

@@ -2614,19 +2628,6 @@ Disabling WASAPI will disable the following options:
26142628
- [Volume of NVDA sounds #SoundVolume]
26152629
-
26162630

2617-
==== Duration of keeping audio device awake ====[KeepAudioAwakeDuration]
2618-
2619-
This edit box specifies how long NVDA keeps the audio device awake after every speech sequence.
2620-
NVDA does this by playing silence to keep the audio device open and avoid certain glitches like dropped parts of speech sequences.
2621-
This can happen due to audio devices (especially Bluetooth and wireless devices) entering stand-by mode.
2622-
This might also be helpful in certain other use cases, such as running NVDA inside a virtual machine, such as Citrix Virtual Desktop, or on certain models of laptops.
2623-
2624-
Lower values may mean audio would be cut-off more often, as a device may enter stand-by mode, causing the next speech to be clipped.
2625-
Too high a value may mean the battery of the sound output device discharges faster, as it stays active for longer while no sound is being sent.
2626-
2627-
You can specify silence duration to be 0 in order to disable this feature.
2628-
This slider is only available when [WASAPI mode #WASAPI] is enabled.
2629-
26302631
==== Debug logging categories ====[AdvancedSettingsDebugLoggingCategories]
26312632
The checkboxes in this list allow you to enable specific categories of debug messages in NVDA's log.
26322633
Logging these messages can result in decreased performance and large log files.

0 commit comments

Comments
 (0)