mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-09-19 20:14:58 +00:00
Added type validation - when fail use default
This commit is contained in:
parent
7faf4a4e85
commit
a4ddafb5c8
1 changed files with 3 additions and 3 deletions
6
qb.js
6
qb.js
|
@ -2817,9 +2817,9 @@ var QB = new function() {
|
|||
|
||||
|
||||
this.sub_Sound = async function(freq, duration, shape, decay, gain) {
|
||||
if (shape == undefined) { shape = "square"; }
|
||||
if (decay == undefined) { decay = 0.0; }
|
||||
if (gain == undefined) { gain = 1.0; }
|
||||
if (shape == undefined || (typeof shape != 'string')) { shape = "square"; }
|
||||
if (decay == undefined || (typeof decay != 'number')) { decay = 0.0; }
|
||||
if (gain == undefined || (typeof gain != 'number')) { gain = 1.0; }
|
||||
if (!(freq == 0 || (freq >= 32 && freq <= 32767))) {
|
||||
throw new Error("Frequency invalid - valid: 0 (delay), 32 to 32767");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue