Skip to content

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

@Fingercomp

Description

@Fingercomp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions