-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Binding to the ALSA Library API (MIDI sequencer). -- -- This package provides access to ALSA sequencer (MIDI support). For -- audio support see alsa-pcm. @package alsa-seq @version 0.5 module Sound.ALSA.Sequencer.RealTime data T Cons :: !Word32 -> !Word32 -> T secs :: T -> !Word32 nano :: T -> !Word32 -- | Convert fractional number of seconds to T fromDouble :: Double -> T -- | Convert number of nanoseconds to T fromInteger :: Integer -> T -- | Convert fractional number of seconds to T toDouble :: T -> Double -- | Convert number of nanoseconds to T toInteger :: T -> Integer module Sound.ALSA.Sequencer.Address data T Cons :: !T -> !T -> T client :: T -> !T port :: T -> !T -- | The address of all subscribed ports. subscribers :: T -- | Parse the given string into sequencer address. The client and port are -- separated by either colon or period, e.g. 128:1. The function also -- accepts client names. parse :: T mode -> String -> IO T -- | This module contains functions for working with sequencer clients. -- Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_client.html module Sound.ALSA.Sequencer.Client.Info type T = ClientInfo -- | Create a new information area filled with data about the sequencer -- client. get :: T mode -> IO T -- | Create a new information area filled with data about an arbitrary -- client. getAny :: T mode -> T -> IO T queryFirst :: T mode -> IO T -- | Get information about the client with the next biggest identifier. queryNext :: T mode -> T -> IO Bool -- | Set the information for the sequencer client based on the data in the -- given information area. set :: T mode -> T -> IO () copy :: T -> T -> IO () clone :: T -> IO T getClient :: T -> IO T getType :: T -> IO Type getName :: T -> IO String getBroadcastFilter :: T -> IO Bool getErrorBounce :: T -> IO Bool getNumPorts :: T -> IO Word getEventLost :: T -> IO Word setClient :: T -> T -> IO () setName :: T -> String -> IO () setBroadcastFilter :: T -> Bool -> IO () setErrorBounce :: T -> Bool -> IO () -- | This module contains functions for working with sequencer clients. -- Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_client.html module Sound.ALSA.Sequencer.Client -- | The type of client identifiers. data T unknown :: T system :: T subscribers :: T broadcast :: T -- | Get the client identifier for the sequencer. A convinience function. getId :: T mode -> IO T -- | Set the name for the sequencer client. A convinience function. setName :: T mode -> String -> IO () -- | The different types of clients. data Type User :: Type Kernel :: Type -- | This module contains functions for working with ports. Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_port.html module Sound.ALSA.Sequencer.Port data T -- | Create a new port, as described by the info structure. create :: T mode -> PortInfo -> IO () -- | Create a port - simple version. createSimple :: T mode -> String -> Cap -> Type -> IO T -- | Delete the port. delete :: T mode -> T -> IO () -- | Delete the port. deleteSimple :: T mode -> T -> IO () withSimple :: T mode -> String -> Cap -> Type -> (T -> IO a) -> IO a systemTimer :: T systemAnnounce :: T unknown :: T -- | Port capabilities. data Cap capRead :: Cap capWrite :: Cap capSyncRead :: Cap capSyncWrite :: Cap capDuplex :: Cap capSubsRead :: Cap capSubsWrite :: Cap capNoExport :: Cap caps :: [Cap] -> Cap -- | Port types. data Type typeSpecific :: Type typeMidiGeneric :: Type typeMidiGM :: Type typeMidiGS :: Type typeMidiXG :: Type typeMidiMT32 :: Type typeMidiGM2 :: Type typeSynth :: Type typeDirectSample :: Type typeSample :: Type typeHardware :: Type typeSoftware :: Type typeSynthesizer :: Type typePort :: Type typeApplication :: Type types :: [Type] -> Type -- | This module contains functions for working with ports. Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_port.html module Sound.ALSA.Sequencer.Port.Info type T = PortInfo -- | Create a new information area filled with data about a specific port -- on our client. get :: T mode -> T -> IO T -- | Create a new information area filled with data about an given port on -- a given client. getAny :: T mode -> T -> T -> IO T -- | Get information about the first port on our client. queryFirst :: T mode -> IO T -- | Get information about the port with the next biggest identifier. If a -- matching port is found, then its information is stored in the given -- area, otherwise we throw an error. queryNext :: T mode -> T -> IO () -- | Set the information for the sequencer port based on the data in the -- given information area. set :: T mode -> T -> T -> IO () copy :: T -> T -> IO () clone :: T -> IO T getPort :: T -> IO T getClient :: T -> IO T -- | Get the address of the information area. getAddr :: T -> IO T getName :: T -> IO String getCapability :: T -> IO Cap getMidiChannels :: T -> IO Word getMidiVoices :: T -> IO Word getSynthVoices :: T -> IO Word getPortSpecified :: T -> IO Bool getTimestamping :: T -> IO Bool getTimestampReal :: T -> IO Bool getTimestampQueue :: T -> IO T getReadUse :: T -> IO Word getWriteUse :: T -> IO Word setPort :: T -> T -> IO () setClient :: T -> T -> IO () -- | Set the port address. setAddr :: T -> T -> IO () setName :: T -> String -> IO () setCapability :: T -> Cap -> IO () setMidiChannels :: T -> Word -> IO () setSynthVoices :: T -> Word -> IO () setMidiVoices :: T -> Word -> IO () setPortSpecified :: T -> Bool -> IO () setTimestamping :: T -> Bool -> IO () setTimestampReal :: T -> Bool -> IO () setTimestampQueue :: T -> T -> IO () -- | This module contains functions for working with events. Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_event.html module Sound.ALSA.Sequencer.Event -- | Wait until all events of the client are processed. syncOutputQueue :: T mode -> IO () -- | Get an event from the input buffer. If the input buffer is empty, then -- it is filled with data from the sequencer queue. If there is no data -- in the sequencer queue, then the process is either put to sleep (if -- the sequencer is operating in blocking mode), or we throw -- EAGAIN (if the sequence is operating in non-blocking mode). -- -- We may also throw ENOSPC, which means that the sequencer -- queue over-run and some events were lost (this clears the input -- buffer). input :: AllowInput mode => T mode -> IO T -- | Returns the number of events in the input buffer. If the input buffer -- is empty and the boolean argument is true, then try to fill the input -- buffer with data from the sequencer queue. See also: input. inputPending :: AllowInput mode => T mode -> Bool -> IO Word -- | Output an event and drain the buffer, if it became full. Throws -- exceptions. See also: outputDirect, outputBuffer, -- outputPending, drainOutput, dropOutput, -- extractOutput, removeEvents output :: AllowOutput mode => T mode -> T -> IO Word -- | Output an event without draining the buffer. Throws -EAGAIN -- if the buffer becomes full. See also output. outputBuffer :: AllowOutput mode => T mode -> T -> IO Word -- | Output an event directly to the sequencer, NOT through the output -- buffer. If an error occurs, then we throw an exception. See also -- output. outputDirect :: AllowOutput mode => T mode -> T -> IO Word -- | Return the size (in bytes) of pending events on output buffer. See -- also output. outputPending :: AllowOutput mode => T mode -> IO Word -- | Extract the first event in output buffer. Throws an exception on -- error. See also output. extractOutput :: AllowOutput mode => T mode -> IO T -- | Remove the first event in output buffer. Throws an exception on error. -- See also output. removeOutput :: AllowOutput mode => T mode -> IO () -- | Drain output buffer to sequencer. This function drains all pending -- events on the output buffer. The function returns immediately after -- the events are sent to the queues regardless whether the events are -- processed or not. To get synchronization with the all event processes, -- use syncOutputQueue after calling this function. Throws an -- exception on error. See also: output, syncOutputQueue. drainOutput :: AllowOutput mode => T mode -> IO Word -- | Remove events from both the user-space output buffer, and the -- kernel-space sequencer queue. See also: drainOutput, -- dropOutputBuffer, removeEvents. dropOutput :: AllowOutput mode => T mode -> IO () -- | Remove events from the user-space output buffer. See also: -- dropOutput. dropOutputBuffer :: AllowOutput mode => T mode -> IO () -- | Remove events from both the user-space input buffer, and the -- kernel-space sequencer queue. See also: dropInputBuffer, -- removeEvents. dropInput :: AllowInput mode => T mode -> IO () -- | Remove events from the user-space input buffer. See also: -- dropInput. dropInputBuffer :: AllowInput mode => T mode -> IO () -- | Used for volume control: means do not change the volume. volumeSame :: Int16 data TimeStamp TickTime :: !Word32 -> TimeStamp RealTime :: !T -> TimeStamp data InstrCluster data Instr Instr :: !InstrCluster -> !Word32 -> !Word16 -> !Word16 -> Instr instrCluster :: Instr -> !InstrCluster instrStd :: Instr -> !Word32 instrBank :: Instr -> !Word16 instrPrg :: Instr -> !Word16 data Sample Sample :: !Word32 -> !Word16 -> !Word16 -> Sample sampleStd :: Sample -> !Word32 sampleBank :: Sample -> !Word16 samplePrg :: Sample -> !Word16 newtype Cluster Cluster :: InstrCluster -> Cluster clusterCluster :: Cluster -> InstrCluster -- | These are all 14 bit values. data Volume Volume :: !Int16 -> !Int16 -> !Int16 -> !Int16 -> Volume volumeVolume :: Volume -> !Int16 volumeLR :: Volume -> !Int16 volumeFR :: Volume -> !Int16 volumeDU :: Volume -> !Int16 data T Cons :: !Bool -> !Word8 -> !T -> !TimeStamp -> !T -> !T -> !Data -> T highPriority :: T -> !Bool tag :: T -> !Word8 queue :: T -> !T timestamp :: T -> !TimeStamp source :: T -> !T dest :: T -> !T body :: T -> !Data data Data NoteEv :: NoteEv -> Note -> Data CtrlEv :: CtrlEv -> Ctrl -> Data AddrEv :: AddrEv -> T -> Data ConnEv :: ConnEv -> Connect -> Data EmptyEv :: EmptyEv -> Data CustomEv :: CustomEv -> Custom -> Data data NoteEv ANote :: NoteEv NoteOn :: NoteEv NoteOff :: NoteEv KeyPress :: NoteEv data Note Note :: !Word8 -> !Word8 -> !Word8 -> !Word8 -> !Word32 -> Note noteChannel :: Note -> !Word8 noteNote :: Note -> !Word8 noteVelocity :: Note -> !Word8 noteOffVelocity :: Note -> !Word8 noteDuration :: Note -> !Word32 -- | Make a note whose unspecified fields contain 0. simpleNote :: Word8 -> Word8 -> Word8 -> Note data CtrlEv Controller :: CtrlEv PgmChange :: CtrlEv ChanPress :: CtrlEv PitchBend :: CtrlEv Control14 :: CtrlEv NonRegParam :: CtrlEv RegParam :: CtrlEv SongPos :: CtrlEv SongSel :: CtrlEv QFrame :: CtrlEv TimeSign :: CtrlEv KeySign :: CtrlEv data Ctrl Ctrl :: !Word8 -> !Word32 -> !Int32 -> Ctrl ctrlChannel :: Ctrl -> !Word8 ctrlParam :: Ctrl -> !Word32 ctrlValue :: Ctrl -> !Int32 data CustomEv Echo :: CustomEv OSS :: CustomEv User0 :: CustomEv User1 :: CustomEv User2 :: CustomEv User3 :: CustomEv User4 :: CustomEv User5 :: CustomEv User6 :: CustomEv User7 :: CustomEv User8 :: CustomEv User9 :: CustomEv data Custom Custom :: !Word32 -> !Word32 -> !Word32 -> Custom custom0 :: Custom -> !Word32 custom1 :: Custom -> !Word32 custom2 :: Custom -> !Word32 data QueueEv QueueStart :: QueueEv QueueContinue :: QueueEv QueueStop :: QueueEv QueueSetPosTick :: QueueEv QueueSetPosTime :: QueueEv QueueTempo :: QueueEv QueueClock :: QueueEv QueueTick :: QueueEv QueueSkew :: QueueEv QueueSyncPos :: QueueEv data AddrEv ClientStart :: AddrEv ClientExit :: AddrEv ClientChange :: AddrEv PortStart :: AddrEv PortExit :: AddrEv PortChange :: AddrEv data ConnEv PortSubscribed :: ConnEv PortUnsubscribed :: ConnEv data Connect data EmptyEv TuneRequest :: EmptyEv Reset :: EmptyEv Sensing :: EmptyEv None :: EmptyEv Unknown :: EmptyEv -- | This module contains functions for working with sequencer queue. -- Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_queue.html module Sound.ALSA.Sequencer.Queue -- | The type of queue identifiers. data T direct :: T alloc :: T mode -> IO T allocNamed :: T mode -> String -> IO T -- | Delete the specified queue. free :: T mode -> T -> IO () with :: T mode -> (T -> IO a) -> IO a withNamed :: T mode -> String -> (T -> IO a) -> IO a -- | Queue.T controls - startstopcontinue control :: T mode -> T -> QueueEv -> Int -> Maybe T -> IO () -- | This module contains functions for working with sequencer queue. -- Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_queue.html module Sound.ALSA.Sequencer.Queue.Info type T = QueueInfo get :: T mode -> T -> IO T set :: T mode -> T -> T -> IO () copy :: T -> T -> IO () clone :: T -> IO T getQueue :: T -> IO T getName :: T -> IO String getLocked :: T -> IO Bool getOwner :: T -> IO T getFlags :: T -> IO Word setName :: T -> String -> IO () setLocked :: T -> Bool -> IO () setOwner :: T -> T -> IO () setFlags :: T -> Word -> IO () -- | This module contains functions for working with sequencer queue. -- Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_queue.html module Sound.ALSA.Sequencer.Queue.Status type T = QueueStatus get :: T mode -> T -> IO T copy :: T -> T -> IO () clone :: T -> IO T getQueue :: T -> IO T getEvents :: T -> IO Int getTickTime :: T -> IO Word32 getRealTime :: T -> IO T -- | This module contains functions for working with sequencer queue. -- Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_queue.html module Sound.ALSA.Sequencer.Queue.Tempo type T = QueueTempo get :: T mode -> T -> IO T set :: T mode -> T -> T -> IO () copy :: T -> T -> IO () clone :: T -> IO T getQueue :: T -> IO T getTempo :: T -> IO Word getPPQ :: T -> IO Int getSkew :: T -> IO Word getSkewBase :: T -> IO Word setTempo :: T -> Word -> IO () setPPQ :: T -> Int -> IO () setSkew :: T -> Word -> IO () setSkewBase :: T -> Word -> IO () -- | This module contains functions for working with sequencer queue. -- Reference: -- http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_queue.html module Sound.ALSA.Sequencer.Queue.Timer type T = QueueTimer get :: T mode -> T -> IO T set :: T mode -> T -> T -> IO () copy :: T -> T -> IO () clone :: T -> IO T getQueue :: T -> IO T getType :: T -> IO Type getResolution :: T -> IO Word setType :: T -> Type -> IO () setResolution :: T -> Word -> IO () data Type Alsa :: Type MidiClock :: Type MidiTick :: Type -- | Overview: -- http://www.alsa-project.org/alsa-doc/alsa-lib/seq.html -- -- WARNING: This whole library does not seem to be particlarly thread -- aware. Perhaps place the sequencer handle in an MVar? module Sound.ALSA.Sequencer -- | The type of sequencer handles. data T mode -- | Read/Write permissions for the sequencer device. This way we prevent -- the ALSA exception 22 Invalid argument when calling -- event_output on an input-only sequencer. class OpenMode mode class OpenMode mode => AllowOutput mode class OpenMode mode => AllowInput mode data OutputMode OutputMode :: OutputMode data InputMode InputMode :: InputMode data DuplexMode DuplexMode :: DuplexMode -- | Blocking behavior of the sequencer device. data BlockMode -- | Operations may block. Block :: BlockMode -- | Throw exceptions instead of blocking. Nonblock :: BlockMode -- | Creates a new handle and opens a connection to the kernel sequencer -- interface. After a client is created successfully, a -- ClientStart event is broadcast to the announce port. May -- throw an exception. See also: open_lconf, close, -- get_seq_type, get_seq_name, set_blocking, -- get_client_id. open :: OpenMode mode => String -> BlockMode -> IO (T mode) -- | Close the sequencer. Closes the sequencer client and releases its -- resources. After a client is closed, an event with ClientExit -- is broadcast to announce port. The connection between other clients -- are disconnected. Call this just before exiting your program. NOTE: we -- could put this in a finalizer for the handle? close :: T mode -> IO () with :: OpenMode mode => String -> BlockMode -> (T mode -> IO a) -> IO a -- | This is the name that should be passed to open in most cases. defaultName :: String -- | Get identifier of a sequencer handle. It is the same identifier -- specified in the call to open. getName :: T mode -> IO String -- | Change the blocking mode of the given client. In block mode, the -- client falls into sleep when it fills the output pool with events, or -- when it demands events from an empty input pool. memory pool with full -- events. Clients that are sleeping due to loack of space in the output -- pool are woken when a certain amount of free space becomes available -- (see set_output_room). setBlocking :: T mode -> BlockMode -> IO () -- | Return the byte size of the output buffer. getOutputBufferSize :: T mode -> IO Word -- | Resize of the output buffer. This function clears all output events -- (see drop_output). setOutputBufferSize :: T mode -> Word -> IO () -- | Return the byte size of input buffer. getInputBufferSize :: T mode -> IO Word -- | Resize the input buffer. This function clears all input events (see -- drop_input). setInputBufferSize :: T mode -> Word -> IO () -- | Resize the output memory pool. setPoolOutput :: T mode -> Word -> IO () -- | Specify how much space should become free before waking clients that -- are blocked due to a lack of space in the output pool. setPoolOutputRoom :: T mode -> Word -> IO () -- | Reset the output pool. resetPoolOutput :: T mode -> IO () -- | Resize the input memory pool. setPoolInput :: T mode -> Word -> IO () -- | Reset the input pool. resetPoolInput :: T mode -> IO () -- | Simple subscription (w/o exclusive & time conversion). connectFrom :: AllowInput mode => T mode -> T -> T -> IO () -- | Simple subscription (w/o exclusive & time conversion). connectTo :: AllowOutput mode => T mode -> T -> T -> IO () -- | Simple disconnection. disconnectFrom :: AllowInput mode => T mode -> T -> T -> IO () -- | Simple disconnection. disconnectTo :: AllowOutput mode => T mode -> T -> T -> IO ()