Pause and resume sounds when pausing game
This commit is contained in:
+2
-2
@@ -96,7 +96,7 @@ tryPlay sd s = do
|
||||
tryGetChannel :: Sound -> MaybeT IO Mix.Channel
|
||||
tryGetChannel s = case _soundChannel s of
|
||||
Just i -> return i
|
||||
Nothing -> MaybeT $ Mix.getAvailable Mix.DefaultGroup
|
||||
Nothing -> MaybeT $ Mix.getAvailable 0 -- 0 refers to the group for game sounds
|
||||
|
||||
decrementTimer :: Sound -> IO Sound
|
||||
decrementTimer s = case _soundTime s of
|
||||
@@ -135,7 +135,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 Mix.DefaultGroup
|
||||
i <- MaybeT $ Mix.getAvailable 0 -- 0 refers to the group for game sounds
|
||||
liftIO $ Mix.playOn i times c
|
||||
|
||||
-----------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user