Computronics icon indicating copy to clipboard operation
Computronics copied to clipboard

Sound card accepts nonsensical floating-point inputs in its methods

Open Fingercomp opened this issue 3 years ago • 0 comments

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 mute[^1].

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 sound[^1].

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.

[^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.

Fingercomp avatar Apr 04 '23 16:04 Fingercomp