mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +02:00
cleanup
This commit is contained in:
parent
68d43dc576
commit
0b06cf1dfb
1 changed files with 8 additions and 5 deletions
|
@ -8,7 +8,6 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
var soundMap = [{
|
var soundMap = [{
|
||||||
name: 'river water',
|
name: 'river water',
|
||||||
url: "http://hifi-public.s3.amazonaws.com/ryan/Water_Lap_River_Edge_Gentle.L.wav",
|
url: "http://hifi-public.s3.amazonaws.com/ryan/Water_Lap_River_Edge_Gentle.L.wav",
|
||||||
|
@ -90,7 +89,6 @@ function loadSounds() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function playSound(soundData) {
|
function playSound(soundData) {
|
||||||
if (soundData.injector) {
|
if (soundData.injector) {
|
||||||
// try/catch in case the injector QObject has been deleted already
|
// try/catch in case the injector QObject has been deleted already
|
||||||
|
@ -103,10 +101,12 @@ function playSound(soundData) {
|
||||||
|
|
||||||
function checkDownloaded(soundData) {
|
function checkDownloaded(soundData) {
|
||||||
if (soundData.sound.downloaded) {
|
if (soundData.sound.downloaded) {
|
||||||
|
|
||||||
Script.clearInterval(soundData.downloadTimer);
|
Script.clearInterval(soundData.downloadTimer);
|
||||||
|
|
||||||
if (soundData.hasOwnProperty('playAtInterval')) {
|
if (soundData.hasOwnProperty('playAtInterval')) {
|
||||||
soundData.playingInterval = Script.setInterval(function() {
|
soundData.playingInterval = Script.setInterval(function() {
|
||||||
playSound(soundData);
|
playSound(soundData)
|
||||||
}, soundData.playAtInterval);
|
}, soundData.playAtInterval);
|
||||||
} else {
|
} else {
|
||||||
playSound(soundData);
|
playSound(soundData);
|
||||||
|
@ -118,23 +118,26 @@ function checkDownloaded(soundData) {
|
||||||
function startCheckDownloadedTimers() {
|
function startCheckDownloadedTimers() {
|
||||||
soundMap.forEach(function(soundData) {
|
soundMap.forEach(function(soundData) {
|
||||||
soundData.downloadTimer = Script.setInterval(function() {
|
soundData.downloadTimer = Script.setInterval(function() {
|
||||||
checkDownloaded(soundData)
|
checkDownloaded(soundData);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.scriptEnding.connect(function() {
|
Script.scriptEnding.connect(function() {
|
||||||
soundMap.forEach(function(soundData) {
|
soundMap.forEach(function(soundData) {
|
||||||
|
|
||||||
if (soundData.hasOwnProperty("injector")) {
|
if (soundData.hasOwnProperty("injector")) {
|
||||||
soundData.injector.stop();
|
soundData.injector.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soundData.hasOwnProperty("downloadTimer")) {
|
if (soundData.hasOwnProperty("downloadTimer")) {
|
||||||
Script.clearInterval(soundData.downloadTimer);
|
Script.clearInterval(soundData.downloadTimer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soundData.hasOwnProperty("playingInterval")) {
|
if (soundData.hasOwnProperty("playingInterval")) {
|
||||||
Script.clearInterval(soundData.playingInterval);
|
Script.clearInterval(soundData.playingInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue