SFML-2.3.2.2: SFML bindings

Safe HaskellNone
LanguageHaskell98

SFML.Audio.SoundBuffer

Synopsis

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.

soundBufferFromMemory Source

Arguments

:: 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 (Nothing if failed)

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.

soundBufferFromStream Source

Arguments

:: InputStream 
-> IO (Either SFException SoundBuffer)

A new sfSoundBuffer object (Nothing if failed)

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.

soundBufferFromSamples Source

Arguments

:: 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 (Nothing if failed)

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.

saveSoundBufferToFile Source

Arguments

:: SoundBuffer 
-> FilePath

Path of the sound file to write

-> IO Bool

True if saving succeeded, False if it failed

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.

getSamples Source

Arguments

:: 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.