mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-10 06:27:13 +08:00
Disable audio until bugs and hosting can be worked out
This commit is contained in:
@@ -9,8 +9,18 @@ var AudioEngine = {
|
|||||||
_currentBackgroundMusic: null,
|
_currentBackgroundMusic: null,
|
||||||
_currentEventAudio: null,
|
_currentEventAudio: null,
|
||||||
_currentSoundEffectAudio: null,
|
_currentSoundEffectAudio: null,
|
||||||
|
_initialized: false,
|
||||||
init: function () {
|
init: function () {
|
||||||
AudioEngine._initAudioContext();
|
AudioEngine._initAudioContext();
|
||||||
|
// start loading music and events early
|
||||||
|
for (var key in AudioLibrary) {
|
||||||
|
if (
|
||||||
|
key.toString().indexOf('MUSIC_') > -1 ||
|
||||||
|
key.toString().indexOf('EVENT_') > -1) {
|
||||||
|
AudioEngine.loadAudioFile(AudioLibrary[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AudioEngine._initialized = true;
|
||||||
},
|
},
|
||||||
_initAudioContext: function () {
|
_initAudioContext: function () {
|
||||||
AudioEngine._audioContext = new (window.AudioContext || window.webkitAudioContext);
|
AudioEngine._audioContext = new (window.AudioContext || window.webkitAudioContext);
|
||||||
@@ -152,21 +162,33 @@ var AudioEngine = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
playBackgroundMusic: function (src) {
|
playBackgroundMusic: function (src) {
|
||||||
|
if (!AudioEngine._initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AudioEngine.loadAudioFile(src)
|
AudioEngine.loadAudioFile(src)
|
||||||
.then(function (buffer) {
|
.then(function (buffer) {
|
||||||
AudioEngine._playBackgroundMusic(buffer);
|
AudioEngine._playBackgroundMusic(buffer);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
playEventMusic: function (src) {
|
playEventMusic: function (src) {
|
||||||
|
if (!AudioEngine._initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AudioEngine.loadAudioFile(src)
|
AudioEngine.loadAudioFile(src)
|
||||||
.then(function (buffer) {
|
.then(function (buffer) {
|
||||||
AudioEngine._playEventMusic(buffer);
|
AudioEngine._playEventMusic(buffer);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
stopEventMusic: function () {
|
stopEventMusic: function () {
|
||||||
|
if (!AudioEngine._initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AudioEngine._stopEventMusic();
|
AudioEngine._stopEventMusic();
|
||||||
},
|
},
|
||||||
playSound: function (src) {
|
playSound: function (src) {
|
||||||
|
if (!AudioEngine._initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AudioEngine.loadAudioFile(src)
|
AudioEngine.loadAudioFile(src)
|
||||||
.then(function (buffer) {
|
.then(function (buffer) {
|
||||||
AudioEngine._playSound(buffer);
|
AudioEngine._playSound(buffer);
|
||||||
|
|||||||
+14
-20
@@ -104,15 +104,6 @@
|
|||||||
Engine.loadGame();
|
Engine.loadGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
// start loading music and events early
|
|
||||||
for (var key in AudioLibrary) {
|
|
||||||
if (
|
|
||||||
key.toString().indexOf('MUSIC_') > -1 ||
|
|
||||||
key.toString().indexOf('EVENT_') > -1) {
|
|
||||||
AudioEngine.loadAudioFile(AudioLibrary[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$('<div>').attr('id', 'locationSlider').appendTo('#main');
|
$('<div>').attr('id', 'locationSlider').appendTo('#main');
|
||||||
|
|
||||||
var menu = $('<div>')
|
var menu = $('<div>')
|
||||||
@@ -142,11 +133,12 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('<span>')
|
// Disable this for now
|
||||||
.addClass('volume menuBtn')
|
// $('<span>')
|
||||||
.text(_('sound on.'))
|
// .addClass('volume menuBtn')
|
||||||
.click(() => Engine.toggleVolume())
|
// .text(_('sound on.'))
|
||||||
.appendTo(menu);
|
// .click(() => Engine.toggleVolume())
|
||||||
|
// .appendTo(menu);
|
||||||
|
|
||||||
$('<span>')
|
$('<span>')
|
||||||
.addClass('appStore menuBtn')
|
.addClass('appStore menuBtn')
|
||||||
@@ -215,7 +207,7 @@
|
|||||||
$.Dispatch('stateUpdate').subscribe(Engine.handleStateUpdates);
|
$.Dispatch('stateUpdate').subscribe(Engine.handleStateUpdates);
|
||||||
|
|
||||||
$SM.init();
|
$SM.init();
|
||||||
AudioEngine.init();
|
// AudioEngine.init(); Disable this for now
|
||||||
Notifications.init();
|
Notifications.init();
|
||||||
Events.init();
|
Events.init();
|
||||||
Room.init();
|
Room.init();
|
||||||
@@ -239,15 +231,17 @@
|
|||||||
Engine.triggerHyperMode();
|
Engine.triggerHyperMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine.toggleVolume(Boolean($SM.get('config.soundOn')));
|
// Disable this for now
|
||||||
if(!AudioEngine.isAudioContextRunning()){
|
// Engine.toggleVolume(Boolean($SM.get('config.soundOn')));
|
||||||
document.addEventListener('click', Engine.resumeAudioContext, true);
|
// if(!AudioEngine.isAudioContextRunning()){
|
||||||
}
|
// document.addEventListener('click', Engine.resumeAudioContext, true);
|
||||||
|
// }
|
||||||
|
|
||||||
Engine.saveLanguage();
|
Engine.saveLanguage();
|
||||||
Engine.travelTo(Room);
|
Engine.travelTo(Room);
|
||||||
|
|
||||||
setTimeout(notifyAboutSound, 3000);
|
// Disable this for now
|
||||||
|
// setTimeout(notifyAboutSound, 3000);
|
||||||
|
|
||||||
},
|
},
|
||||||
resumeAudioContext: function () {
|
resumeAudioContext: function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user