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

module Sound.Alsa.Sequencer.Area where

import Foreign
import Foreign.C.Types
import Foreign.C.String
import Sound.Alsa.Sequencer.Errors
import Sound.Alsa.Sequencer.Marshal


{-# LINE 64 "Sound/Alsa/Sequencer/Area.hsc" #-}


{-# LINE 79 "Sound/Alsa/Sequencer/Area.hsc" #-}


{-# LINE 96 "Sound/Alsa/Sequencer/Area.hsc" #-}


{-# LINE 106 "Sound/Alsa/Sequencer/Area.hsc" #-}


{-# LINE 115 "Sound/Alsa/Sequencer/Area.hsc" #-}



-- Client 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 uninitiazlied object. (Not exported)
client_info_malloc :: IO ClientInfo
client_info_malloc = alloca $ \p ->
  do check_error =<< 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

{-# LINE 120 "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 123 "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 124 "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 125 "Sound/Alsa/Sequencer/Area.hsc" #-}
client_info_get_client :: ClientInfo -> IO Client
client_info_get_client i =
  (imp_Client . fromIntegral)
      `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 127 "Sound/Alsa/Sequencer/Area.hsc" #-}
client_info_set_client :: ClientInfo -> Client -> IO ()
client_info_set_client i c =
  with_client_info i (`snd_seq_client_info_set_client` exp_Client c)

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

{-# LINE 129 "Sound/Alsa/Sequencer/Area.hsc" #-}

-- read only
client_info_get_type :: ClientInfo -> IO ClientType
client_info_get_type i =
  imp_ClientType
      `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 133 "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 135 "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 137 "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 uninitiazlied object. (Not exported)
port_info_malloc :: IO PortInfo
port_info_malloc = alloca $ \p ->
  do check_error =<< 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

{-# LINE 141 "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 144 "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 146 "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 147 "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 148 "Sound/Alsa/Sequencer/Area.hsc" #-}

port_info_get_port :: PortInfo -> IO Port
port_info_get_port i =
  (imp_Port . fromIntegral)
      `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 151 "Sound/Alsa/Sequencer/Area.hsc" #-}
port_info_set_port :: PortInfo -> Port -> IO ()
port_info_set_port i c =
  with_port_info i (`snd_seq_port_info_set_port` exp_Port c)

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

{-# LINE 153 "Sound/Alsa/Sequencer/Area.hsc" #-}
port_info_get_client :: PortInfo -> IO Client
port_info_get_client i =
  (imp_Client . fromIntegral)
      `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 155 "Sound/Alsa/Sequencer/Area.hsc" #-}
port_info_set_client :: PortInfo -> Client -> IO ()
port_info_set_client i c =
  with_port_info i (`snd_seq_port_info_set_client` exp_Client c)

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

{-# LINE 157 "Sound/Alsa/Sequencer/Area.hsc" #-}
port_info_get_capability :: PortInfo -> IO PortCap
port_info_get_capability i =
  (PortCap . 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 159 "Sound/Alsa/Sequencer/Area.hsc" #-}
port_info_set_capability :: PortInfo -> PortCap -> IO ()
port_info_set_capability i c =
  with_port_info i (`snd_seq_port_info_set_capability` (fromIntegral . unPortCap) c)

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

{-# LINE 161 "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 164 "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 166 "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 168 "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 170 "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 172 "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 174 "Sound/Alsa/Sequencer/Area.hsc" #-}

port_info_get_timestamp_queue :: PortInfo -> IO Queue
port_info_get_timestamp_queue i =
  (imp_Queue . fromIntegral)
      `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 177 "Sound/Alsa/Sequencer/Area.hsc" #-}
port_info_set_timestamp_queue :: PortInfo -> Queue -> IO ()
port_info_set_timestamp_queue i c =
  with_port_info i (`snd_seq_port_info_set_timestamp_queue` exp_Queue 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 179 "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 183 "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 185 "Sound/Alsa/Sequencer/Area.hsc" #-}

-- Queue 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 uninitiazlied object. (Not exported)
queue_info_malloc :: IO QueueInfo
queue_info_malloc = alloca $ \p ->
  do check_error =<< 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

{-# LINE 188 "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 189 "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 190 "Sound/Alsa/Sequencer/Area.hsc" #-}

queue_info_get_owner :: QueueInfo -> IO Client
queue_info_get_owner i =
  (imp_Client . fromIntegral)
      `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 193 "Sound/Alsa/Sequencer/Area.hsc" #-}
queue_info_set_owner :: QueueInfo -> Client -> IO ()
queue_info_set_owner i c =
  with_queue_info i (`snd_seq_queue_info_set_owner` exp_Client c)

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

{-# LINE 195 "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 197 "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 199 "Sound/Alsa/Sequencer/Area.hsc" #-}

-- RO
queue_info_get_queue :: QueueInfo -> IO Queue
queue_info_get_queue i =
  (imp_Queue . fromIntegral)
      `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 203 "Sound/Alsa/Sequencer/Area.hsc" #-}

-- Queue 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 uninitiazlied object. (Not exported)
queue_status_malloc :: IO QueueStatus
queue_status_malloc = alloca $ \p ->
  do check_error =<< 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

{-# LINE 206 "Sound/Alsa/Sequencer/Area.hsc" #-}

-- Queue 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 uninitiazlied object. (Not exported)
queue_tempo_malloc :: IO QueueTempo
queue_tempo_malloc = alloca $ \p ->
  do check_error =<< 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

{-# LINE 209 "Sound/Alsa/Sequencer/Area.hsc" #-}

-- RO
queue_tempo_get_queue :: QueueTempo -> IO Queue
queue_tempo_get_queue i =
  (imp_Queue . fromIntegral)
      `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 213 "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 216 "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 217 "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 219 "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 220 "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 222 "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 223 "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 225 "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 226 "Sound/Alsa/Sequencer/Area.hsc" #-}

-- Queue 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 uninitiazlied object. (Not exported)
queue_timer_malloc :: IO QueueTimer
queue_timer_malloc = alloca $ \p ->
  do check_error =<< 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

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


-- RO
queue_timer_get_queue :: QueueTimer -> IO Queue
queue_timer_get_queue i =
  (imp_Queue . fromIntegral)
      `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 234 "Sound/Alsa/Sequencer/Area.hsc" #-}

-- RW

queue_timer_get_type :: QueueTimer -> IO QueueTimerType
queue_timer_get_type i =
  imp_QueueTimerType
      `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 239 "Sound/Alsa/Sequencer/Area.hsc" #-}
queue_timer_set_type :: QueueTimer -> QueueTimerType -> IO ()
queue_timer_set_type i c =
  with_queue_timer i (`snd_seq_queue_timer_set_type` exp_QueueTimerType c)

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

{-# LINE 241 "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 243 "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 244 "Sound/Alsa/Sequencer/Area.hsc" #-}