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: 콜백 정리