Enable sounds in menus

This commit is contained in:
2025-06-03 08:51:34 +01:00
parent 695cf3c5fd
commit e952f2abea
8 changed files with 348 additions and 326 deletions
+3 -2
View File
@@ -51,7 +51,8 @@ In the update:
3. apply 'Just' sound position effects, set value to 'Nothing'
4. remove sounds that have stopped playing from the map.
-}
playSoundAndUpdate :: Ord a => SoundData -> M.Map a Sound -> M.Map a Sound -> IO (M.Map a Sound)
playSoundAndUpdate
:: Ord a => SoundData -> M.Map a Sound -> M.Map a Sound -> IO (M.Map a Sound)
playSoundAndUpdate sData oldSounds newSounds
= updateSounds (_loadedChunks sData) (M.unionWith mergeSound oldSounds newSounds)
@@ -135,7 +136,7 @@ playSoundQueue chunkMap = mapM_ $ \n -> runMaybeT $ playIfFree (chunkMap IM.! n)
times. Returns 'Just' the channel if succeeds. -}
playIfFree :: Mix.Chunk -> Mix.Times -> MaybeT IO Mix.Channel
playIfFree c times = do
i <- MaybeT $ Mix.getAvailable 0 -- 0 refers to the group for game sounds
i <- MaybeT $ Mix.getAvailable Mix.DefaultGroup -- try all channels
liftIO $ Mix.playOn i times c
-----------------------------------------------------------------