Audio sample resource handle. A sample can be shared between multiple Sound tracks. (abstraction for data)
Moduleproteaaudio-sdl-0.10.1Haskell2010
Sound.ProteaAudio.SDL
ProteaAudio-SDL is a stereo audio mixer and playback library for SDL (platform independent)
- 2 types
- 20 values
- Packageproteaaudio-sdl-0.10.1
- Exports22
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceSDL.chs
Sample
2 declarationsSound track handle. It is used to control the audio playback. (abstraction for playback)
Audio System Setup
2 declarationsinitAudio :: Intthe maximum number of sounds that are played parallely, at most 1024. Computation time is linearly correlated to this factor.
-> Intsample frequency of the playback in Hz. 22050 corresponds to FM radio 44100 is CD quality. Computation time is linearly correlated to this factor.
-> Intthe number of bytes that are sent to the sound card at once. Low numbers lead to smaller latencies but need more computation time (thread switches). If a too small number is chosen, the sounds might not be played continuously. The default value 512 guarantees a good latency below 40 ms at 22050 Hz sample frequency.
-> IO Boolreturns True on success
Initializes the audio system.
Releases the audio device and cleans up resources.
Main Mixer
3 declarationsSet main mixer volume.
Return the number of currently active sounds.
Stops all sounds immediately.
Sample Loading
8 declarationsChecks if loader for this file type is available.
sampleFromMemoryPcm Loads raw linear pcm sound sample from memory buffer.
Loads wav sound sample from memory buffer.
Loads ogg sound sample from memory buffer.
Loads mp3 sound sample from memory buffer.
Loads wav, ogg or mp3 sound sample from memory buffer (autodetects audio format).
Loads a sound sample from file.
Unloads a previously loaded sample from memory, invalidating the handle.
Sample Playback
7 declarationssoundLoop :: Samplehandle of a previously loaded sample
-> Floatleft volume
-> Floatright volume
-> Floattime difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right
-> Floatpitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample
-> IO Sound
Plays a specified sound sample continuously any free channel and sets its parameters.
soundPlay :: Samplehandle of a previously loaded sample
-> Floatleft volume
-> Floatright volume
-> Floattime difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right
-> Floatpitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample
-> IO Sound
Plays a specified sound sample once any free channel and sets its parameters.
soundLoopOn :: Intnumber of the channel to use for playback with the first channel starting at 0
-> Samplehandle of a previously loaded sample
-> Floatleft volume
-> Floatright volume
-> Floattime difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right
-> Floatpitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample
-> IO Sound
Plays a specified sound sample continuously on a specific channel and sets its parameters.
soundPlayOn :: Intnumber of the channel to use for playback with the first channel starting at 0
-> Samplehandle of a previously loaded sample
-> Floatleft volume
-> Floatright volume
-> Floattime difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right
-> Floatpitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample
-> IO Sound
Plays a specified sound sample once on a specific channel and sets its parameters.
soundUpdate :: Soundhandle of a currently active sound (if sound has stopped, this is a no-op)
-> Boolis paused state, this does not change the sound active state
-> Floatleft volume
-> Floatright volume
-> Floattime difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right
-> Floatpitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample
-> IO Boolreturn True in case the parameters have been updated successfully
Updates parameters of a specified sound.
Stops a specified sound immediately.
Checks if a specified sound is still active.