Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the audio module less unsafe #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jstasiak
Copy link

This is achieved by eliminating two global variables and making the code
work nicely with ownership analysis.

This is possible because AudioDevice has a lock method that
returns an object that dereferences to NesCallback we can store the
output buffer directly in NesCallback and then safely access it to
update the raw sound data.

The resulting code is easier to follow and contains fewer unsafe blocks.

This is achieved by eliminating two global variables and making the code
work nicely with ownership analysis.

This is possible because AudioDevice<NesCallback> has a lock method that
returns an object that dereferences to NesCallback we can store the
output buffer directly in NesCallback and then safely access it to
update the raw sound data.

The resulting code is easier to follow and contains fewer unsafe blocks.
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.

None yet

1 participant