Use tasty for tests, fix bug in circOnLine
This commit is contained in:
+7
-11
@@ -118,14 +118,13 @@ cleanupHalted s = do
|
||||
-----------------------------------------------------------------
|
||||
{- | Play sounds from a list of indices.
|
||||
For each index, the corresponding sound starts playing if there is a free channel.
|
||||
Use this if you don't care about timing, overlapping, fading, or sound positions.
|
||||
-}
|
||||
Use this if you don't care about timing, overlapping, fading, or sound positions. -}
|
||||
playSoundQueue :: IM.IntMap Mix.Chunk -> [Int] -> IO ()
|
||||
playSoundQueue chunkMap ns = forM_ ns $ \n -> runMaybeT $ playIfFree (chunkMap IM.! n) Mix.Once
|
||||
--playSoundQueue chunkMap ns = forM_ ns $ \n -> runMaybeT $ playIfFree (chunkMap IM.! n) Mix.Once
|
||||
playSoundQueue chunkMap = mapM_ $ \n -> runMaybeT $ playIfFree (chunkMap IM.! n) Mix.Once
|
||||
|
||||
{- | Given a chunk, attempt to play this on a free channel a given number of
|
||||
times. Returns 'Just' the channel if succeeds.
|
||||
-}
|
||||
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
|
||||
@@ -133,8 +132,7 @@ playIfFree c times = do
|
||||
|
||||
-----------------------------------------------------------------
|
||||
{- | Play sounds from a list of index/position pairs.
|
||||
As for 'playSoundQueue', but with positional information in the form of an Int16.
|
||||
-}
|
||||
As for 'playSoundQueue', but with positional information in the form of an Int16. -}
|
||||
playPositionalSoundQueue :: IM.IntMap Mix.Chunk -> [(Int,Int16)] -> IO ()
|
||||
playPositionalSoundQueue chunkMap = VS.mapM_ ( \(n,a) ->
|
||||
runMaybeT $ playIfFree (chunkMap IM.! n) Mix.Once >>= setChannelPos a )
|
||||
@@ -146,13 +144,11 @@ setChannelPos a i = do
|
||||
return i
|
||||
-----------------------------------------------------------------
|
||||
{- | Set the volume for all sound channels.
|
||||
Behind the scenes, scales a float [0,1] to an Int [0..128].
|
||||
-}
|
||||
Behind the scenes, scales a float [0,1] to an Int [0..128]. -}
|
||||
setSoundVolume :: Float -> IO ()
|
||||
setSoundVolume x = Mix.setVolume (round (x * 128)) Mix.AllChannels
|
||||
|
||||
{- | Set the music volume.
|
||||
Behind the scenes, scales a float [0,1] to an Int [0..128].
|
||||
-}
|
||||
Behind the scenes, scales a float [0,1] to an Int [0..128]. -}
|
||||
setMusicVolume :: Float -> IO ()
|
||||
setMusicVolume x = Mix.setMusicVolume (round (x * 128))
|
||||
|
||||
Reference in New Issue
Block a user