{-# LINE 1 "src/Sound/ALSA/Sequencer/Marshal/Sequencer.hsc" #-} -------------------------------------------------------------------------------- {-# LINE 2 "src/Sound/ALSA/Sequencer/Marshal/Sequencer.hsc" #-} -- | -- Module : Sound.ALSA.Sequencer.Marshal.Sequencer -- Copyright : (c) Henning Thielemann, 2010 -- (c) Iavor S. Diatchki, 2007 -- License : BSD3 -- -- Maintainer: Henning Thielemann -- Stability : provisional -- -- PRIVATE MODULE. -- -- Here we have the various types used by the library, -- and how they are imported\/exported to C. -------------------------------------------------------------------------------- module Sound.ALSA.Sequencer.Marshal.Sequencer where {-# LINE 20 "src/Sound/ALSA/Sequencer/Marshal/Sequencer.hsc" #-} import qualified Foreign.C.Types as C import Foreign.Ptr (Ptr, ) -- | 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 where expOpenMode :: mode -> C.CInt class OpenMode mode => AllowInput mode where class OpenMode mode => AllowOutput mode where data OutputMode = OutputMode deriving (Show) data InputMode = InputMode deriving (Show) data DuplexMode = DuplexMode deriving (Show) instance OpenMode OutputMode where expOpenMode _ = 1 {-# LINE 37 "src/Sound/ALSA/Sequencer/Marshal/Sequencer.hsc" #-} instance OpenMode InputMode where expOpenMode _ = 2 {-# LINE 38 "src/Sound/ALSA/Sequencer/Marshal/Sequencer.hsc" #-} instance OpenMode DuplexMode where expOpenMode _ = 3 {-# LINE 39 "src/Sound/ALSA/Sequencer/Marshal/Sequencer.hsc" #-} instance AllowOutput OutputMode where instance AllowOutput DuplexMode where instance AllowInput InputMode where instance AllowInput DuplexMode where -- | Blocking behavior of the sequencer device. data BlockMode = Block -- ^ Operations may block. | Nonblock -- ^ Throw exceptions instead of blocking. deriving (Show,Eq) expBlockMode :: BlockMode -> C.CInt expBlockMode x = case x of Block -> 0 Nonblock -> 1 {-# LINE 55 "src/Sound/ALSA/Sequencer/Marshal/Sequencer.hsc" #-} -- | The type of sequencer handles. newtype T mode = Cons (Ptr Core) deriving Eq data Core