ahdinosaur / read-audio

:microphone: Read raw audio input as a stream of ndsamples
http://livejs.github.io/read-audio/
10 stars 2 forks source link

Validate options #6

Open binarykitchen opened 9 years ago

binarykitchen commented 9 years ago

I think this is important. Throw errors if any of these options have invalid values. For example

        if (!isPOT(opts.buffer))
            throw new Error('Audio buffer size must be a power of two.')

        else if (!opts.volume || opts.volume > 1)
            throw new Error('Audio volume must be between zero and one.')

of course, also validate the others wherever possible.