module Sound.ALSA.Sequencer.Glib ( inputAdd , drainOutput , inputRemove ) where import qualified Sound.ALSA.Sequencer.GlibGtkClass as GC import qualified Sound.ALSA.Sequencer.GlibGtk as GG import qualified System.Glib.MainLoop as G import qualified Sound.ALSA.Sequencer.Event as Event import qualified Sound.ALSA.Sequencer as Seq import qualified System.Posix.Poll as Poll methods :: GC.T G.Priority G.HandlerId G.IOCondition methods = GC.Cons G.inputAdd G.inputRemove pio pio :: Poll.Event -> G.IOCondition pio Poll.In = G.IOIn pio Poll.Out = G.IOOut pio Poll.Pri = G.IOPri pio Poll.Err = G.IOErr pio Poll.Hup = G.IOHup pio Poll.NVal = G.IOInvalid pio (Poll.Other n) = error $ "unknown Poll flag at bit position " ++ show n type HandlerId = [G.HandlerId] inputAdd :: Seq.AllowInput mode => Seq.T mode -> G.Priority -> (Event.T -> IO Bool) -> IO HandlerId inputAdd = GG.inputAdd methods drainOutput :: Seq.AllowOutput mode => Seq.T mode -> G.Priority -> IO HandlerId drainOutput = GG.drainOutput methods inputRemove :: HandlerId -> IO () inputRemove = GG.inputRemove methods