Pause and resume sounds when pausing game

This commit is contained in:
2025-06-02 12:43:37 +01:00
parent 6706ac494a
commit 1851dcc5d6
8 changed files with 74 additions and 63 deletions
+6
View File
@@ -13,9 +13,15 @@ loadSound (i,s) = do
chnk <- Mix.load $ "./data/sound/" ++ s
return (i,chnk)
-- current thinking is to use group 0 for game sounds, group 1 for menu sounds
loadSounds :: IO (IM.IntMap Mix.Chunk)
loadSounds = do
Mix.openAudio Mix.defaultAudio 128
Mix.setChannels 32
x <- Mix.groupSpan 0 0 29
putStrLn $ show x <> " channels assigned to group 0"
y <- Mix.groupSpan 1 30 31
putStrLn $ show y <> " channels assigned to group 1"
fmap IM.fromList $ mapM loadSound $ zip [0..] soundPathList
loadMusic :: IO (IM.IntMap Mix.Music)