Broken commit (removed loadKeyConfig)

This commit is contained in:
2021-08-27 11:58:11 +01:00
parent c4df048d31
commit 3ff04576ab
25 changed files with 122 additions and 200 deletions
+6 -8
View File
@@ -39,8 +39,8 @@ New sounds with the same keys as
already playing sounds are merged as follows:
* '_soundChannel' is set to the old value
* if the old '_soundStatus' was 'FadingOut', it is set to the new value (can restart playback with 'ToStart')
* other fields are set to the new value.
* if the old sound is not fading and the chunk is the same, '_soundStatus' is set to the old value
* all other values are set to the new values
In the update:
@@ -51,18 +51,16 @@ In the update:
-}
playAndUpdate :: Ord a => SoundData a -> M.Map a Sound -> IO (M.Map a Sound)
playAndUpdate sData newSounds
= updateSounds (_loadedChunks sData) (M.unionWith mergeSound newSounds (_playingSounds sData))
= updateSounds (_loadedChunks sData) (M.unionWith mergeSound (_playingSounds sData) newSounds)
mergeSound :: Sound -> Sound -> Sound
mergeSound newS oldS
| _soundStatus oldS == FadingOut
= newS & soundChannel .~ _soundChannel oldS
| _soundChunkID newS == _soundChunkID oldS
mergeSound oldS newS
| _soundChunkID newS == _soundChunkID oldS && _soundStatus oldS /= FadingOut
= newS & soundChannel .~ _soundChannel oldS
& soundStatus .~ _soundStatus oldS
| otherwise = newS & soundChannel .~ _soundChannel oldS
updateSounds :: Ord a => IM.IntMap Mix.Chunk -> M.Map a Sound -> IO (M.Map a Sound)
updateSounds :: IM.IntMap Mix.Chunk -> M.Map a Sound -> IO (M.Map a Sound)
updateSounds sd ss = do
may <- mapM (runMaybeT . updateSound sd) ss
return $ M.mapMaybe id may