Skip to content

Commit 290f97a

Browse files
authored
!hotfix: apply volume control to background musics (#60)
Hotfix: 볼륨조절이 배경음악에 적용되지 않던 문제 해결하였습니다. 변경내용: SoundManager.setVolume()에서 Bgm이 관리되는 soundClip에도 볼륨설정이 적용되도록 코드 추가. CSE2024SDP-237
1 parent c8504ab commit 290f97a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/engine/SoundManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ private void setVolume(int volume) {
185185
}
186186
}
187187
}
188+
// Apply to soundClips (including background music)
189+
for (Clip clip : soundClips.values()) {
190+
try {
191+
FloatControl volumeControl =
192+
(FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
193+
volumeControl.setValue(newVolume);
194+
} catch (IllegalArgumentException e) {
195+
logger.warning("Failed to set volume: " + e.getMessage());
196+
}
197+
}
198+
188199
}
189200

190201
/**

0 commit comments

Comments
 (0)