fix(audio): 백그라운드 시 SFX 미정지 + GameAudioController 메모리 누수 수정
Some checks failed
CI / analyze-and-test (push) Has been cancelled

- SfxChannelPool.stopAll() 추가: 모든 SFX 즉시 정지 + 대기열 비우기
- pauseAll()에서 SFX 풀도 정지하도록 변경
- game_play_screen dispose에서 _audioController.dispose() 호출 추가
This commit is contained in:
JiWoong Sul
2026-03-30 23:28:29 +09:00
parent e2a9032009
commit ea54b4c501
3 changed files with 20 additions and 0 deletions

View File

@@ -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)');
}

View File

@@ -195,6 +195,22 @@ class SfxChannelPool {
}
}
/// 모든 SFX 즉시 정지 및 대기열 비우기
Future<void> 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<void> dispose() async {
final players = _staticPlayers[name];

View File

@@ -248,6 +248,7 @@ class _GamePlayScreenState extends State<GamePlayScreen>
void dispose() {
_stateNotifier.dispose();
_notificationService.dispose();
_audioController.dispose();
WidgetsBinding.instance.removeObserver(this);
widget.controller.removeListener(_onControllerChanged);
widget.controller.onReturnRewardAvailable = null; // Phase 7: 콜백 정리