feat:实验性功能:音效消抖,效果待测试
This commit is contained in:
parent
87bd805767
commit
79c82025ee
@ -3096,10 +3096,17 @@ control.prototype.triggerBgm = function () {
|
|||||||
core.setLocalStorage('bgmStatus', core.musicStatus.bgmStatus);
|
core.setLocalStorage('bgmStatus', core.musicStatus.bgmStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let playingSoundList = [];
|
||||||
|
|
||||||
////// 播放音频 //////
|
////// 播放音频 //////
|
||||||
control.prototype.playSound = function (sound, pitch, callback) {
|
control.prototype.playSound = function (sound, pitch, inputCallback) {
|
||||||
sound = core.getMappedName(sound);
|
sound = core.getMappedName(sound);
|
||||||
if (main.mode != 'play' || !core.musicStatus.soundStatus || !core.material.sounds[sound]) return;
|
if (main.mode != 'play' || !core.musicStatus.soundStatus || !core.material.sounds[sound] || playingSoundList.includes(sound)) return;
|
||||||
|
playingSoundList.push(sound);
|
||||||
|
const callback = () => {
|
||||||
|
playingSoundList = playingSoundList.filter((soundName) => soundName !== sound);
|
||||||
|
inputCallback();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (core.musicStatus.audioContext != null) {
|
if (core.musicStatus.audioContext != null) {
|
||||||
var source = core.musicStatus.audioContext.createBufferSource();
|
var source = core.musicStatus.audioContext.createBufferSource();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user