1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 21:00:23 +01:00

Also fake array entries that contain zero.

This commit is contained in:
kkapsner 2018-06-29 23:27:20 +02:00
parent df5109bbf6
commit f7a0990a29

View File

@ -83,7 +83,14 @@
var noiseLevel = getAudioNoiseLevel(prefs);
var rng = randomSupply.getRng(rate, window);
forEachIndex(array, prefs, function(index, i){
array[index] *= 1 + (rng(i) / 0xffffffff - 0.5) * noiseLevel;
let value;
if (array[index] !== 0){
value = array[index] * (1 + (rng(i) / 0xffffffff - 0.5) * noiseLevel);
}
else {
value = Number.EPSILON * (rng(i) / 0xffffffff - 0.5) * noiseLevel;
}
array[index] = value;
});
}
}