Add support for one time sounds, crashes if more than 8 play at once

This commit is contained in:
2021-02-23 15:50:02 +01:00
parent c188512abb
commit 93ab10e77e
4 changed files with 107 additions and 6 deletions
+8 -2
View File
@@ -1,7 +1,13 @@
module Sound
where
import Sound.Preload
-- ok, the problem here is that we need to be able to return the playing channel
-- so this thread cannot be a simple observer
import Control.Monad
import qualified SDL.Mixer as Mix
import qualified Data.IntMap as IM
playSoundQueue :: SoundData -> [Int] -> IO ()
playSoundQueue sd ns =
forM_ ns $ \n -> Mix.play (sd IM.! n)