{-# LINE 1 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
--------------------------------------------------------------------------------
{-# LINE 2 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
-- |
-- Module    : Sound.ALSA.Sequencer.Area
-- Copyright : (c) Henning Thielemann, 2010
--             (c) Iavor S. Diatchki, 2007
-- License   : BSD3
--
-- Maintainer: Henning Thielemann
-- Stability : provisional
--
-- PRIVATE MODULE.
--
-- Here we have macros to deal with the various information
-- areas present in the library.
--------------------------------------------------------------------------------

module Sound.ALSA.Sequencer.Area where

import qualified Sound.ALSA.Sequencer.Marshal.Client as Client
import qualified Sound.ALSA.Sequencer.Marshal.Port as Port
import qualified Sound.ALSA.Sequencer.Marshal.Queue as Queue
import qualified Sound.ALSA.Sequencer.Marshal.QueueTimer as QueueTimer
import qualified Sound.ALSA.Exception as Exc

import Foreign.C.Types (CInt, )
import Foreign.C.String (CString, peekCString, withCAString, )
import Foreign.Storable (Storable, peek, )
import Foreign.Marshal.Alloc (alloca, )
import Foreign.ForeignPtr (ForeignPtr, newForeignPtr, withForeignPtr, )
import Foreign.Ptr (Ptr, FunPtr, )
import Data.Word (Word, )


class C area where
   malloc :: IO area
   copy :: area -> area -> IO ()
   clone :: area -> IO area


{-# LINE 84 "src/Sound/ALSA/Sequencer/Area.hsc" #-}


{-# LINE 99 "src/Sound/ALSA/Sequencer/Area.hsc" #-}


{-# LINE 116 "src/Sound/ALSA/Sequencer/Area.hsc" #-}


{-# LINE 126 "src/Sound/ALSA/Sequencer/Area.hsc" #-}


{-# LINE 135 "src/Sound/ALSA/Sequencer/Area.hsc" #-}



-- Client.T Info -----------------------------------------------------------------
data ClientInfo_
newtype ClientInfo = ClientInfo (ForeignPtr ClientInfo_)

with_client_info :: ClientInfo -> (Ptr ClientInfo_ -> IO a) -> IO a
with_client_info (ClientInfo p) f = withForeignPtr p f

-- | Allocate an uninitialized object. (Not exported)
client_info_malloc :: IO ClientInfo
client_info_malloc = alloca $ \p ->
  do Exc.checkResult "Sequencer.client_info" =<< snd_seq_client_info_malloc p
     ClientInfo `fmap` (newForeignPtr snd_seq_client_info_free =<< peek p)

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_malloc"
  snd_seq_client_info_malloc :: Ptr (Ptr ClientInfo_) -> IO CInt

foreign import ccall "alsa/asoundlib.h &snd_seq_client_info_free"
   snd_seq_client_info_free :: FunPtr (Ptr ClientInfo_ -> IO ())

-- | Copy the content of one object into another.
client_info_copy
  :: ClientInfo     -- ^ Destination
  -> ClientInfo     -- ^ Source
  -> IO ()

client_info_copy to from =
  with_client_info to $ \p1 ->
  with_client_info from $ \p2 ->
    snd_seq_client_info_copy p1 p2

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_copy"
  snd_seq_client_info_copy :: Ptr ClientInfo_ -> Ptr ClientInfo_ -> IO ()

-- | Copy the content of an object to a newly created object.
client_info_clone :: ClientInfo -> IO ClientInfo
client_info_clone from =
  do to <- client_info_malloc
     client_info_copy to from
     return to

instance C ClientInfo where
  malloc = client_info_malloc
  copy = client_info_copy
  clone = client_info_clone

{-# LINE 140 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- read/write
client_info_get_name :: ClientInfo -> IO String
client_info_get_name i = peekCString =<< with_client_info i snd_seq_client_info_get_name

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_get_name"
  snd_seq_client_info_get_name :: Ptr ClientInfo_ -> IO CString

client_info_set_name :: ClientInfo -> String -> IO ()
client_info_set_name i c =
  withCAString c $ \p -> with_client_info i (`snd_seq_client_info_set_name` p)

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_set_name"
  snd_seq_client_info_set_name :: Ptr ClientInfo_ -> CString -> IO ()

{-# LINE 143 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
client_info_get_broadcast_filter :: ClientInfo -> IO Bool
client_info_get_broadcast_filter i =
  (1 ==) `fmap` with_client_info i snd_seq_client_info_get_broadcast_filter

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_get_broadcast_filter"
  snd_seq_client_info_get_broadcast_filter :: Ptr ClientInfo_ -> IO CInt

client_info_set_broadcast_filter :: ClientInfo -> Bool -> IO ()
client_info_set_broadcast_filter i c =
  let x = if c then 1 else 0
  in with_client_info i (`snd_seq_client_info_set_broadcast_filter` x)

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_set_broadcast_filter"
  snd_seq_client_info_set_broadcast_filter :: Ptr ClientInfo_ -> CInt -> IO ()

{-# LINE 144 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
client_info_get_error_bounce :: ClientInfo -> IO Bool
client_info_get_error_bounce i =
  (1 ==) `fmap` with_client_info i snd_seq_client_info_get_error_bounce

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_get_error_bounce"
  snd_seq_client_info_get_error_bounce :: Ptr ClientInfo_ -> IO CInt

client_info_set_error_bounce :: ClientInfo -> Bool -> IO ()
client_info_set_error_bounce i c =
  let x = if c then 1 else 0
  in with_client_info i (`snd_seq_client_info_set_error_bounce` x)

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_set_error_bounce"
  snd_seq_client_info_set_error_bounce :: Ptr ClientInfo_ -> CInt -> IO ()

{-# LINE 145 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
client_info_get_client :: ClientInfo -> IO Client.T
client_info_get_client i =
  Client.imp
      `fmap` with_client_info i snd_seq_client_info_get_client

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_get_client"
  snd_seq_client_info_get_client :: Ptr ClientInfo_ -> IO CInt

{-# LINE 147 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
client_info_set_client :: ClientInfo -> Client.T -> IO ()
client_info_set_client i c =
  with_client_info i (`snd_seq_client_info_set_client` Client.exp c)

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_set_client"
  snd_seq_client_info_set_client  :: Ptr ClientInfo_ -> CInt -> IO ()

{-# LINE 149 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- read only
client_info_get_type :: ClientInfo -> IO Client.Type
client_info_get_type i =
  Client.impType
      `fmap` with_client_info i snd_seq_client_info_get_type

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_get_type"
  snd_seq_client_info_get_type :: Ptr ClientInfo_ -> IO CInt

{-# LINE 153 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
client_info_get_num_ports :: ClientInfo -> IO Word
client_info_get_num_ports i =
  fromIntegral
      `fmap` with_client_info i snd_seq_client_info_get_num_ports

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_get_num_ports"
  snd_seq_client_info_get_num_ports :: Ptr ClientInfo_ -> IO CInt

{-# LINE 155 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
client_info_get_event_lost :: ClientInfo -> IO Word
client_info_get_event_lost i =
  fromIntegral
      `fmap` with_client_info i snd_seq_client_info_get_event_lost

foreign import ccall "alsa/asoundlib.h snd_seq_client_info_get_event_lost"
  snd_seq_client_info_get_event_lost :: Ptr ClientInfo_ -> IO CInt

{-# LINE 157 "src/Sound/ALSA/Sequencer/Area.hsc" #-}


-- Port Info -------------------------------------------------------------------
data PortInfo_
newtype PortInfo = PortInfo (ForeignPtr PortInfo_)

with_port_info :: PortInfo -> (Ptr PortInfo_ -> IO a) -> IO a
with_port_info (PortInfo p) f = withForeignPtr p f

-- | Allocate an uninitialized object. (Not exported)
port_info_malloc :: IO PortInfo
port_info_malloc = alloca $ \p ->
  do Exc.checkResult "Sequencer.port_info" =<< snd_seq_port_info_malloc p
     PortInfo `fmap` (newForeignPtr snd_seq_port_info_free =<< peek p)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_malloc"
  snd_seq_port_info_malloc :: Ptr (Ptr PortInfo_) -> IO CInt

foreign import ccall "alsa/asoundlib.h &snd_seq_port_info_free"
   snd_seq_port_info_free :: FunPtr (Ptr PortInfo_ -> IO ())

-- | Copy the content of one object into another.
port_info_copy
  :: PortInfo     -- ^ Destination
  -> PortInfo     -- ^ Source
  -> IO ()

port_info_copy to from =
  with_port_info to $ \p1 ->
  with_port_info from $ \p2 ->
    snd_seq_port_info_copy p1 p2

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_copy"
  snd_seq_port_info_copy :: Ptr PortInfo_ -> Ptr PortInfo_ -> IO ()

-- | Copy the content of an object to a newly created object.
port_info_clone :: PortInfo -> IO PortInfo
port_info_clone from =
  do to <- port_info_malloc
     port_info_copy to from
     return to

instance C PortInfo where
  malloc = port_info_malloc
  copy = port_info_copy
  clone = port_info_clone

{-# LINE 161 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- read/write
port_info_get_name :: PortInfo -> IO String
port_info_get_name i = peekCString =<< with_port_info i snd_seq_port_info_get_name

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_name"
  snd_seq_port_info_get_name :: Ptr PortInfo_ -> IO CString

port_info_set_name :: PortInfo -> String -> IO ()
port_info_set_name i c =
  withCAString c $ \p -> with_port_info i (`snd_seq_port_info_set_name` p)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_name"
  snd_seq_port_info_set_name :: Ptr PortInfo_ -> CString -> IO ()

{-# LINE 164 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

port_info_get_port_specified :: PortInfo -> IO Bool
port_info_get_port_specified i =
  (1 ==) `fmap` with_port_info i snd_seq_port_info_get_port_specified

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_port_specified"
  snd_seq_port_info_get_port_specified :: Ptr PortInfo_ -> IO CInt

port_info_set_port_specified :: PortInfo -> Bool -> IO ()
port_info_set_port_specified i c =
  let x = if c then 1 else 0
  in with_port_info i (`snd_seq_port_info_set_port_specified` x)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_port_specified"
  snd_seq_port_info_set_port_specified :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 166 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_get_timestamping :: PortInfo -> IO Bool
port_info_get_timestamping i =
  (1 ==) `fmap` with_port_info i snd_seq_port_info_get_timestamping

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_timestamping"
  snd_seq_port_info_get_timestamping :: Ptr PortInfo_ -> IO CInt

port_info_set_timestamping :: PortInfo -> Bool -> IO ()
port_info_set_timestamping i c =
  let x = if c then 1 else 0
  in with_port_info i (`snd_seq_port_info_set_timestamping` x)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_timestamping"
  snd_seq_port_info_set_timestamping :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 167 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_get_timestamp_real :: PortInfo -> IO Bool
port_info_get_timestamp_real i =
  (1 ==) `fmap` with_port_info i snd_seq_port_info_get_timestamp_real

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_timestamp_real"
  snd_seq_port_info_get_timestamp_real :: Ptr PortInfo_ -> IO CInt

port_info_set_timestamp_real :: PortInfo -> Bool -> IO ()
port_info_set_timestamp_real i c =
  let x = if c then 1 else 0
  in with_port_info i (`snd_seq_port_info_set_timestamp_real` x)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_timestamp_real"
  snd_seq_port_info_set_timestamp_real :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 168 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

port_info_get_port :: PortInfo -> IO Port.T
port_info_get_port i =
  Port.imp
      `fmap` with_port_info i snd_seq_port_info_get_port

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_port"
  snd_seq_port_info_get_port :: Ptr PortInfo_ -> IO CInt

{-# LINE 171 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_set_port :: PortInfo -> Port.T -> IO ()
port_info_set_port i c =
  with_port_info i (`snd_seq_port_info_set_port` Port.exp c)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_port"
  snd_seq_port_info_set_port  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 173 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_get_client :: PortInfo -> IO Client.T
port_info_get_client i =
  Client.imp
      `fmap` with_port_info i snd_seq_port_info_get_client

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_client"
  snd_seq_port_info_get_client :: Ptr PortInfo_ -> IO CInt

{-# LINE 175 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_set_client :: PortInfo -> Client.T -> IO ()
port_info_set_client i c =
  with_port_info i (`snd_seq_port_info_set_client` Client.exp c)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_client"
  snd_seq_port_info_set_client  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 177 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_get_capability :: PortInfo -> IO Port.Cap
port_info_get_capability i =
  (Port.Cap . fromIntegral)
      `fmap` with_port_info i snd_seq_port_info_get_capability

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_capability"
  snd_seq_port_info_get_capability :: Ptr PortInfo_ -> IO CInt

{-# LINE 179 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_set_capability :: PortInfo -> Port.Cap -> IO ()
port_info_set_capability i c =
  with_port_info i (`snd_seq_port_info_set_capability` (fromIntegral . Port.unCap) c)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_capability"
  snd_seq_port_info_set_capability  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 181 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

port_info_get_midi_channels :: PortInfo -> IO Word
port_info_get_midi_channels i =
  fromIntegral
      `fmap` with_port_info i snd_seq_port_info_get_midi_channels

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_midi_channels"
  snd_seq_port_info_get_midi_channels :: Ptr PortInfo_ -> IO CInt

{-# LINE 184 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_set_midi_channels :: PortInfo -> Word -> IO ()
port_info_set_midi_channels i c =
  with_port_info i (`snd_seq_port_info_set_midi_channels` fromIntegral c)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_midi_channels"
  snd_seq_port_info_set_midi_channels  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 186 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_get_midi_voices :: PortInfo -> IO Word
port_info_get_midi_voices i =
  fromIntegral
      `fmap` with_port_info i snd_seq_port_info_get_midi_voices

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_midi_voices"
  snd_seq_port_info_get_midi_voices :: Ptr PortInfo_ -> IO CInt

{-# LINE 188 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_set_midi_voices :: PortInfo -> Word -> IO ()
port_info_set_midi_voices i c =
  with_port_info i (`snd_seq_port_info_set_midi_voices` fromIntegral c)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_midi_voices"
  snd_seq_port_info_set_midi_voices  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 190 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_get_synth_voices :: PortInfo -> IO Word
port_info_get_synth_voices i =
  fromIntegral
      `fmap` with_port_info i snd_seq_port_info_get_synth_voices

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_synth_voices"
  snd_seq_port_info_get_synth_voices :: Ptr PortInfo_ -> IO CInt

{-# LINE 192 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_set_synth_voices :: PortInfo -> Word -> IO ()
port_info_set_synth_voices i c =
  with_port_info i (`snd_seq_port_info_set_synth_voices` fromIntegral c)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_synth_voices"
  snd_seq_port_info_set_synth_voices  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 194 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

port_info_get_timestamp_queue :: PortInfo -> IO Queue.T
port_info_get_timestamp_queue i =
  Queue.imp
      `fmap` with_port_info i snd_seq_port_info_get_timestamp_queue

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_timestamp_queue"
  snd_seq_port_info_get_timestamp_queue :: Ptr PortInfo_ -> IO CInt

{-# LINE 197 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_set_timestamp_queue :: PortInfo -> Queue.T -> IO ()
port_info_set_timestamp_queue i c =
  with_port_info i (`snd_seq_port_info_set_timestamp_queue` Queue.exp c)

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_set_timestamp_queue"
  snd_seq_port_info_set_timestamp_queue  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 199 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- read only
port_info_get_read_use :: PortInfo -> IO Word
port_info_get_read_use i =
  fromIntegral
      `fmap` with_port_info i snd_seq_port_info_get_read_use

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_read_use"
  snd_seq_port_info_get_read_use :: Ptr PortInfo_ -> IO CInt

{-# LINE 203 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_info_get_write_use :: PortInfo -> IO Word
port_info_get_write_use i =
  fromIntegral
      `fmap` with_port_info i snd_seq_port_info_get_write_use

foreign import ccall "alsa/asoundlib.h snd_seq_port_info_get_write_use"
  snd_seq_port_info_get_write_use :: Ptr PortInfo_ -> IO CInt

{-# LINE 205 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- Queue.T Info ------------------------------------------------------------------
data QueueInfo_
newtype QueueInfo = QueueInfo (ForeignPtr QueueInfo_)

with_queue_info :: QueueInfo -> (Ptr QueueInfo_ -> IO a) -> IO a
with_queue_info (QueueInfo p) f = withForeignPtr p f

-- | Allocate an uninitialized object. (Not exported)
queue_info_malloc :: IO QueueInfo
queue_info_malloc = alloca $ \p ->
  do Exc.checkResult "Sequencer.queue_info" =<< snd_seq_queue_info_malloc p
     QueueInfo `fmap` (newForeignPtr snd_seq_queue_info_free =<< peek p)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_malloc"
  snd_seq_queue_info_malloc :: Ptr (Ptr QueueInfo_) -> IO CInt

foreign import ccall "alsa/asoundlib.h &snd_seq_queue_info_free"
   snd_seq_queue_info_free :: FunPtr (Ptr QueueInfo_ -> IO ())

-- | Copy the content of one object into another.
queue_info_copy
  :: QueueInfo     -- ^ Destination
  -> QueueInfo     -- ^ Source
  -> IO ()

queue_info_copy to from =
  with_queue_info to $ \p1 ->
  with_queue_info from $ \p2 ->
    snd_seq_queue_info_copy p1 p2

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_copy"
  snd_seq_queue_info_copy :: Ptr QueueInfo_ -> Ptr QueueInfo_ -> IO ()

-- | Copy the content of an object to a newly created object.
queue_info_clone :: QueueInfo -> IO QueueInfo
queue_info_clone from =
  do to <- queue_info_malloc
     queue_info_copy to from
     return to

instance C QueueInfo where
  malloc = queue_info_malloc
  copy = queue_info_copy
  clone = queue_info_clone

{-# LINE 208 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_info_get_name :: QueueInfo -> IO String
queue_info_get_name i = peekCString =<< with_queue_info i snd_seq_queue_info_get_name

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_get_name"
  snd_seq_queue_info_get_name :: Ptr QueueInfo_ -> IO CString

queue_info_set_name :: QueueInfo -> String -> IO ()
queue_info_set_name i c =
  withCAString c $ \p -> with_queue_info i (`snd_seq_queue_info_set_name` p)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_set_name"
  snd_seq_queue_info_set_name :: Ptr QueueInfo_ -> CString -> IO ()

{-# LINE 209 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_info_get_locked :: QueueInfo -> IO Bool
queue_info_get_locked i =
  (1 ==) `fmap` with_queue_info i snd_seq_queue_info_get_locked

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_get_locked"
  snd_seq_queue_info_get_locked :: Ptr QueueInfo_ -> IO CInt

queue_info_set_locked :: QueueInfo -> Bool -> IO ()
queue_info_set_locked i c =
  let x = if c then 1 else 0
  in with_queue_info i (`snd_seq_queue_info_set_locked` x)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_set_locked"
  snd_seq_queue_info_set_locked :: Ptr QueueInfo_ -> CInt -> IO ()

{-# LINE 210 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

queue_info_get_owner :: QueueInfo -> IO Client.T
queue_info_get_owner i =
  Client.imp
      `fmap` with_queue_info i snd_seq_queue_info_get_owner

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_get_owner"
  snd_seq_queue_info_get_owner :: Ptr QueueInfo_ -> IO CInt

{-# LINE 213 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_info_set_owner :: QueueInfo -> Client.T -> IO ()
queue_info_set_owner i c =
  with_queue_info i (`snd_seq_queue_info_set_owner` Client.exp c)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_set_owner"
  snd_seq_queue_info_set_owner  :: Ptr QueueInfo_ -> CInt -> IO ()

{-# LINE 215 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_info_get_flags :: QueueInfo -> IO Word
queue_info_get_flags i =
  fromIntegral
      `fmap` with_queue_info i snd_seq_queue_info_get_flags

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_get_flags"
  snd_seq_queue_info_get_flags :: Ptr QueueInfo_ -> IO CInt

{-# LINE 217 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_info_set_flags :: QueueInfo -> Word -> IO ()
queue_info_set_flags i c =
  with_queue_info i (`snd_seq_queue_info_set_flags` fromIntegral c)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_set_flags"
  snd_seq_queue_info_set_flags  :: Ptr QueueInfo_ -> CInt -> IO ()

{-# LINE 219 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- RO
queue_info_get_queue :: QueueInfo -> IO Queue.T
queue_info_get_queue i =
  Queue.imp
      `fmap` with_queue_info i snd_seq_queue_info_get_queue

foreign import ccall "alsa/asoundlib.h snd_seq_queue_info_get_queue"
  snd_seq_queue_info_get_queue :: Ptr QueueInfo_ -> IO CInt

{-# LINE 223 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- Queue.T Status ----------------------------------------------------------------
data QueueStatus_
newtype QueueStatus = QueueStatus (ForeignPtr QueueStatus_)

with_queue_status :: QueueStatus -> (Ptr QueueStatus_ -> IO a) -> IO a
with_queue_status (QueueStatus p) f = withForeignPtr p f

-- | Allocate an uninitialized object. (Not exported)
queue_status_malloc :: IO QueueStatus
queue_status_malloc = alloca $ \p ->
  do Exc.checkResult "Sequencer.queue_status" =<< snd_seq_queue_status_malloc p
     QueueStatus `fmap` (newForeignPtr snd_seq_queue_status_free =<< peek p)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_status_malloc"
  snd_seq_queue_status_malloc :: Ptr (Ptr QueueStatus_) -> IO CInt

foreign import ccall "alsa/asoundlib.h &snd_seq_queue_status_free"
   snd_seq_queue_status_free :: FunPtr (Ptr QueueStatus_ -> IO ())

-- | Copy the content of one object into another.
queue_status_copy
  :: QueueStatus     -- ^ Destination
  -> QueueStatus     -- ^ Source
  -> IO ()

queue_status_copy to from =
  with_queue_status to $ \p1 ->
  with_queue_status from $ \p2 ->
    snd_seq_queue_status_copy p1 p2

foreign import ccall "alsa/asoundlib.h snd_seq_queue_status_copy"
  snd_seq_queue_status_copy :: Ptr QueueStatus_ -> Ptr QueueStatus_ -> IO ()

-- | Copy the content of an object to a newly created object.
queue_status_clone :: QueueStatus -> IO QueueStatus
queue_status_clone from =
  do to <- queue_status_malloc
     queue_status_copy to from
     return to

instance C QueueStatus where
  malloc = queue_status_malloc
  copy = queue_status_copy
  clone = queue_status_clone

{-# LINE 226 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- Queue.T Tempo -----------------------------------------------------------------
data QueueTempo_
newtype QueueTempo = QueueTempo (ForeignPtr QueueTempo_)

with_queue_tempo :: QueueTempo -> (Ptr QueueTempo_ -> IO a) -> IO a
with_queue_tempo (QueueTempo p) f = withForeignPtr p f

-- | Allocate an uninitialized object. (Not exported)
queue_tempo_malloc :: IO QueueTempo
queue_tempo_malloc = alloca $ \p ->
  do Exc.checkResult "Sequencer.queue_tempo" =<< snd_seq_queue_tempo_malloc p
     QueueTempo `fmap` (newForeignPtr snd_seq_queue_tempo_free =<< peek p)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_malloc"
  snd_seq_queue_tempo_malloc :: Ptr (Ptr QueueTempo_) -> IO CInt

foreign import ccall "alsa/asoundlib.h &snd_seq_queue_tempo_free"
   snd_seq_queue_tempo_free :: FunPtr (Ptr QueueTempo_ -> IO ())

-- | Copy the content of one object into another.
queue_tempo_copy
  :: QueueTempo     -- ^ Destination
  -> QueueTempo     -- ^ Source
  -> IO ()

queue_tempo_copy to from =
  with_queue_tempo to $ \p1 ->
  with_queue_tempo from $ \p2 ->
    snd_seq_queue_tempo_copy p1 p2

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_copy"
  snd_seq_queue_tempo_copy :: Ptr QueueTempo_ -> Ptr QueueTempo_ -> IO ()

-- | Copy the content of an object to a newly created object.
queue_tempo_clone :: QueueTempo -> IO QueueTempo
queue_tempo_clone from =
  do to <- queue_tempo_malloc
     queue_tempo_copy to from
     return to

instance C QueueTempo where
  malloc = queue_tempo_malloc
  copy = queue_tempo_copy
  clone = queue_tempo_clone

{-# LINE 229 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- RO
queue_tempo_get_queue :: QueueTempo -> IO Queue.T
queue_tempo_get_queue i =
  Queue.imp
      `fmap` with_queue_tempo i snd_seq_queue_tempo_get_queue

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_get_queue"
  snd_seq_queue_tempo_get_queue :: Ptr QueueTempo_ -> IO CInt

{-# LINE 233 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- RW
queue_tempo_get_tempo :: QueueTempo -> IO Word
queue_tempo_get_tempo i =
  fromIntegral
      `fmap` with_queue_tempo i snd_seq_queue_tempo_get_tempo

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_get_tempo"
  snd_seq_queue_tempo_get_tempo :: Ptr QueueTempo_ -> IO CInt

{-# LINE 236 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_tempo_set_tempo :: QueueTempo -> Word -> IO ()
queue_tempo_set_tempo i c =
  with_queue_tempo i (`snd_seq_queue_tempo_set_tempo` fromIntegral c)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_set_tempo"
  snd_seq_queue_tempo_set_tempo  :: Ptr QueueTempo_ -> CInt -> IO ()

{-# LINE 237 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

queue_tempo_get_ppq :: QueueTempo -> IO Int
queue_tempo_get_ppq i =
  fromIntegral
      `fmap` with_queue_tempo i snd_seq_queue_tempo_get_ppq

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_get_ppq"
  snd_seq_queue_tempo_get_ppq :: Ptr QueueTempo_ -> IO CInt

{-# LINE 239 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_tempo_set_ppq :: QueueTempo -> Int -> IO ()
queue_tempo_set_ppq i c =
  with_queue_tempo i (`snd_seq_queue_tempo_set_ppq` fromIntegral c)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_set_ppq"
  snd_seq_queue_tempo_set_ppq  :: Ptr QueueTempo_ -> CInt -> IO ()

{-# LINE 240 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

queue_tempo_get_skew :: QueueTempo -> IO Word
queue_tempo_get_skew i =
  fromIntegral
      `fmap` with_queue_tempo i snd_seq_queue_tempo_get_skew

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_get_skew"
  snd_seq_queue_tempo_get_skew :: Ptr QueueTempo_ -> IO CInt

{-# LINE 242 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_tempo_set_skew :: QueueTempo -> Word -> IO ()
queue_tempo_set_skew i c =
  with_queue_tempo i (`snd_seq_queue_tempo_set_skew` fromIntegral c)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_set_skew"
  snd_seq_queue_tempo_set_skew  :: Ptr QueueTempo_ -> CInt -> IO ()

{-# LINE 243 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

queue_tempo_get_skew_base :: QueueTempo -> IO Word
queue_tempo_get_skew_base i =
  fromIntegral
      `fmap` with_queue_tempo i snd_seq_queue_tempo_get_skew_base

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_get_skew_base"
  snd_seq_queue_tempo_get_skew_base :: Ptr QueueTempo_ -> IO CInt

{-# LINE 245 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_tempo_set_skew_base :: QueueTempo -> Word -> IO ()
queue_tempo_set_skew_base i c =
  with_queue_tempo i (`snd_seq_queue_tempo_set_skew_base` fromIntegral c)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_tempo_set_skew_base"
  snd_seq_queue_tempo_set_skew_base  :: Ptr QueueTempo_ -> CInt -> IO ()

{-# LINE 246 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- Queue.T Timer -----------------------------------------------------------------
data QueueTimer_
newtype QueueTimer = QueueTimer (ForeignPtr QueueTimer_)

with_queue_timer :: QueueTimer -> (Ptr QueueTimer_ -> IO a) -> IO a
with_queue_timer (QueueTimer p) f = withForeignPtr p f

-- | Allocate an uninitialized object. (Not exported)
queue_timer_malloc :: IO QueueTimer
queue_timer_malloc = alloca $ \p ->
  do Exc.checkResult "Sequencer.queue_timer" =<< snd_seq_queue_timer_malloc p
     QueueTimer `fmap` (newForeignPtr snd_seq_queue_timer_free =<< peek p)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_timer_malloc"
  snd_seq_queue_timer_malloc :: Ptr (Ptr QueueTimer_) -> IO CInt

foreign import ccall "alsa/asoundlib.h &snd_seq_queue_timer_free"
   snd_seq_queue_timer_free :: FunPtr (Ptr QueueTimer_ -> IO ())

-- | Copy the content of one object into another.
queue_timer_copy
  :: QueueTimer     -- ^ Destination
  -> QueueTimer     -- ^ Source
  -> IO ()

queue_timer_copy to from =
  with_queue_timer to $ \p1 ->
  with_queue_timer from $ \p2 ->
    snd_seq_queue_timer_copy p1 p2

foreign import ccall "alsa/asoundlib.h snd_seq_queue_timer_copy"
  snd_seq_queue_timer_copy :: Ptr QueueTimer_ -> Ptr QueueTimer_ -> IO ()

-- | Copy the content of an object to a newly created object.
queue_timer_clone :: QueueTimer -> IO QueueTimer
queue_timer_clone from =
  do to <- queue_timer_malloc
     queue_timer_copy to from
     return to

instance C QueueTimer where
  malloc = queue_timer_malloc
  copy = queue_timer_copy
  clone = queue_timer_clone

{-# LINE 249 "src/Sound/ALSA/Sequencer/Area.hsc" #-}


-- RO
queue_timer_get_queue :: QueueTimer -> IO Queue.T
queue_timer_get_queue i =
  Queue.imp
      `fmap` with_queue_timer i snd_seq_queue_timer_get_queue

foreign import ccall "alsa/asoundlib.h snd_seq_queue_timer_get_queue"
  snd_seq_queue_timer_get_queue :: Ptr QueueTimer_ -> IO CInt

{-# LINE 254 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

-- RW

queue_timer_get_type :: QueueTimer -> IO QueueTimer.Type
queue_timer_get_type i =
  QueueTimer.impType
      `fmap` with_queue_timer i snd_seq_queue_timer_get_type

foreign import ccall "alsa/asoundlib.h snd_seq_queue_timer_get_type"
  snd_seq_queue_timer_get_type :: Ptr QueueTimer_ -> IO CInt

{-# LINE 259 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_timer_set_type :: QueueTimer -> QueueTimer.Type -> IO ()
queue_timer_set_type i c =
  with_queue_timer i (`snd_seq_queue_timer_set_type` QueueTimer.expType c)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_timer_set_type"
  snd_seq_queue_timer_set_type  :: Ptr QueueTimer_ -> CInt -> IO ()

{-# LINE 261 "src/Sound/ALSA/Sequencer/Area.hsc" #-}

queue_timer_get_resolution :: QueueTimer -> IO Word
queue_timer_get_resolution i =
  fromIntegral
      `fmap` with_queue_timer i snd_seq_queue_timer_get_resolution

foreign import ccall "alsa/asoundlib.h snd_seq_queue_timer_get_resolution"
  snd_seq_queue_timer_get_resolution :: Ptr QueueTimer_ -> IO CInt

{-# LINE 263 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
queue_timer_set_resolution :: QueueTimer -> Word -> IO ()
queue_timer_set_resolution i c =
  with_queue_timer i (`snd_seq_queue_timer_set_resolution` fromIntegral c)

foreign import ccall "alsa/asoundlib.h snd_seq_queue_timer_set_resolution"
  snd_seq_queue_timer_set_resolution  :: Ptr QueueTimer_ -> CInt -> IO ()

{-# LINE 264 "src/Sound/ALSA/Sequencer/Area.hsc" #-}