proteaaudio-0.7.0: Simple audio library for Windows, Linux, OSX.

Safe HaskellSafe
LanguageHaskell2010

Sound.ProteaAudio

Description

ProteaAudio is a stereo audio mixer/playback library for Linux (native ALSA, Jack, and OSS), Macintosh OS X (CoreAudio and Jack), and Windows (DirectSound and ASIO) operating systems.

Synopsis

Documentation

initAudio Source #

Arguments

:: Int

the maximum number of sounds that are played parallely. Computation time is linearly correlated to this factor.

-> Int

sample frequency of the playback in Hz. 22050 corresponds to FM radio 44100 is CD quality. Computation time is linearly correlated to this factor.

-> Int

the 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 Bool

returns True on success

finishAudio :: IO () Source #

releases the audio device and cleans up resources

loaderAvailable Source #

Arguments

:: String

file extension (e.g. ogg)

-> IO Bool 

checks if loader for this file type is available

volume Source #

Arguments

:: Float

left

-> Float

right

-> IO () 

set mixer volume

sampleFromMemoryWav Source #

Arguments

:: ByteString

wav sample data

-> Float

volume

-> IO Sample

return sample handle

loads wav sound sample from memory buffer

sampleFromMemoryOgg Source #

Arguments

:: ByteString

ogg sample data

-> Float

volume

-> IO Sample

return sample handle

loads ogg sound sample from memory buffer

sampleFromFile Source #

Arguments

:: String

sample filepath

-> Float

volume

-> IO Sample

returns handle

loads a sound sample from file

soundActive :: IO Int Source #

number of currently active sounds

soundStopAll :: IO () Source #

stops all sounds immediately

soundLoop Source #

Arguments

:: Sample

handle of a previously loaded sample

-> Float

left volume

-> Float

right volume

-> Float

time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right

-> Float

pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample

-> IO () 

plays a specified sound sample continuously and sets its parameters

soundPlay Source #

Arguments

:: Sample

handle of a previously loaded sample

-> Float

left volume

-> Float

right volume

-> Float

time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right

-> Float

pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample

-> IO () 

plays a specified sound sample once and sets its parameters

soundUpdate Source #

Arguments

:: Sample

handle of a currently active sound

-> Float

left volume

-> Float

right volume

-> Float

time difference between left and right channel in seconds. Use negative values to specify a delay for the left channel, positive for the right

-> Float

pitch factor for playback. 0.5 corresponds to one octave below, 2.0 to one above the original sample

-> IO Bool

return True in case the parameters have been updated successfully

updates parameters of a specified sound

soundStop :: Sample -> IO Bool Source #

stops a specified sound immediately

data Sample Source #

audio sample handle

initializes the audio system