Avoid error playing wave file when playing multiple subsequent waves#17918
Merged
Conversation
seanbudd
reviewed
Apr 9, 2025
seanbudd
reviewed
Apr 9, 2025
nvdaes
pushed a commit
to nvdaes/nvda
that referenced
this pull request
Apr 10, 2025
…vaccess#17918) Summary of the issue: First of all, I can't reliably reproduce this, but i have seen several cases lately where an exception was raised in playWaveFile, telling me that None object has no attribute feed. It happens to me around twice a day or so. ERROR - nvwave.play (10:43:12.334) - nvwave.playWaveFile(error.wav) (17056): Error playing wave file Traceback (most recent call last): File "nvwave.pyc", line 127, in play AttributeError: 'NoneType' object has no attribute 'idle' I think I can somewhat understand the issue. playWaveFile can play asynchronously. It has a local function play that sets the global fileWavePlayer to None when done. However when playing several sounds in a row, there can be a case where fileWavePlayer is set to None by one playback, then the next player tries to feed or idle to a None player. Description of user facing changes Hopefully, no longer rare errors. Description of development approach In the local function, copy the reference to the player in a local variable p and then use that variable to do feed and idle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
NOne
Summary of the issue:
First of all, I can't reliably reproduce this, but i have seen several cases lately where an exception was raised in playWaveFile, telling me that None object has no attribute feed. It happens to me around twice a day or so.
I think I can somewhat understand the issue. playWaveFile can play asynchronously. It has a local function play that sets the global
fileWavePlayerto None when done. However when playing several sounds in a row, there can be a case wherefileWavePlayeris set to None by one playback, then the next player tries to feed or idle to a None player.Description of user facing changes
Hopefully, no longer rare errors.
Description of development approach
In the local function, copy the reference to the player in a local variable p and then use that variable to do feed and idle.
Testing strategy:
As i have no steps to reproduce, this is hard to test. That said, I think that from a code point of view, this is nevertheless an improvement.
Known issues with pull request:
None known
Code Review Checklist:
@coderabbitai summary