2017-10-30 18:25:58 +01:00
|
|
|
|
|
|
|
namespace pxsim.music {
|
|
|
|
export function fromWAV(buf: RefBuffer) {
|
2019-10-09 06:57:55 +02:00
|
|
|
return buf
|
2017-10-30 18:25:58 +01:00
|
|
|
}
|
2017-12-14 01:31:42 +01:00
|
|
|
|
2017-12-15 19:42:44 +01:00
|
|
|
export function stopAllSounds() {
|
2017-12-14 01:31:42 +01:00
|
|
|
SoundMethods.stop()
|
|
|
|
}
|
2020-09-09 21:06:33 +02:00
|
|
|
|
|
|
|
pxsim.music.setVolume = (volume: number): void => {
|
|
|
|
pxsim.getAudioState().volume = volume;
|
|
|
|
};
|
|
|
|
|
|
|
|
export function volume() {
|
|
|
|
return pxsim.getAudioState().volume;
|
|
|
|
}
|
2017-10-30 18:25:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace pxsim.SoundMethods {
|
2017-12-14 01:31:42 +01:00
|
|
|
let audio: HTMLAudioElement;
|
2017-10-30 18:25:58 +01:00
|
|
|
|
|
|
|
export function buffer(buf: RefBuffer) {
|
2019-10-09 06:57:55 +02:00
|
|
|
return buf
|
2017-10-30 18:25:58 +01:00
|
|
|
}
|
|
|
|
|
2018-01-18 22:53:33 +01:00
|
|
|
export function play(buf: RefBuffer) {
|
|
|
|
return pxsim.AudioContextManager.playBufferAsync(buf);
|
2017-10-30 18:25:58 +01:00
|
|
|
}
|
2017-12-14 01:31:42 +01:00
|
|
|
|
|
|
|
export function stop() {
|
2018-04-18 07:16:19 +02:00
|
|
|
pxsim.AudioContextManager.stop();
|
2017-12-14 01:31:42 +01:00
|
|
|
}
|
|
|
|
|
2017-10-30 18:25:58 +01:00
|
|
|
}
|
|
|
|
|