pulseaudio-0.0.2.1: A low-level (incomplete) wrapper around the pulseaudio client asynchronous api

Safe HaskellSafe
LanguageHaskell2010

Sound.Pulse.Mainloop

Description

Maintianer : ongy Stability : experimental

This module provides Haskell abstractions over the pulse mainloop-api https://freedesktop.org/software/pulseaudio/doxygen/mainloop-api_8h.html.

There is also a simple implementation for this in Simple.

Synopsis

Documentation

class PAMainloop a where Source #

The main class for a pulseaudio mainloop abstraction.

Associated Types

data PAIOEvent a :: * Source #

Pulseaudio IO event. Will have to wait for an Fd to become ready (w.r.t. to flags)

data PATimeEvent a :: * Source #

Pulseaudio Time event. Should fire at a specified time.

data PADeferEvent a :: * Source #

Pulseaudio Defer event. Should be handled before other events. May be disabled.

Methods

ioNew :: a -> Fd -> [PAIOEventFlags] -> ([PAIOEventFlags] -> IO ()) -> IO (PAIOEvent a) Source #

Create a new PAIOEvent and set it to listen for specified events.

ioEnable :: PAIOEvent a -> [PAIOEventFlags] -> IO () Source #

Modify the events an IOEvent is waiting on.

ioFree :: PAIOEvent a -> IO () Source #

Delete an IOEvent.

ioSetDestroy :: PAIOEvent a -> IO () -> IO () Source #

Set the destroy handler of an IOEvent. The handler should be called, when the event is deleted.

timeNew :: a -> PATime -> (PATime -> IO ()) -> IO (PATimeEvent a) Source #

Create a new PATimeEvent. This should fire at the given time.

timeRestart :: PATimeEvent a -> PATime -> IO () Source #

Set a new time when the PATimeEvent should fire. This may require requeing.

timeFree :: PATimeEvent a -> IO () Source #

Delete a PATimeEvent.

timeSetDestroy :: PATimeEvent a -> IO () -> IO () Source #

Set the destroy handler.

deferNew :: a -> IO () -> IO (PADeferEvent a) Source #

Create a new PADefereEvent. This should be fired before any other events.

deferEnable :: PADeferEvent a -> Bool -> IO () Source #

Enable or disable a PADefereEvent.

deferFree :: PADeferEvent a -> IO () Source #

Delete the event.

deferSetDestroy :: PADeferEvent a -> IO () -> IO () Source #

Set the destroy handler for the event.

quitLoop :: a -> Int -> IO () Source #

Quit the mainloop and return the given int.

data PAIOEventFlags Source #

Events that PAIOEvents may wait for. At my current level of testing, it looks like libpulse only uses Input (and I guess output when writing to the server)

Constructors

PAIOEventNull

No Event (this is for compatibility, should never show up)

PAIOEventInput

Fd went ready for reading

PAIOEventOutput

Fd went ready for writing

PAIOEventHangup

Fd got a hangup (see poll documentation)

PAIOEventError

Fd got an error (see poll documentation)

data PAMainloopApi a Source #

The type used to encapsule a PAMainloop in a C compatible struct of FunPtrs.

getMainloopApi :: PAMainloop a => a -> IO (PAMainloopApi a) Source #

Warning! This leaks a bit of memory when it's Garbage collected, because the FunPtrs created for the PulseApi cannot be collected at that point. Currently there is no way to properly free them, but this should only be called once per application, so this will be a known Bug for now.