-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings for the ALSA sequencer API (MIDI stuff) -- -- Bindings for the ALSA sequencer API (MIDI stuff) Since there is also -- http://code.haskell.org/alsa/ which aims at a more complete -- interface to ALSA we will no longer maintain this one. -- -- See Sound.ALSA.Sequencer.Play for how to play Haskore songs in -- realtime via ALSA. @package alsa-midi @version 0.4 module Sound.ALSA.Sequencer.FFI newtype T Cons :: (Ptr ()) -> T data EventDataUnion DataUnknown :: CUInt -> CUInt -> CUInt -> EventDataUnion Note :: CUChar -> CUChar -> CUChar -> CUChar -> CUInt -> EventDataUnion noteChannel :: EventDataUnion -> CUChar notePitch :: EventDataUnion -> CUChar noteVelocity :: EventDataUnion -> CUChar noteOffVelocity :: EventDataUnion -> CUChar noteDuration :: EventDataUnion -> CUInt Control :: CUChar -> CUInt -> CInt -> EventDataUnion controlChannel :: EventDataUnion -> CUChar controlParameter :: EventDataUnion -> CUInt controlValue :: EventDataUnion -> CInt QueueEv :: Queue -> QueueControl -> EventDataUnion queueId :: EventDataUnion -> Queue queueControl :: EventDataUnion -> QueueControl Connect :: Address -> Address -> EventDataUnion connectSender :: EventDataUnion -> Address connectDest :: EventDataUnion -> Address Fixed :: EventDataUnion isConnect :: EventDataUnion -> Bool isFixed :: EventDataUnion -> Bool isNote :: EventDataUnion -> Bool isController :: EventDataUnion -> Bool peekEventData :: Ptr EventDataUnion -> EventType -> IO EventDataUnion peekConnect :: Ptr EventDataUnion -> IO EventDataUnion peekNote :: Ptr EventDataUnion -> IO EventDataUnion peekControl :: Ptr EventDataUnion -> IO EventDataUnion pokeEventData :: Ptr EventDataUnion -> EventDataUnion -> IO () class TimeValue a data RealTime RealTime :: CUInt -> CUInt -> RealTime tv_sec :: RealTime -> CUInt tv_nsec :: RealTime -> CUInt newtype TickTime TickTime :: CUInt -> TickTime tv_ticks :: TickTime -> CUInt data TimeUnit TimeUnitReal :: TimeUnit TimeUnitTick :: TimeUnit data TimeMode TimeModeAbsolute :: TimeMode TimeModeRelative :: TimeMode data TimeStamp TimeStampTick :: TickTime -> TimeStamp TimeStampReal :: RealTime -> TimeStamp peekTimeStamp :: TimeUnit -> Ptr TimeStamp -> IO TimeStamp pokeTimeStamp :: Ptr TimeStamp -> TimeStamp -> IO TimeUnit newtype ClientId ClientId :: CUInt -> ClientId -- | system client clientSystem :: ClientId -- | dummy ports clientDummy :: ClientId -- | OSS sequencer emulator clientOSS :: ClientId newtype Port Port :: CUInt -> Port -- | system timer port portSystemTimer :: Port -- | system announce port portSystemAnnounce :: Port data Address Address :: ClientId -> Port -> Address client :: Address -> ClientId port :: Address -> Port addressTimer :: Address newtype Queue Queue :: CUInt -> Queue queueDirect :: Queue data QueueControl QueueControlValue :: CInt -> QueueControl QueueControlTime :: TimeStamp -> QueueControl QueueControlPosition :: CUInt -> QueueControl QueueControlData32 :: CUInt -> CUInt -> QueueControl QueueControlData8 :: CUChar -> CUChar -> CUChar -> CUChar -> CUChar -> CUChar -> CUChar -> CUChar -> QueueControl pokeQueueControl :: Ptr QueueControl -> QueueControl -> IO () data EventType EventSystem :: EventType EventResult :: EventType EventPad002 :: EventType EventPad003 :: EventType EventPad004 :: EventType EventNote :: EventType EventNoteOn :: EventType EventNoteOff :: EventType EventKeyPressure :: EventType EventPad009 :: EventType EventController :: EventType EventProgramChange :: EventType EventChannelPressure :: EventType EventPitchBend :: EventType EventControl14 :: EventType EventNonRegisteredParameter :: EventType EventRegisteredParameter :: EventType EventPad017 :: EventType EventPad018 :: EventType EventPad019 :: EventType EventSongPosition :: EventType EventSongSelect :: EventType EventQuarterFrame :: EventType EventTimeSign :: EventType EventKeySign :: EventType EventPad025 :: EventType EventPad026 :: EventType EventPad027 :: EventType EventPad028 :: EventType EventPad029 :: EventType EventStart :: EventType EventContinue :: EventType EventStop :: EventType EventSetPositionTick :: EventType EventSetPositionTime :: EventType EventTempo :: EventType EventClock :: EventType EventTick :: EventType EventQueueSkew :: EventType EventSyncPos :: EventType EventTuneRequest :: EventType EventReset :: EventType EventSensing :: EventType EventPad043 :: EventType EventPad044 :: EventType EventPad045 :: EventType EventPad046 :: EventType EventPad047 :: EventType EventPad048 :: EventType EventPad049 :: EventType EventEcho :: EventType EventOSS :: EventType EventPad052 :: EventType EventPad053 :: EventType EventPad054 :: EventType EventPad055 :: EventType EventPad056 :: EventType EventPad057 :: EventType EventPad058 :: EventType EventPad059 :: EventType EventClientStart :: EventType EventClientExit :: EventType EventClientChange :: EventType EventPortStart :: EventType EventPortExit :: EventType EventPortChange :: EventType EventPortSubscribed :: EventType EventPortUnsubscribed :: EventType EventPad068 :: EventType EventPad069 :: EventType EventSample :: EventType EventSampleCluster :: EventType EventSampleStart :: EventType EventSampleStop :: EventType EventSampleFrequency :: EventType EventSampleVolume :: EventType EventSampleLoop :: EventType EventSamplePosition :: EventType EventSamplePrivate1 :: EventType EventPad079 :: EventType EventPad080 :: EventType EventPad081 :: EventType EventPad082 :: EventType EventPad083 :: EventType EventPad084 :: EventType EventPad085 :: EventType EventPad086 :: EventType EventPad087 :: EventType EventPad088 :: EventType EventPad089 :: EventType EventUser0 :: EventType EventUser1 :: EventType EventUser2 :: EventType EventUser3 :: EventType EventUser4 :: EventType EventUser5 :: EventType EventUser6 :: EventType EventUser7 :: EventType EventUser8 :: EventType EventUser9 :: EventType EventInstrumentBegin :: EventType EventInstrumentEnd :: EventType EventInstrumentInfo :: EventType EventInstrumentInfoResult :: EventType EventInstrumentFormatInfo :: EventType EventInstrumentFormatInfoResult :: EventType EventInstrumentReset :: EventType EventInstrumentStatus :: EventType EventInstrumentStatusResult :: EventType EventInstrumentPut :: EventType EventInstrumentGet :: EventType EventInstrumentGetResult :: EventType EventInstrumentFree :: EventType EventInstrumentList :: EventType EventInstrumentListResult :: EventType EventInstrumentCluster :: EventType EventInstrumentClusterGet :: EventType EventInstrumentClusterResult :: EventType EventInstrumentChange :: EventType EventPad119 :: EventType EventPad120 :: EventType EventPad121 :: EventType EventPad122 :: EventType EventPad123 :: EventType EventPad124 :: EventType EventPad125 :: EventType EventPad126 :: EventType EventPad127 :: EventType EventPad128 :: EventType EventPad129 :: EventType EventSystemExclusive :: EventType EventBounce :: EventType EventPad132 :: EventType EventPad133 :: EventType EventPad134 :: EventType EventUserVar0 :: EventType EventUserVar1 :: EventType EventUserVar2 :: EventType EventUserVar3 :: EventType EventUserVar4 :: EventType data EventLength EventLengthFixed :: EventLength EventLengthVariable :: EventLength EventLengthVariableUser :: EventLength data Priority PriorityNormal :: Priority PriorityHigh :: Priority data Event Event :: EventType -> CUChar -> Queue -> TimeStamp -> TimeMode -> EventLength -> Priority -> Address -> Address -> EventDataUnion -> Event typ :: Event -> EventType tag :: Event -> CUChar queue :: Event -> Queue time :: Event -> TimeStamp timeMode :: Event -> TimeMode eventLength :: Event -> EventLength priority :: Event -> Priority source :: Event -> Address dest :: Event -> Address eventData :: Event -> EventDataUnion newtype EnumBitPos a EnumBitPos :: Int -> EnumBitPos a timeUnitBit :: EnumBitPos TimeUnit timeModeBit :: EnumBitPos TimeMode eventLengthBit :: EnumBitPos EventLength priorityBit :: EnumBitPos Priority newtype ReturnCode ReturnCode :: CInt -> ReturnCode check :: String -> IO ReturnCode -> IO CUInt -- | should be in a more general ALSA module str_error :: CInt -> IO CString open :: Ptr T -> CString -> OpenMode -> CUInt -> IO ReturnCode close :: T -> IO ReturnCode set_client_name :: T -> CString -> IO () client_id :: T -> ClientId event_output :: T -> Ptr Event -> IO ReturnCode drain_output :: T -> IO ReturnCode event_input :: T -> Ptr (Ptr Event) -> IO ReturnCode create_simple_port :: T -> Ptr CChar -> PortCapabilitySet -> PortTypeSet -> IO ReturnCode delete_simple_port :: T -> Port -> IO ReturnCode alloc_named_queue :: T -> CString -> IO ReturnCode alloc_queue :: T -> IO ReturnCode free_queue :: T -> Queue -> IO ReturnCode newtype Tempo Tempo :: (Ptr ()) -> Tempo queue_tempo_malloc :: Ptr Tempo -> IO ReturnCode queue_tempo_free :: Tempo -> IO () queue_tempo_set_tempo :: Tempo -> CUInt -> IO () queue_tempo_set_ppq :: Tempo -> CUInt -> IO () get_queue_tempo :: T -> Queue -> Tempo -> IO ReturnCode set_queue_tempo :: T -> Queue -> Tempo -> IO ReturnCode type OpenMode = FlagSet CUInt Open data Open OpenOutput :: Open OpenInput :: Open openOutput :: OpenMode openInput :: OpenMode openDuplex :: OpenMode type PortTypeSet = FlagSet CUInt PortType data PortType PortTypeSpecific :: PortType PortTypeMIDIGeneric :: PortType PortTypeMIDIGM :: PortType PortTypeMIDIGS :: PortType PortTypeMIDIXG :: PortType PortTypeMIDIMT32 :: PortType PortType06 :: PortType PortType07 :: PortType PortType08 :: PortType PortType09 :: PortType PortTypeSynth :: PortType PortTypeDirectSample :: PortType PortTypeSample :: PortType PortType13 :: PortType PortType14 :: PortType PortType15 :: PortType PortType16 :: PortType PortType17 :: PortType PortType18 :: PortType PortType19 :: PortType PortTypeApplication :: PortType portTypeMIDIGeneric :: PortTypeSet portTypeMIDIGM :: PortTypeSet portTypeMIDIGS :: PortTypeSet portTypeMIDIXG :: PortTypeSet portTypeMIDIMT32 :: PortTypeSet portTypeSynth :: PortTypeSet portTypeDirectSample :: PortTypeSet portTypeSample :: PortTypeSet portTypeApplication :: PortTypeSet portTypeSpecific :: PortTypeSet type PortCapabilitySet = FlagSet CUInt PortCapability data PortCapability PortCapRead :: PortCapability PortCapWrite :: PortCapability PortCapSyncRead :: PortCapability PortCapSyncWrite :: PortCapability PortCapDuplex :: PortCapability PortCapSubsRead :: PortCapability PortCapSubsWrite :: PortCapability PortCapNoExport :: PortCapability portCapWrite :: PortCapabilitySet portCapSyncRead :: PortCapabilitySet portCapSyncWrite :: PortCapabilitySet portCapDuplex :: PortCapabilitySet portCapSubsRead :: PortCapabilitySet portCapSubsWrite :: PortCapabilitySet portCapNoExport :: PortCapabilitySet portCapRead :: PortCapabilitySet -- | From a list of expressions choose the one, whose condition holds. select :: a -> [(Bool, a)] -> a newtype FlagSet word enum FlagSet :: word -> FlagSet word enum unFlagSet :: FlagSet word enum -> word flagToWord :: (Enum a, Bits w) => a -> FlagSet w a flagsToWord :: (Enum a, Bits w) => [a] -> FlagSet w a wordToFlags :: (Enum a, Bits w) => FlagSet w a -> [a] intToFlags :: (Enum a, Integral w) => FlagSet w a -> [a] unpackEnum :: (Enum a, Integral b, Bits b) => b -> EnumBitPos a -> b -> a packEnum :: (Bits b, Enum a) => EnumBitPos a -> a -> b enumToChar :: (Enum a) => a -> CUChar enumFromChar :: (Enum a) => CUChar -> a instance Enum PortCapability instance Eq PortCapability instance Ord PortCapability instance Show PortCapability instance Ix PortCapability instance Enum PortType instance Eq PortType instance Ord PortType instance Show PortType instance Ix PortType instance Enum Open instance Eq Open instance Ord Open instance Show Open instance Ix Open instance Show Event instance Eq Priority instance Ord Priority instance Enum Priority instance Show Priority instance Eq EventLength instance Ord EventLength instance Enum EventLength instance Show EventLength instance Eq EventType instance Ord EventType instance Enum EventType instance Ix EventType instance Show EventType instance Show QueueControl instance Eq Queue instance Show Queue instance Show Address instance Eq Port instance Show Port instance Eq ClientId instance Show ClientId instance Show TimeStamp instance Eq TimeMode instance Ord TimeMode instance Enum TimeMode instance Show TimeMode instance Eq TimeUnit instance Ord TimeUnit instance Enum TimeUnit instance Show TimeUnit instance Show TickTime instance Show RealTime instance Show EventDataUnion instance Storable Tempo instance Storable Event instance Storable EventType instance Storable Queue instance Enum Queue instance Storable Address instance Storable Port instance Enum Port instance Storable ClientId instance Enum ClientId instance Storable TickTime instance TimeValue TickTime instance Storable RealTime instance TimeValue RealTime instance Storable T module Sound.ALSA.Sequencer createClient :: OpenMode -> String -> IO Client deleteClient :: Client -> IO () createInputPort :: Client -> String -> IO Port createOutputPort :: Client -> String -> IO Port -- | Process MIDI events from ALSA in a lazy manner. The processing -- function must be strict, in order to let the cleanup take place after -- abandoning the process. withEvents :: String -> String -> ([Event] -> IO a) -> IO a receiveEvent :: Client -> IO (Maybe Event) sendPlainEvent :: Client -> Event -> IO () -- | Strangly ALSA returns error code 2 (No such file or directory) if the -- destination port does not exist. drainOutput :: Client -> IO () initQueueTempo :: Client -> Queue -> Int -> Int -> IO () withNamedQueue :: Client -> String -> (Queue -> IO a) -> IO a portAddress :: Client -> Port -> Address numAddress :: Integer -> Integer -> Address numAddressEither :: Integer -> Integer -> Either String Address data Client newtype Port Port :: CUInt -> Port -- | This function checks whether the ALSA sequencer message is a MIDI -- channel message and converts to the corresponding data structure. -- -- Note that ALSA sequencer events contain MIDI realtime messages, MIDI -- file events and additional events. We do not want to define yet -- another data structure additionally to Event and the message -- types from the midi package. Instead, because we believe, that most of -- the time you cope with certain types of events in bundles, we provide -- functions that allow easy access to these types. Currently we provide -- only access to MIDI channel messages but that can be easily extended. -- Multiple handlers of certain event types can be composed using -- Control.Monad.mplus. -- -- NoteOn events with zero velocity are not automatically converted to -- NoteOff events, this can be done with the -- Sound.MIDI.Message.Channel.Voice.explicitNoteOff function. eventToChannelMsg :: Event -> Maybe T eventFromChannelMsg :: T -> (EventType, EventDataUnion) eventFromMetaEvent :: Queue -> T -> (EventType, EventDataUnion) -- | If you have the Haskore package installed, then you can use this -- module for playing Haskore songs in realtime via ALSA. Example: -- --
-- Prelude> Sound.ALSA.Sequencer.Play.run (Sound.ALSA.Sequencer.numAddress 128 0) (Haskore.Interface.MIDI.Render.generalMidi Haskore.Example.ChildSong6.song) --module Sound.ALSA.Sequencer.Play run :: Address -> T -> IO ()