Add more positional sound

This commit is contained in:
2021-04-06 20:42:53 +02:00
parent be3c3339ec
commit 9a86d03fae
4 changed files with 20 additions and 13 deletions
+7 -3
View File
@@ -65,6 +65,7 @@ resumeSound :: World -> World
resumeSound w = w
{-| Add a sound to the queue for playback.
Consider replacing with 'soundOncePos'.
-}
soundOnce :: Int -> World -> World
soundOnce i = over soundQueue ((:) (i,0))
@@ -83,17 +84,19 @@ For each origin only one sound will play at a time.
soundOnceOrigin
:: Int -- ^ ID of the sound to be played
-> SoundOrigin -- ^ The \"creator\" of the sound
-> Point2 -- ^ The position of the sound in the world
-> World -> World
soundOnceOrigin sType so = over sounds (M.insertWith (flip const) so sound)
soundOnceOrigin sType so p w = over sounds (M.insertWith (flip const) so theSound) w
where
sound = Sound
theSound = Sound
{ _soundChunkID = sType
, _soundTime = Nothing
, _soundFadeTime = 0
, _soundStatus = ToStart
, _soundChannel = Nothing
, _soundPos = Nothing
, _soundPos = Just (a,0)
}
a = soundAngle p w
soundFromPos
:: SoundOrigin -- ^ \"Creator\" of sound
@@ -150,6 +153,7 @@ soundFrom so sType time fadeTime w = over sounds (M.insertWith f so sound) w
{-| Uses the first free origin from a list.
Does nothing if all origins are already creating sounds.
TODO: add positional information.
-}
soundMultiFrom
:: [SoundOrigin]