Safe Haskell | None |
---|---|
Language | Haskell98 |
- module SFML.Utils
- soundBufferFromFile :: FilePath -> IO (Either SFException SoundBuffer)
- soundBufferFromMemory :: Ptr a -> Int -> IO (Either SFException SoundBuffer)
- soundBufferFromStream :: InputStream -> IO (Either SFException SoundBuffer)
- soundBufferFromSamples :: Ptr a -> Int -> Int -> Int -> IO (Maybe SoundBuffer)
- copySoundBuffer :: SoundBuffer -> IO SoundBuffer
- destroy :: SFResource a => a -> IO ()
- saveSoundBufferToFile :: SoundBuffer -> FilePath -> IO Bool
- getSamples :: SoundBuffer -> IO (Ptr a)
- getSampleCount :: SoundBuffer -> IO Int
- getSampleRate :: SFSampled a => a -> IO Int
- getChannelCount :: SFSoundBuffer a => a -> IO Int
- getDuration :: SFSoundBuffer a => a -> IO Time
Documentation
module SFML.Utils
soundBufferFromFile :: FilePath -> IO (Either SFException SoundBuffer) Source
Create a new sound buffer and load it from a file.
Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
:: Ptr a | Pointer to the file data in memory |
-> Int | Size of the data to load, in bytes |
-> IO (Either SFException SoundBuffer) | A new sfSoundBuffer object ( |
Create a new sound buffer and load it from a file in memory.
Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
:: InputStream | |
-> IO (Either SFException SoundBuffer) | A new sfSoundBuffer object ( |
Create a new sound buffer and load it from a custom stream.
Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
:: Ptr a | Pointer to the array of samples in memory |
-> Int | Number of samples in the array |
-> Int | Number of channels (1 = mono, 2 = stereo, ...) |
-> Int | Sample rate (number of samples to play per second) |
-> IO (Maybe SoundBuffer) | A new sfSoundBuffer object ( |
Create a new sound buffer and load it from an array of samples in memory.
The assumed format of the audio samples is 16 bits signed integer (sfInt16).
copySoundBuffer :: SoundBuffer -> IO SoundBuffer Source
Create a new sound buffer by copying an existing one.
destroy :: SFResource a => a -> IO () Source
Destroy the given SFML resource.
:: SoundBuffer | |
-> FilePath | Path of the sound file to write |
-> IO Bool |
Save a sound buffer to an audio file.
Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.
:: SoundBuffer | |
-> IO (Ptr a) | Read-only pointer to the array of sound samples |
Get the array of audio samples stored in a sound buffer.
The format of the returned samples is 16 bits signed integer
(sfInt16). The total number of samples in this array
is given by the getSampleCount
function.
getSampleCount :: SoundBuffer -> IO Int Source
Get the number of samples stored in a sound buffer.
The array of samples can be accessed with the sfSoundBuffer_getSamples function.
getSampleRate :: SFSampled a => a -> IO Int Source
Get the sample rate of a sound buffer.
The sample rate is the number of samples played per second. The higher, the better the quality (for example, 44100 samples/s is CD quality).
getChannelCount :: SFSoundBuffer a => a -> IO Int Source
Get the number of channels used by a sound buffer.
If the sound is mono then the number of channels will be 1, 2 for stereo, etc.
getDuration :: SFSoundBuffer a => a -> IO Time Source
Get the total duration of a sound buffer.