Skip to content

Commit

Permalink
Revert "chore: 音声が一切鳴らなくなる可能性を軽減"
Browse files Browse the repository at this point in the history
This reverts commit 1dd7916.
  • Loading branch information
anatawa12 committed Nov 29, 2023
1 parent 7779c76 commit 7f26a79
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions packages/frontend/src/scripts/sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,13 @@ export function play(type: 'noteMy' | 'note' | 'antenna' | 'channel' | 'notifica
if (_DEV_) console.log('play', type, sound);
if (sound.type == null || !canPlay) return;

(async () => {
canPlay = false;
try {
await playFile(sound.type, sound.volume);
} finally {
// ごく短時間に音が重複しないように
setTimeout(() => {
canPlay = true;
}, 25);
}
})();
canPlay = false;
playFile(sound.type, sound.volume).then(() => {
// ごく短時間に音が重複しないように
setTimeout(() => {
canPlay = true;
}, 25);
});
}

export async function playFile(file: string, volume: number) {
Expand Down

0 comments on commit 7f26a79

Please sign in to comment.