From ea54b4c5010ec1acf963c7a0a4612e7670224265 Mon Sep 17 00:00:00 2001 From: JiWoong Sul Date: Mon, 30 Mar 2026 23:28:29 +0900 Subject: [PATCH] =?UTF-8?q?fix(audio):=20=EB=B0=B1=EA=B7=B8=EB=9D=BC?= =?UTF-8?q?=EC=9A=B4=EB=93=9C=20=EC=8B=9C=20SFX=20=EB=AF=B8=EC=A0=95?= =?UTF-8?q?=EC=A7=80=20+=20GameAudioController=20=EB=A9=94=EB=AA=A8?= =?UTF-8?q?=EB=A6=AC=20=EB=88=84=EC=88=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SfxChannelPool.stopAll() 추가: 모든 SFX 즉시 정지 + 대기열 비우기 - pauseAll()에서 SFX 풀도 정지하도록 변경 - game_play_screen dispose에서 _audioController.dispose() 호출 추가 --- lib/src/core/audio/audio_service.dart | 3 +++ lib/src/core/audio/sfx_channel_pool.dart | 16 ++++++++++++++++ lib/src/features/game/game_play_screen.dart | 1 + 3 files changed, 20 insertions(+) diff --git a/lib/src/core/audio/audio_service.dart b/lib/src/core/audio/audio_service.dart index 0903f1c..3c8d7a3 100644 --- a/lib/src/core/audio/audio_service.dart +++ b/lib/src/core/audio/audio_service.dart @@ -364,6 +364,9 @@ class AudioService { try { await _staticBgmPlayer?.stop(); } catch (_) {} + // SFX도 즉시 정지 + await _playerSfxPool?.stopAll(); + await _monsterSfxPool?.stopAll(); _currentBgm = null; debugPrint('[AudioService] All audio paused (was playing: $_pausedBgm)'); } diff --git a/lib/src/core/audio/sfx_channel_pool.dart b/lib/src/core/audio/sfx_channel_pool.dart index 95e10c9..2023812 100644 --- a/lib/src/core/audio/sfx_channel_pool.dart +++ b/lib/src/core/audio/sfx_channel_pool.dart @@ -195,6 +195,22 @@ class SfxChannelPool { } } + /// 모든 SFX 즉시 정지 및 대기열 비우기 + Future stopAll() async { + _pendingQueue.clear(); + final players = _staticPlayers[name]; + final busy = _staticBusy[name]; + if (players == null) return; + for (var i = 0; i < players.length; i++) { + try { + await players[i].stop(); + } catch (_) {} + if (busy != null && i < busy.length) { + busy[i] = false; + } + } + } + /// 리소스 해제 Future dispose() async { final players = _staticPlayers[name]; diff --git a/lib/src/features/game/game_play_screen.dart b/lib/src/features/game/game_play_screen.dart index 264e7b4..8142a6c 100644 --- a/lib/src/features/game/game_play_screen.dart +++ b/lib/src/features/game/game_play_screen.dart @@ -248,6 +248,7 @@ class _GamePlayScreenState extends State void dispose() { _stateNotifier.dispose(); _notificationService.dispose(); + _audioController.dispose(); WidgetsBinding.instance.removeObserver(this); widget.controller.removeListener(_onControllerChanged); widget.controller.onReturnRewardAvailable = null; // Phase 7: 콜백 정리