35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
#include audio/context.js
|
|
#include sound/sndmgr.js
|
|
#include sound/sndlibrary.js
|
|
#include sound/sndpacks.js
|
|
|
|
const MamiSoundContext = function() {
|
|
const audioCtx = new MamiAudioContext;
|
|
const manager = new MamiSoundManager(audioCtx);
|
|
const library = new MamiSoundLibrary(manager);
|
|
const packs = new MamiSoundPacks;
|
|
let pack = new MamiSoundPack;
|
|
|
|
return {
|
|
get audio() { return audioCtx; },
|
|
get manager() { return manager; },
|
|
get library() { return library; },
|
|
get packs() { return packs; },
|
|
|
|
get pack() { return pack; },
|
|
set pack(value) {
|
|
if(typeof value !== 'object' || typeof value.getEventSound !== 'function')
|
|
throw 'value is not a valid soundpack';
|
|
pack = value;
|
|
},
|
|
|
|
get ready() { return audioCtx.isReady; },
|
|
get volume() { return audioCtx.getVolume(); },
|
|
set volume(value) { audioCtx.setVolume(value); },
|
|
get muted() { return audioCtx.isMuted; },
|
|
set muted(value) { audioCtx.setMuted(value); },
|
|
|
|
reset: audioCtx.reset,
|
|
};
|
|
};
|