Skip to content

Various fix-up of keep audio awake feature#16147

Merged
seanbudd merged 11 commits into
nvaccess:masterfrom
CyrilleB79:fixUpPlaySilence
Feb 21, 2024
Merged

Various fix-up of keep audio awake feature#16147
seanbudd merged 11 commits into
nvaccess:masterfrom
CyrilleB79:fixUpPlaySilence

Conversation

@CyrilleB79

@CyrilleB79 CyrilleB79 commented Feb 8, 2024

Copy link
Copy Markdown
Contributor

This PR contains various fix-ups of PR #16099, some less important than others. Cc @mltony

Link to issue number:

Fix-up of #16099

Fixes #16148

Summary of the issue:

  1. Error when disabling WASAPI and reopening advanced settings:
ERROR - unhandled exception (11:14:54.349) - MainThread (6028):
Traceback (most recent call last):
  File "gui\settingsDialogs.pyc", line 4517, in onCategoryChange
  File "gui\settingsDialogs.pyc", line 693, in onCategoryChange
  File "gui\settingsDialogs.pyc", line 675, in _doCategoryChange
  File "gui\settingsDialogs.pyc", line 603, in _getCategoryPanel
  File "gui\settingsDialogs.pyc", line 362, in __init__
  File "gui\settingsDialogs.pyc", line 372, in _buildGui
  File "gui\settingsDialogs.pyc", line 3514, in makeSettings
  File "gui\settingsDialogs.pyc", line 3259, in __init__
  File "gui\settingsDialogs.pyc", line 3352, in _onWasapiChange
  File "gui\guiHelper.pyc", line 232, in Enable
TypeError: Window.Enable(): argument 1 has unexpected type 'FeatureFlag'
ERROR - unhandled exception (11:14:54.361) - MainThread (6028):
Traceback (most recent call last):
  File "gui\guiHelper.pyc", line 218, in _onEnableChanged
TypeError: Window.Enable(): argument 1 has unexpected type 'FeatureFlag'
  1. Oversight in AdvancedPanelControls.haveConfigDefaultsBeenRestored in settingsDialogs.py.

  2. In settingsDialogs.py, rename variable to be consistent with the GUI ("silence" -> "keep audio awake")

  3. Documentation (User Guide and Change log) updates

Description of user facing changes

  • The option is enabled or disabled depending on the real current WASAPI state, not the state defined in the configuration for the next restart of NVDA.
  • The "keep audio awake" option is moved to audio settings
  • The documentation does not mention "playing silence" at all anymore

Description of development approach

For point 1: use real WASAPI state instead of what is in the config for the next restart, as it was already done in other audio settings depending on WASAPI.

Testing strategy:

Checked that the error reported in point 1 does not occur anymore.

  • Checked that the feature still works, using the debug config parameter whiteNoiseVolume.

Note: I am not able to directly test the feature to keep audio awake, since I have no impacted device (e.g. Bluetooth headset).

Known issues with pull request:

None

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@CyrilleB79

Copy link
Copy Markdown
Contributor Author

Note: there are two points following the merge of #16099 that are still being discussed:

If we reach an agreement on one or both of this points, I can also include them in this PR.

@CyrilleB79 CyrilleB79 marked this pull request as ready for review February 8, 2024 16:41
@CyrilleB79 CyrilleB79 requested review from a team as code owners February 8, 2024 16:41
@mltony

mltony commented Feb 8, 2024

Copy link
Copy Markdown
Contributor

Looks good to me!

@seanbudd

seanbudd commented Feb 8, 2024

Copy link
Copy Markdown
Member

should we use "speech sequence", "spoken phrase", "utterance" or something else be used in the documentation

Why not just: "This edit box specifies how long NVDA plays silence after speech ends"

@seanbudd seanbudd marked this pull request as draft February 9, 2024 00:01
@seanbudd

seanbudd commented Feb 9, 2024

Copy link
Copy Markdown
Member

I think it would be good to move the setting to the audio panel in this PR

@cary-rowen

Copy link
Copy Markdown
Contributor

I think it would be good to move the setting to the audio panel in this PR

The default value is sufficient for me and even most users, it is not a setting that needs to be changed frequently, so I think it is appropriate to put it in the advanced settings.

@mltony

mltony commented Feb 9, 2024

Copy link
Copy Markdown
Contributor

I agree with @cary-rowen - most users won't need to change this value, so I'd think it belongs on the advanced panel.

@XLTechie

XLTechie commented Feb 9, 2024 via email

Copy link
Copy Markdown
Collaborator

@XLTechie

XLTechie commented Feb 9, 2024 via email

Copy link
Copy Markdown
Collaborator

@CyrilleB79

Copy link
Copy Markdown
Contributor Author

I have addressed review comments:

  • improved the documentation
  • moved the parameter to audio settings

To see the documentation improvements before the paragraph was moved, do:
git diff master 1825f0bfeef3e0ecd7a163c4fd13f3057ae0c89b -- Copie""$ user_docs/en/userGuide.t2t
or better, if master has moved in the meantime:
git diff 49d5e581d499768d3858443ce25d2ccba4319630 1825f0bfeef3e0ecd7a163c4fd13f3057ae0c89b -- Copie""$ user_docs/en/userGuide.t2t

The following changes have been done in documentation:

Regarding the move of the option to audio settings:

  • Added a shortcut key. My opinion is having shortcut keys for any control can always be a plus for some people, at least in all panels except advanced settings.

@CyrilleB79 CyrilleB79 marked this pull request as ready for review February 9, 2024 09:23
@Brian1Gaff

Brian1Gaff commented Feb 9, 2024 via email

Copy link
Copy Markdown

@XLTechie XLTechie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The following suggestions are mainly to improve the reading of this in my opinion as an English speaker and editor. @Qchristensen might also have some thoughts.

Comment thread source/gui/settingsDialogs.py Outdated
Comment thread source/gui/settingsDialogs.py Outdated
initial=config.conf["audio"]["keepAudioAwakeTimeSeconds"]
)
self.bindHelpEvent("KeepAudioAwakeDuration", self.audioAwakeDurationEdit)
self.audioAwakeDurationEdit.Enable(nvwave.usingWasapiWavePlayer())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If this is going to be "audioAwakeTimeSeconds" in config, why not have it the same in all of these variables and the anchor?
Even "AudioAwakeTime" would be fine (and shorter) IMO.

Comment thread user_docs/en/changes.t2t Outdated
Comment thread user_docs/en/userGuide.t2t Outdated
This setting only takes effect when "Volume of NVDA sounds follows voice volume" is disabled.
This option is not available if you have started NVDA with [WASAPI disabled for audio output #WASAPI] in Advanced Settings.

==== Duration of keeping audio device awake ====[KeepAudioAwakeDuration]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Personally, in English, I find this title slightly awkward.
Here is a suggested alternative. Note that I didn't change the anchor name, as that is referenced else ware, and should be changed holistically if it is changed.
I'm not in love with this alternative either, but it may be somewhat better.

Suggested change
==== Duration of keeping audio device awake ====[KeepAudioAwakeDuration]
==== Keep audio device awake time ====[KeepAudioAwakeDuration]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I would just go with Time to keep audio device awake

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

agreed with Sascha here

Comment thread user_docs/en/userGuide.t2t Outdated
Comment thread user_docs/en/userGuide.t2t Outdated
Comment thread user_docs/en/userGuide.t2t Outdated
Comment thread user_docs/en/userGuide.t2t Outdated
Comment thread user_docs/en/userGuide.t2t Outdated
Comment thread user_docs/en/userGuide.t2t Outdated
Spelling fixes and wording improvements

Co-authored-by: Luke Davis <8139760+XLTechie@users.noreply.github.com>
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

Thanks @XLTechie for your valuable feedback about English spelling / grammar, as well as other wording improvements.

Regarding the name of the option, I'd say that we need to agree on the label of the control in the GUI. Then I'll derive the following:

  • name of the paragraph in the User Guide = same as the GUI option, just omitting the part between parenthesis, i.e. "(sec)"
  • variable names: something shorter with the most significant words of the option's name
  • anchor: idem

I'll wait for other feedback (@seanbudd, @Qchristensen and community).

I agree that having a suitable name in the GUI and in the user guide can participate to the success of a new feature.

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Feb 12, 2024
Comment thread source/gui/settingsDialogs.py Outdated
Comment thread user_docs/en/userGuide.t2t Outdated
Comment thread user_docs/en/userGuide.t2t Outdated
This setting only takes effect when "Volume of NVDA sounds follows voice volume" is disabled.
This option is not available if you have started NVDA with [WASAPI disabled for audio output #WASAPI] in Advanced Settings.

==== Duration of keeping audio device awake ====[KeepAudioAwakeDuration]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I would just go with Time to keep audio device awake

Comment thread user_docs/en/userGuide.t2t Outdated
This can happen due to audio devices (especially Bluetooth and wireless devices) entering stand-by mode.
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.

Lower values may allow audio to be cut-off more often, as a device may enter stand-by mode too soon, causing the start of the following speech to be clipped.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The various instances of "stand-by" should be replaced with "standby".

@seanbudd seanbudd marked this pull request as draft February 20, 2024 05:35
CyrilleB79 and others added 3 commits February 20, 2024 09:50
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
Co-authored-by: Luke Davis <8139760+XLTechie@users.noreply.github.com>
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 8ccf634a3d

@CyrilleB79 CyrilleB79 marked this pull request as ready for review February 20, 2024 21:37
@seanbudd seanbudd merged commit f178c1d into nvaccess:master Feb 21, 2024
@nvaccessAuto nvaccessAuto added this to the 2024.2 milestone Feb 21, 2024
@CyrilleB79 CyrilleB79 deleted the fixUpPlaySilence branch February 22, 2024 10:16
Adriani90 pushed a commit to Adriani90/nvda that referenced this pull request Mar 13, 2024
Fix-up of nvaccess#16099

Fixes nvaccess#16148

Summary of the issue:
Error when disabling WASAPI and reopening advanced settings:
ERROR - unhandled exception (11:14:54.349) - MainThread (6028):
Traceback (most recent call last):
  File "gui\settingsDialogs.pyc", line 4517, in onCategoryChange
  File "gui\settingsDialogs.pyc", line 693, in onCategoryChange
  File "gui\settingsDialogs.pyc", line 675, in _doCategoryChange
  File "gui\settingsDialogs.pyc", line 603, in _getCategoryPanel
  File "gui\settingsDialogs.pyc", line 362, in __init__
  File "gui\settingsDialogs.pyc", line 372, in _buildGui
  File "gui\settingsDialogs.pyc", line 3514, in makeSettings
  File "gui\settingsDialogs.pyc", line 3259, in __init__
  File "gui\settingsDialogs.pyc", line 3352, in _onWasapiChange
  File "gui\guiHelper.pyc", line 232, in Enable
TypeError: Window.Enable(): argument 1 has unexpected type 'FeatureFlag'
ERROR - unhandled exception (11:14:54.361) - MainThread (6028):
Traceback (most recent call last):
  File "gui\guiHelper.pyc", line 218, in _onEnableChanged
TypeError: Window.Enable(): argument 1 has unexpected type 'FeatureFlag'
Oversight in AdvancedPanelControls.haveConfigDefaultsBeenRestored in settingsDialogs.py.

In settingsDialogs.py, rename variable to be consistent with the GUI ("silence" -> "keep audio awake")

Documentation (User Guide and Change log) updates

Description of user facing changes
The option is enabled or disabled depending on the real current WASAPI state, not the state defined in the configuration for the next restart of NVDA.
The "keep audio awake" option is moved to audio settings
The documentation does not mention "playing silence" at all anymore
Description of development approach
For point 1: use real WASAPI state instead of what is in the config for the next restart, as it was already done in other audio settings depending on WASAPI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Play silence to keep audio device awake

9 participants