-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings for the JACK Audio Connection Kit -- -- Very basic bindings for the JACK Audio Connection Kit @package jack @version 0.6 module Sound.JACK.Exception class ToString e toString :: ToString e => e -> String toStringWithHead :: All -> String type All = Status (PortRegister (Errno)) class ThrowsStatus e status :: ThrowsStatus e => StatusSet -> e data Status e Status :: StatusSet -> Status e NoStatus :: e -> Status e class ThrowsPortRegister e portRegister :: ThrowsPortRegister e => e data PortRegister e PortRegister :: PortRegister e NoPortRegister :: e -> PortRegister e class ThrowsErrno e errno :: ThrowsErrno e => Errno -> e data Errno e Errno :: Errno -> Errno e NoErrno :: e -> Errno e instance ThrowsErrno Errno instance ThrowsErrno (Errno e) instance ThrowsPortRegister e => ThrowsPortRegister (Errno e) instance ThrowsStatus e => ThrowsStatus (Errno e) instance ToString Errno instance ToString e => ToString (Errno e) instance ThrowsErrno e => ThrowsErrno (PortRegister e) instance ThrowsPortRegister (PortRegister e) instance ThrowsStatus e => ThrowsStatus (PortRegister e) instance ToString e => ToString (PortRegister e) instance ThrowsErrno e => ThrowsErrno (Status e) instance ThrowsPortRegister e => ThrowsPortRegister (Status e) instance ThrowsStatus (Status e) instance ToString e => ToString (Status e) instance (Bits w, Enum a, Show a) => ToString (T w a) -- | The Jack module defines types and functions that allows you to use the -- JACK Audio Connection Kit. module Sound.JACK -- | Handles of Jack clients data Client -- | Constructs a new Jack client. newClient :: ThrowsStatus e => String -> String -> ExceptionalT e IO Client -- | Creates a new JACK client with the default server newClientDefault :: ThrowsStatus e => String -> ExceptionalT e IO Client disposeClient :: ThrowsErrno e => Client -> ExceptionalT e IO () -- | Run a block of code with a newly allocated client. Do not use the -- client outside the block. withClient :: ThrowsStatus e => String -> String -> (Client -> ExceptionalT e IO a) -> ExceptionalT e IO a withClientDefault :: ThrowsStatus e => String -> (Client -> ExceptionalT e IO a) -> ExceptionalT e IO a -- | closes the given Jack client without causing any trouble (hopefully) clientClose :: ThrowsErrno e => Client -> PortSet -> ExceptionalT e IO () -- | returns the names of all existing ports of the given Jack client getPorts :: Client -> IO [String] -- | activates the given Jack client activate :: ThrowsErrno e => Client -> ExceptionalT e IO () deactivate :: ThrowsErrno e => Client -> ExceptionalT e IO () withActivation :: ThrowsErrno e => Client -> ExceptionalT e IO () -> ExceptionalT e IO () -- | Jack Port Type class PortType typ class Direction dir -- | Handles of Jack input ports data Input -- | Handles of Jack output ports data Output data Port typ dir -- | Better use withPort that also handles freeing the port. newPort :: (PortType typ, Direction dir, ThrowsPortRegister e) => Client -> String -> ExceptionalT e IO (Port typ dir) disposePort :: (PortType typ, Direction dir, ThrowsErrno e) => Client -> Port typ dir -> ExceptionalT e IO () -- | Creates a new port for the given client and delete it after usage. The -- port manages audio or MIDI data in input or output direction depending -- on the Port type. Usually the required port type can be inferred from -- following actions that use that port. -- -- Do not use the port outside the enclosed block. withPort :: (PortType typ, Direction dir, ThrowsPortRegister e, ThrowsErrno e) => Client -> String -> (Port typ dir -> ExceptionalT e IO a) -> ExceptionalT e IO a -- | A collection of mixed types of ports. It is mainly needed for freeing -- all allocated ports. data PortSet setOfPort :: (PortType typ, Direction dir) => Port typ dir -> PortSet setOfPorts :: (PortType typ, Direction dir) => [Port typ dir] -> PortSet type Process = NFrames -> Ptr CallbackArg -> IO Errno connect :: ThrowsErrno e => Client -> String -> String -> ExceptionalT e IO () mkProcess :: Process -> IO (FunPtr Process) setProcess :: ThrowsErrno e => Client -> FunPtr Process -> ExceptionalT e IO () data CallbackArg getSampleRate :: Client -> IO Int -- | represents absolute frame time newtype NFrames NFrames :: CUInt -> NFrames nframesIndices :: NFrames -> [NFrames] nframesBounds :: NFrames -> (NFrames, NFrames) quit :: MVar () -> Client -> PortSet -> IO () waitForBreakAndClose :: Client -> PortSet -> IO () waitForBreak :: IO () handleExceptions :: ExceptionalT All IO () -> IO () instance Monoid PortSet instance Direction Output instance Direction Input module Sound.JACK.Audio type Sample = CFloat type Port = Port Sample withPort :: (Direction dir, ThrowsPortRegister e, ThrowsErrno e) => Client -> String -> (Port dir -> ExceptionalT e IO a) -> ExceptionalT e IO a setProcessMono :: ThrowsErrno e => Client -> Port Input -> (Sample -> IO Sample) -> Port Output -> ExceptionalT e IO () setProcessStereo :: ThrowsErrno e => Client -> Port Input -> Port Input -> ((Sample, Sample) -> IO (Sample, Sample)) -> Port Output -> Port Output -> ExceptionalT e IO () getBufferArray :: Direction dir => Port dir -> NFrames -> IO (StorableArray NFrames Sample) mainMono :: (Sample -> IO Sample) -> IO () mainStereo :: ((Sample, Sample) -> IO (Sample, Sample)) -> IO () module Sound.JACK.MIDI -- | Represents a raw JACK MIDI event data RawEvent -- | Smart constructor for a raw MIDI event. rawEvent :: NFrames -> ByteString -> RawEvent rawEventTime :: RawEvent -> NFrames rawEventBuffer :: RawEvent -> ByteString -- | Converts high level MIDI Event transformation functions into raw MIDI -- Event transformation functions toRawEventFunction :: (NFrames -> (NFrames, T) -> IO (NFrames, T)) -> (NFrames -> RawEvent -> IO RawEvent) type Port = Port EventBuffer withPort :: (Direction dir, ThrowsPortRegister e, ThrowsErrno e) => Client -> String -> (Port dir -> ExceptionalT e IO a) -> ExceptionalT e IO a -- | sets the process loop of the JACK Client setProcess :: ThrowsErrno e => Client -> Port Input -> (NFrames -> RawEvent -> IO RawEvent) -> Port Output -> ExceptionalT e IO () -- | reads all available MIDI Events on the given PortBuffer readRawEvents :: ThrowsErrno e => Ptr EventBuffer -> ExceptionalT e IO [RawEvent] -- | writes a MIDI event to the PortBuffer of a MIDI output or throws -- eNOBUFS if buffer is full writeRawEvent :: ThrowsErrno e => Ptr EventBuffer -> RawEvent -> ExceptionalT e IO () -- | Creates an input and an output, and transforms all input events into -- output events using the given function main :: (NFrames -> (NFrames, T) -> IO (NFrames, T)) -> IO () -- | Creates an input and an output, and transforms all raw input events -- into raw output events using the given function mainRaw :: (NFrames -> RawEvent -> IO RawEvent) -> IO ()