Skip to content

Avoid error playing wave file when playing multiple subsequent waves#17918

Merged
seanbudd merged 4 commits into
nvaccess:masterfrom
LeonarddeR:avoidWaveErrors
Apr 10, 2025
Merged

Avoid error playing wave file when playing multiple subsequent waves#17918
seanbudd merged 4 commits into
nvaccess:masterfrom
LeonarddeR:avoidWaveErrors

Conversation

@LeonarddeR

@LeonarddeR LeonarddeR commented Apr 8, 2025

Copy link
Copy Markdown
Collaborator

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.

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.

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:

  • 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.

@coderabbitai summary

@LeonarddeR LeonarddeR marked this pull request as ready for review April 8, 2025 19:42
@LeonarddeR LeonarddeR requested a review from a team as a code owner April 8, 2025 19:42
@LeonarddeR LeonarddeR requested a review from seanbudd April 8, 2025 19:42
Comment thread user_docs/en/changes.md Outdated
Comment thread source/nvwave.py

@seanbudd seanbudd left a comment

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.

Thanks @LeonarddeR

@seanbudd seanbudd merged commit a966bfa into nvaccess:master Apr 10, 2025
@github-actions github-actions Bot added this to the 2025.2 milestone Apr 10, 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants