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

Sound card accepts nonsensical floating-point inputs in its methods #327

Open
Fingercomp opened this issue Apr 4, 2023 · 0 comments
Open

Comments

@Fingercomp
Copy link
Contributor

The sound card allows you to set the frequency of a channel to a negative value, which breaks half the oscillators (state.offset goes deep into negative). Or infinite, breaking the whole channel now. Passing NaN renders the sound card completely mute1.

setVolume seemingly clamps the input to [0, 1]. However, it doesn't check for NaN. So it allows the NaN to propagate throughout the code, poisoning the state and, again, making it unable to produce any sound1.

I believe these methods (as well as many others) would benefit from a more stringent inspection of its floating-point arguments — checking them for finiteness and applicability.

Though negative frequencies would make sense if they would actually work.

Footnotes

  1. By this I mean the sound card will no longer generate any output no matter what methods you try to call. Removing the card and installing it again also seems to have no effect. The card is effectively bricked this way. 2

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

No branches or pull requests

1 participant