Refactor event handling. Allow mouse movement in menus
This commit is contained in:
@@ -14,6 +14,9 @@ module Sound (
|
||||
, playPositionalSoundQueue
|
||||
-- * Complex Playback
|
||||
, playAndUpdate
|
||||
-- * Volume Control
|
||||
, setSoundVolume
|
||||
, setMusicVolume
|
||||
) where
|
||||
import Sound.Data
|
||||
|
||||
@@ -149,3 +152,18 @@ setChannelPos :: Int16 -> Mix.Channel -> MaybeT IO Mix.Channel
|
||||
setChannelPos a i = do
|
||||
liftIO $ Mix.effectPosition i a 0
|
||||
return i
|
||||
|
||||
|
||||
-----------------------------------------------------------------
|
||||
{- | Set the volume for all sound channels.
|
||||
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].
|
||||
-}
|
||||
setMusicVolume :: Float -> IO ()
|
||||
setMusicVolume x = Mix.setMusicVolume (round (x * 128))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user