Enable sounds in menus
This commit is contained in:
+3
-2
@@ -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
|
||||
|
||||
-----------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user