-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | binding to Simple API of pulseaudio -- -- Binding to simple version of client API for the pulseaudio -- soundserver. Although it does not provide advanced features and some -- not-so-adavanced features like volume control, it should be enough for -- simple applications. Confirmed to work on linux(both 32 bit and 64 -- bit) with ghc 6.8 or 6.10. @package pulse-simple @version 0.1.13 -- | Binding to PulseAudio Simple API (original documentation: -- http://0pointer.de/lennart/projects/pulseaudio/doxygen/simple_8h.html) -- -- playback example(output 440Hz sine wave for 10 seconds): -- --
-- main=do -- s<-simpleNew Nothing "example" Play Nothing "this is an example application" -- (SampleSpec (F32 LittleEndian) 44100 1) Nothing Nothing -- simpleWrite s ([sin $ 2*pi*440*(t/44100)|t<-[1..44100*10]] :: [Float]) -- simpleDrain s -- simpleFree s ---- -- recording example(record for 10 seconds): -- --
-- main=do -- s<-simpleNew Nothing "example" Record Nothing "this is an example application" -- (SampleSpec (F32 LittleEndian) 44100 1) Nothing Nothing -- xs<-simpleRead s $ 44100*10 :: IO [Float] -- simpleFree s ---- -- Note that recording starts when simpleNew is called. module Sound.Pulse.Simple -- | Establish connection to pulseaudio server. You usually don't need to -- specify optional fields. simpleNew :: Maybe String -> String -> Direction -> Maybe String -> String -> SampleSpec -> Maybe [ChannelPosition] -> Maybe BufferAttr -> IO Simple -- | Close the connection. simpleFree :: Simple -> IO () -- | Get current latency in microseconds. simpleGetLatency :: Simple -> IO Integer -- | Read from buffer. (non-blocking if specified # of samples already -- exist in the internal buffer) simpleRead :: Storable a => Simple -> Int -> IO [a] -- | Read raw data from buffer. simpleReadRaw :: Simple -> Int -> IO ByteString -- | Write to buffer. (blocks until buffer is almost consumed) simpleWrite :: Storable a => Simple -> [a] -> IO () -- | Write raw data to buffer. simpleWriteRaw :: Simple -> ByteString -> IO () -- | Block until playback buffer is completely consumed. simpleDrain :: Simple -> IO () -- | Flush playback buffer. simpleFlush :: Simple -> IO () data Simple data SampleSpec -- | format, sampling rate, #channels SampleSpec :: SampleFormat -> Int -> Int -> SampleSpec data SampleFormat -- | 8 bit unsigned (optionally compressed using Compression) U8 :: Compression -> SampleFormat -- | 16 bit signed S16 :: Endian -> SampleFormat -- | 24 bit signed S24 :: Endian -> SampleFormat -- | 24 bit signed padded to 32 bit S2432 :: Endian -> SampleFormat -- | 32 bit signed S32 :: Endian -> SampleFormat -- | 32 bit float in [-1,1] F32 :: Endian -> SampleFormat data Compression Raw :: Compression ALaw :: Compression MuLaw :: Compression data Endian BigEndian :: Endian LittleEndian :: Endian data Direction Play :: Direction Record :: Direction data ChannelPosition ChannelMono :: ChannelPosition ChannelNormal :: ChannelPan -> ChannelPosition ChannelFront :: ChannelPan -> ChannelPosition ChannelRear :: ChannelPan -> ChannelPosition ChannelTopRear :: ChannelPan -> ChannelPosition ChannelTopFront :: ChannelPan -> ChannelPosition -- | low frequency effects ChannelLFE :: ChannelPosition ChannelSubwoofer :: ChannelPosition -- | equivalent to PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER ChannelFrontCenterLeft :: ChannelPosition ChannelFrontCenterRight :: ChannelPosition ChannelSideLeft :: ChannelPosition ChannelSideRight :: ChannelPosition ChannelTopCenter :: ChannelPosition ChannelAux :: Int -> ChannelPosition data ChannelPan PanLeft :: ChannelPan PanRight :: ChannelPan PanCenter :: ChannelPan -- | max length, target length, prebuffer, minimum request, fragment size data BufferAttr BufferAttr :: (Maybe Int) -> (Maybe Int) -> (Maybe Int) -> (Maybe Int) -> (Maybe Int) -> BufferAttr instance Storable BufferAttr instance Enum ChannelPosition instance Storable ChannelMap instance Enum SampleFormat instance Storable SampleSpec instance Enum Direction