Safe Haskell | None |
---|
Sound.SFML
Contents
- data PolySound
- newPolySound :: FilePath -> Int -> IO PolySound
- freePolySound :: PolySound -> IO ()
- triggerPolySound :: PolySound -> Maybe Float -> IO ()
- data LoopedSound
- newLoopedSound :: FilePath -> IO LoopedSound
- freeLoopedSound :: LoopedSound -> IO ()
- startLoopedSound :: Maybe Float -> LoopedSound -> IO ()
- stopLoopedSound :: LoopedSound -> IO ()
- playMusic :: FilePath -> Maybe Float -> IO ()
- playMusicLooped :: FilePath -> Maybe Float -> IO ()
- stopMusic :: IO ()
- pauseMusic :: IO ()
PolySounds
A PolySound allows you to trigger one sound multiple times. The played sounds will then overlap. (Internally, there will be multiple sound instances, that will be triggered one after the other. If there are not enough internal instances, sounds will be cut.)
Loads a sound into memory.
freePolySound :: PolySound -> IO ()Source
Frees the memory allocated by a sound. Don't use the PolySound afterwards.
LoopedSounds
data LoopedSound Source
LoopedSounds are sounds that will always loop. They can just be switched on and off.
Instances
newLoopedSound :: FilePath -> IO LoopedSoundSource
Loads a sound into memory.
freeLoopedSound :: LoopedSound -> IO ()Source
Releases the allocated memory of a LoopedSound. Don't use the LoopedSound afterwards.
startLoopedSound :: Maybe Float -> LoopedSound -> IO ()Source
Starts a looped sound.
stopLoopedSound :: LoopedSound -> IO ()Source
Stops a looped sound.
background music
playMusic :: FilePath -> Maybe Float -> IO ()Source
Loads and plays a music file once in a background thread. Stops other music that is playing. If the current music is Paused and the given file is the same as the one playing, the music is continued. The volume is set again in any case.
pauseMusic :: IO ()Source
Pauses the current music.