Add some sound functionality

This commit is contained in:
2021-11-05 14:28:01 +01:00
parent dd066f0aa3
commit c5a4167846
32 changed files with 187 additions and 30 deletions

18
src/engine/sound.js Normal file
View File

@@ -0,0 +1,18 @@
import Resonator from '../framework/resonator';
export default class Sound {
constructor() {
this.res = new Resonator();
this.res.setEnvironmentImpulse(`assets/Greek7EchoHall.wav`);
this.ambience = null;
this.music = null;
this.previousAmbience = null;
this.previousMusic = null;
}
play(file) {
const sound = this.res.loadImmediate(file);
sound.play();
}
}