Commit before merge

This commit is contained in:
2021-04-07 18:26:16 +02:00
parent 9a86d03fae
commit 89a6eec561
2 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ resumeSound :: World -> World
resumeSound w = w resumeSound w = w
{-| Add a sound to the queue for playback. {-| Add a sound to the queue for playback.
Consider replacing with 'soundOncePos'. Consider replacing instances with 'soundOncePos'.
-} -}
soundOnce :: Int -> World -> World soundOnce :: Int -> World -> World
soundOnce i = over soundQueue ((:) (i,0)) soundOnce i = over soundQueue ((:) (i,0))
+8 -7
View File
@@ -32,17 +32,18 @@ then sounds in the merged Map are updated.
The Map of updated sound specifications is returned. The Map of updated sound specifications is returned.
New sounds with the same keys as New sounds with the same keys as
already playing sounds are merged in the following manner: already playing sounds are merged as follows:
* the '_soundChannel' is set to the old value * '_soundChannel' is set to the old value
* if the old '_soundStatus' was 'FadingOut', it is replaced with the new status (allowing playback to be restarted using 'ToStart') * if the old '_soundStatus' was 'FadingOut', it set to the new value (can restart playback with 'ToStart')
* all other fields are set to the new value. * other fields are set to the new value.
In the update: In the update:
1. sounds with a value 'ToStart' commence playing 1. commence playing sounds with 'ToStart' status
2. timers are decremented and any fading status is set 2. decrement timers, set any fading status
3. sounds that have stopped playing are removed from the map. 3. apply 'Just' sound position effects, set value to 'Nothing'
4. remove sounds that have stopped playing from the map.
-} -}
playAndUpdate :: Ord a => SoundData a -> M.Map a Sound -> IO (M.Map a Sound) playAndUpdate :: Ord a => SoundData a -> M.Map a Sound -> IO (M.Map a Sound)
playAndUpdate sData newSounds playAndUpdate sData newSounds