diff --git a/CHANGELOG.md b/CHANGELOG.md index dc41767849db..900e0afb158d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - Fix: ウィジェットのジョブキューにて音声の発音方法変更に追従できていなかったのを修正 #12367 - Fix: コードエディタが正しく表示されない問題を修正 - Fix: プロフィールの「ファイル」にセンシティブな画像がある際のデザインを修正 +- Fix: 一度に大量の通知が入った際に通知音が音割れする問題を修正 ### Server - Enhance: MFM `$[ruby ]` が他ソフトウェアと連合されるように diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index 3dbe7bb3b47d..59f82d932249 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -8,6 +8,7 @@ import * as os from '@/os.js'; const ctx = new AudioContext(); const cache = new Map(); +let canPlay = true; export const soundsTypes = [ null, @@ -71,7 +72,7 @@ export const operationTypes = [ 'antenna', 'channel', 'notification', - 'reaction', + 'reaction', ] as const; export type SoundType = typeof soundsTypes[number]; @@ -134,16 +135,22 @@ export async function loadAudio(options: { soundType: SoundType, fileId?: string return audioBuffer; } - export function play(type: OperationType) { const sound = defaultStore.state[`sound_${type}`]; if (_DEV_) console.log('play', type, sound); - if (sound.type == null) return; + if (sound.type == null || !canPlay) return; + + canPlay = false; playFile({ soundType: sound.type, fileId: sound.fileId, fileUrl: sound.fileUrl, volume: sound.volume, + }).then(() => { + // ごく短時間に音が重複しないように + setTimeout(() => { + canPlay = true; + }, 25); }); }