pxt-ev3/sim/state/sounds.ts

29 lines
514 B
TypeScript
Raw Normal View History

2017-10-30 18:25:58 +01:00
namespace pxsim.music {
export function fromWAV(buf: RefBuffer) {
return incr(buf)
}
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()
}
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) {
return incr(buf)
}
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() {
pxsim.AudioContextManager.stop();
2017-12-14 01:31:42 +01:00
}
2017-10-30 18:25:58 +01:00
}