pulse-simple-0.1.11: binding to Simple API of pulseaudio

Portabilitynon-portable
Stabilityexperimental
Maintainerxanxys@gmail.com

Sound.Pulse.Simple

Description

Binding to PulseAudio Simple API

example(output 440Hz sine wave for 10 seconds):

  main=do
      s<-simpleNew Nothing "example" Play Nothing "this is example application"
          (SampleSpec (F32 LittleEndian) 44100 1) Nothing Nothing
      simpleWrite s [sin $ 2*pi*440*(t/44100)|t<-[1..44100*10]]
      simpleDrain s
      simpleFree s

Synopsis

Documentation

simpleNewSource

Arguments

:: Maybe String

server name

-> String

client name

-> Direction

Play or Record

-> Maybe String

name of sink or source

-> String

description of client

-> SampleSpec 
-> Maybe [ChannelPosition]

label channels

-> Maybe BufferAttr

buffer size, etc

-> IO Simple 

Establish connection to pulseaudio server. You usually don't need to specify optional fields.

simpleFree :: Simple -> IO ()Source

Close the connection.

simpleGetLatency :: Simple -> IO IntegerSource

Get current latency in microseconds.

simpleRead :: Storable a => Simple -> Int -> IO [a]Source

Read from buffer.

simpleReadRaw :: Simple -> Int -> IO ByteStringSource

Read raw data from buffer.

simpleWrite :: Storable a => Simple -> [a] -> IO ()Source

Write to buffer.

simpleWriteRaw :: Simple -> ByteString -> IO ()Source

Write raw data to buffer.

simpleDrain :: Simple -> IO ()Source

block until buffer is completely consumed

simpleFlush :: Simple -> IO ()Source

Flush playback buffer

data SampleSpec Source

Constructors

SampleSpec SampleFormat Int Int

format, sampling rate, #channels

Instances

data SampleFormat Source

Constructors

U8 Compression 
S16 Endian 
S24 Endian 
S2432 Endian

24 bit sample in 32 bit

S32 Endian 
F32 Endian 

Instances

data Compression Source

Constructors

Raw 
ALaw 
MuLaw 

data Endian Source

Constructors

BigEndian 
LittleEndian 

data Direction Source

Constructors

Play 
Record 

Instances

data BufferAttr Source

max length, target length, prebuffer, minimum request, fragment size

Constructors

BufferAttr (Maybe Int) (Maybe Int) (Maybe Int) (Maybe Int) (Maybe Int) 

Instances