mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-09 19:37:30 -03:00
add thorium background music
This commit is contained in:
parent
6006fa5671
commit
9c0cc13b00
4 changed files with 17 additions and 24 deletions
14
src/components/neterror/resources/Tone.min.js
vendored
14
src/components/neterror/resources/Tone.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -15,16 +15,6 @@
|
|||
<script src="%ROOT_GEN_DIR%/components/neterror/resources/bundled/neterror.rollup.js"></script>
|
||||
</head>
|
||||
<body class="neterror" style="font-family: $i18n{fontfamily}; font-size: $i18n{fontsize}">
|
||||
<!-- <script src="Tone.min.js"></script>
|
||||
<script>
|
||||
var player = new Tone.Player("data:audio/ogg;base64,T2dnUwACAAAAAAAAAABJGgAAAAAAAOYZ".toMaster();
|
||||
// play as soon as the buffer is loaded
|
||||
player.autostart = false;
|
||||
player.loop = true;
|
||||
player.volume.value = -5;
|
||||
player.start;
|
||||
console.log('Audio is started.');
|
||||
</script> -->
|
||||
<div id="main-frame-error" class="interstitial-wrapper">
|
||||
<div id="main-content">
|
||||
<div class="icon"></div>
|
||||
|
@ -144,6 +134,7 @@
|
|||
<audio id="offline-sound-press" src="sounds/button-press.mp3"></audio>
|
||||
<audio id="offline-sound-hit" src="sounds/hit.mp3"></audio>
|
||||
<audio id="offline-sound-reached" src="sounds/score-reached.mp3"></audio>
|
||||
<audio id="offline-sound-background" src="sounds/perpetuum_factory_2.mp3"></audio>
|
||||
</template>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -232,6 +232,7 @@ Runner.sounds = {
|
|||
BUTTON_PRESS: 'offline-sound-press',
|
||||
HIT: 'offline-sound-hit',
|
||||
SCORE: 'offline-sound-reached',
|
||||
BACKGROUND: 'offline-sound-background',
|
||||
};
|
||||
|
||||
|
||||
|
@ -643,6 +644,7 @@ Runner.prototype = {
|
|||
this.containerEl.style.webkitAnimation = '';
|
||||
this.playCount++;
|
||||
this.generatedSoundFx.background();
|
||||
this.playSound(this.soundFx.BACKGROUND);
|
||||
|
||||
if (Runner.audioCues) {
|
||||
this.containerEl.setAttribute('title', getA11yString(A11Y_STRINGS.jump));
|
||||
|
@ -1268,6 +1270,7 @@ Runner.prototype = {
|
|||
*/
|
||||
gameOver() {
|
||||
this.playSound(this.soundFx.HIT);
|
||||
this.stopSound();
|
||||
vibrate(200);
|
||||
|
||||
this.stop();
|
||||
|
@ -1446,6 +1449,19 @@ Runner.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Stop a sound.
|
||||
* @param {AudioBuffer} soundBuffer
|
||||
*/
|
||||
stopSound(soundBuffer) {
|
||||
if (soundBuffer) {
|
||||
const sourceNode = this.audioContext.createBufferSource();
|
||||
sourceNode.buffer = soundBuffer;
|
||||
sourceNode.connect(this.audioContext.destination);
|
||||
sourceNode.stop();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Inverts the current page / canvas colors.
|
||||
* @param {boolean} reset Whether to reset colors.
|
||||
|
|
BIN
src/components/neterror/resources/sounds/perpetuum_factory_2.mp3
Normal file
BIN
src/components/neterror/resources/sounds/perpetuum_factory_2.mp3
Normal file
Binary file not shown.
Loading…
Reference in a new issue