Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | xanxys@gmail.com |
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
- simpleNew :: Maybe String -> String -> Direction -> Maybe String -> String -> SampleSpec -> Maybe [ChannelPosition] -> Maybe BufferAttr -> IO Simple
- simpleFree :: Simple -> IO ()
- simpleGetLatency :: Simple -> IO Integer
- simpleRead :: Storable a => Simple -> Int -> IO [a]
- simpleReadRaw :: Simple -> Int -> IO ByteString
- simpleWrite :: Storable a => Simple -> [a] -> IO ()
- simpleWriteRaw :: Simple -> ByteString -> IO ()
- simpleDrain :: Simple -> IO ()
- simpleFlush :: Simple -> IO ()
- data Simple
- data SampleSpec = SampleSpec SampleFormat Int Int
- data SampleFormat
- data Compression
- data Endian
- data Direction
- data ChannelPosition
- = ChannelMono
- | ChannelNormal ChannelPan
- | ChannelFront ChannelPan
- | ChannelRear ChannelPan
- | ChannelTopRear ChannelPan
- | ChannelTopFront ChannelPan
- | ChannelLFE
- | ChannelSubwoofer
- | ChannelFrontCenterLeft
- | ChannelFrontCenterRight
- | ChannelSideLeft
- | ChannelSideRight
- | ChannelTopCenter
- | ChannelAux Int
- data ChannelPan
- data BufferAttr = BufferAttr (Maybe Int) (Maybe Int) (Maybe Int) (Maybe Int) (Maybe Int)
Documentation
:: 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.
simpleReadRaw :: Simple -> Int -> IO ByteStringSource
Read raw data from 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
SampleSpec SampleFormat Int Int | format, sampling rate, #channels |
data SampleFormat Source
data Compression Source
data ChannelPosition Source
ChannelMono | |
ChannelNormal ChannelPan | |
ChannelFront ChannelPan | |
ChannelRear ChannelPan | |
ChannelTopRear ChannelPan | |
ChannelTopFront ChannelPan | |
ChannelLFE | low frequency effects |
ChannelSubwoofer | |
ChannelFrontCenterLeft | equivalent to PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER |
ChannelFrontCenterRight | |
ChannelSideLeft | |
ChannelSideRight | |
ChannelTopCenter | |
ChannelAux Int |
data BufferAttr Source
max length, target length, prebuffer, minimum request, fragment size