got rid of magic numbers

This commit is contained in:
ericrius1 2016-02-18 18:17:37 -08:00
parent d0660fc90a
commit 33a232edde

View file

@ -13,7 +13,7 @@
Script.include("../libraries/utils.js"); Script.include("../libraries/utils.js");
var numSoundsToPlayPerBatch = 50 var numSoundsToPlayPerBatch = 35
var numSoundsPlaying = 0; var numSoundsPlaying = 0;
var timeBetweenBatch = 30000; var timeBetweenBatch = 30000;
// A green box represents an injector that is playing // A green box represents an injector that is playing
@ -28,16 +28,19 @@ var soundBoxes = [];
var testSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/eric/Sounds/dove.wav"); var testSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/eric/Sounds/dove.wav");
var totalInjectors = 0; var totalInjectors = 0;
var clipDuration;
if(!testSound.downloaded) { if(!testSound.downloaded) {
print("SOUND IS NOT READY YET") print("SOUND IS NOT READY YET")
testSound.ready.connect(function() { testSound.ready.connect(function() {
playSounds(); playSounds();
clipDuration = testSound.duration;
}); });
} else { } else {
// otherwise play sounds right away // otherwise play sounds right away
playSounds(); playSounds();
clipDuration = testSound.duration;
} }
function playSounds() { function playSounds() {
@ -48,7 +51,7 @@ function playSounds() {
Script.setTimeout(function() { Script.setTimeout(function() {
numSoundsPlaying = 0; numSoundsPlaying = 0;
}, 1500); }, clipDuration);
print("EBL Total Number of Injectors: " + totalInjectors); print("EBL Total Number of Injectors: " + totalInjectors);
Script.setTimeout(function() { Script.setTimeout(function() {