{-# 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.Sequencer.Marshal.QuerySubscribe as QuerySubscribe
import qualified Sound.ALSA.Exception as Exc

import qualified Data.EnumSet as EnumSet
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 86 "src/Sound/ALSA/Sequencer/Area.hsc" #-}


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


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


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


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


{-# LINE 146 "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 unsafe "alsa/asoundlib.h snd_seq_client_info_malloc"
  snd_seq_client_info_malloc :: Ptr (Ptr ClientInfo_) -> IO CInt

foreign import ccall unsafe "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 unsafe "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 151 "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 unsafe "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 unsafe "alsa/asoundlib.h snd_seq_client_info_set_name"
  snd_seq_client_info_set_name :: Ptr ClientInfo_ -> CString -> IO ()

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

foreign import ccall unsafe "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 unsafe "alsa/asoundlib.h snd_seq_client_info_set_broadcast_filter"
  snd_seq_client_info_set_broadcast_filter :: Ptr ClientInfo_ -> CInt -> IO ()

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

foreign import ccall unsafe "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 unsafe "alsa/asoundlib.h snd_seq_client_info_set_error_bounce"
  snd_seq_client_info_set_error_bounce :: Ptr ClientInfo_ -> CInt -> IO ()

{-# LINE 156 "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 unsafe "alsa/asoundlib.h snd_seq_client_info_get_client"
  snd_seq_client_info_get_client :: Ptr ClientInfo_ -> IO CInt

{-# LINE 158 "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 unsafe "alsa/asoundlib.h snd_seq_client_info_set_client"
  snd_seq_client_info_set_client  :: Ptr ClientInfo_ -> CInt -> IO ()

{-# LINE 160 "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 unsafe "alsa/asoundlib.h snd_seq_client_info_get_type"
  snd_seq_client_info_get_type :: Ptr ClientInfo_ -> IO CInt

{-# LINE 164 "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 unsafe "alsa/asoundlib.h snd_seq_client_info_get_num_ports"
  snd_seq_client_info_get_num_ports :: Ptr ClientInfo_ -> IO CInt

{-# LINE 166 "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 unsafe "alsa/asoundlib.h snd_seq_client_info_get_event_lost"
  snd_seq_client_info_get_event_lost :: Ptr ClientInfo_ -> IO CInt

{-# LINE 168 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_malloc"
  snd_seq_port_info_malloc :: Ptr (Ptr PortInfo_) -> IO CInt

foreign import ccall unsafe "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 unsafe "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 172 "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 unsafe "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_name"
  snd_seq_port_info_set_name :: Ptr PortInfo_ -> CString -> IO ()

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

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

foreign import ccall unsafe "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_port_specified"
  snd_seq_port_info_set_port_specified :: Ptr PortInfo_ -> CInt -> IO ()

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

foreign import ccall unsafe "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_timestamping"
  snd_seq_port_info_set_timestamping :: Ptr PortInfo_ -> CInt -> IO ()

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

foreign import ccall unsafe "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_timestamp_real"
  snd_seq_port_info_set_timestamp_real :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 179 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_get_port"
  snd_seq_port_info_get_port :: Ptr PortInfo_ -> IO CInt

{-# LINE 182 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_port"
  snd_seq_port_info_set_port  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 184 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_get_client"
  snd_seq_port_info_get_client :: Ptr PortInfo_ -> IO CInt

{-# LINE 186 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_client"
  snd_seq_port_info_set_client  :: Ptr PortInfo_ -> CInt -> IO ()

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

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

{-# LINE 190 "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 . EnumSet.decons) c)

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

{-# LINE 192 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_get_midi_channels"
  snd_seq_port_info_get_midi_channels :: Ptr PortInfo_ -> IO CInt

{-# LINE 195 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_midi_channels"
  snd_seq_port_info_set_midi_channels  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 197 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_get_midi_voices"
  snd_seq_port_info_get_midi_voices :: Ptr PortInfo_ -> IO CInt

{-# LINE 199 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_midi_voices"
  snd_seq_port_info_set_midi_voices  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 201 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_get_synth_voices"
  snd_seq_port_info_get_synth_voices :: Ptr PortInfo_ -> IO CInt

{-# LINE 203 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_synth_voices"
  snd_seq_port_info_set_synth_voices  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 205 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_get_timestamp_queue"
  snd_seq_port_info_get_timestamp_queue :: Ptr PortInfo_ -> IO CInt

{-# LINE 208 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_set_timestamp_queue"
  snd_seq_port_info_set_timestamp_queue  :: Ptr PortInfo_ -> CInt -> IO ()

{-# LINE 210 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_get_read_use"
  snd_seq_port_info_get_read_use :: Ptr PortInfo_ -> IO CInt

{-# LINE 214 "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 unsafe "alsa/asoundlib.h snd_seq_port_info_get_write_use"
  snd_seq_port_info_get_write_use :: Ptr PortInfo_ -> IO CInt

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

-- Subscribe Port ----------------------------------------------------------------
data PortSubscribe_
newtype PortSubscribe = PortSubscribe (ForeignPtr PortSubscribe_)

with_port_subscribe :: PortSubscribe -> (Ptr PortSubscribe_ -> IO a) -> IO a
with_port_subscribe (PortSubscribe p) f = withForeignPtr p f

-- | Allocate an uninitialized object. (Not exported)
port_subscribe_malloc :: IO PortSubscribe
port_subscribe_malloc = alloca $ \p ->
  do Exc.checkResult_ "Sequencer.port_subscribe" =<< snd_seq_port_subscribe_malloc p
     PortSubscribe `fmap` (newForeignPtr snd_seq_port_subscribe_free =<< peek p)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_malloc"
  snd_seq_port_subscribe_malloc :: Ptr (Ptr PortSubscribe_) -> IO CInt

foreign import ccall unsafe "alsa/asoundlib.h &snd_seq_port_subscribe_free"
   snd_seq_port_subscribe_free :: FunPtr (Ptr PortSubscribe_ -> IO ())

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

port_subscribe_copy to from =
  with_port_subscribe to $ \p1 ->
  with_port_subscribe from $ \p2 ->
    snd_seq_port_subscribe_copy p1 p2

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_copy"
  snd_seq_port_subscribe_copy :: Ptr PortSubscribe_ -> Ptr PortSubscribe_ -> IO ()

-- | Copy the content of an object to a newly created object.
port_subscribe_clone :: PortSubscribe -> IO PortSubscribe
port_subscribe_clone from =
  do to <- port_subscribe_malloc
     port_subscribe_copy to from
     return to

instance C PortSubscribe where
  malloc = port_subscribe_malloc
  copy = port_subscribe_copy
  clone = port_subscribe_clone

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

port_subscribe_get_queue :: PortSubscribe -> IO Queue.T
port_subscribe_get_queue i =
  Queue.imp
      `fmap` with_port_subscribe i snd_seq_port_subscribe_get_queue

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_get_queue"
  snd_seq_port_subscribe_get_queue :: Ptr PortSubscribe_ -> IO CInt

{-# LINE 222 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_subscribe_set_queue :: PortSubscribe -> Queue.T -> IO ()
port_subscribe_set_queue i c =
  with_port_subscribe i (`snd_seq_port_subscribe_set_queue` Queue.exp c)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_set_queue"
  snd_seq_port_subscribe_set_queue  :: Ptr PortSubscribe_ -> CInt -> IO ()

{-# LINE 224 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_subscribe_get_exclusive :: PortSubscribe -> IO Bool
port_subscribe_get_exclusive i =
  (0 /=) `fmap` with_port_subscribe i snd_seq_port_subscribe_get_exclusive

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_get_exclusive"
  snd_seq_port_subscribe_get_exclusive :: Ptr PortSubscribe_ -> IO CInt

port_subscribe_set_exclusive :: PortSubscribe -> Bool -> IO ()
port_subscribe_set_exclusive i c =
  let x = if c then 1 else 0
  in with_port_subscribe i (`snd_seq_port_subscribe_set_exclusive` x)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_set_exclusive"
  snd_seq_port_subscribe_set_exclusive :: Ptr PortSubscribe_ -> CInt -> IO ()

{-# LINE 225 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_subscribe_get_time_update :: PortSubscribe -> IO Bool
port_subscribe_get_time_update i =
  (0 /=) `fmap` with_port_subscribe i snd_seq_port_subscribe_get_time_update

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_get_time_update"
  snd_seq_port_subscribe_get_time_update :: Ptr PortSubscribe_ -> IO CInt

port_subscribe_set_time_update :: PortSubscribe -> Bool -> IO ()
port_subscribe_set_time_update i c =
  let x = if c then 1 else 0
  in with_port_subscribe i (`snd_seq_port_subscribe_set_time_update` x)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_set_time_update"
  snd_seq_port_subscribe_set_time_update :: Ptr PortSubscribe_ -> CInt -> IO ()

{-# LINE 226 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
port_subscribe_get_time_real :: PortSubscribe -> IO Bool
port_subscribe_get_time_real i =
  (0 /=) `fmap` with_port_subscribe i snd_seq_port_subscribe_get_time_real

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_get_time_real"
  snd_seq_port_subscribe_get_time_real :: Ptr PortSubscribe_ -> IO CInt

port_subscribe_set_time_real :: PortSubscribe -> Bool -> IO ()
port_subscribe_set_time_real i c =
  let x = if c then 1 else 0
  in with_port_subscribe i (`snd_seq_port_subscribe_set_time_real` x)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_port_subscribe_set_time_real"
  snd_seq_port_subscribe_set_time_real :: Ptr PortSubscribe_ -> CInt -> IO ()

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

-- Subscribe Query ---------------------------------------------------------------
data QuerySubscribe_
newtype QuerySubscribe = QuerySubscribe (ForeignPtr QuerySubscribe_)

with_query_subscribe :: QuerySubscribe -> (Ptr QuerySubscribe_ -> IO a) -> IO a
with_query_subscribe (QuerySubscribe p) f = withForeignPtr p f

-- | Allocate an uninitialized object. (Not exported)
query_subscribe_malloc :: IO QuerySubscribe
query_subscribe_malloc = alloca $ \p ->
  do Exc.checkResult_ "Sequencer.query_subscribe" =<< snd_seq_query_subscribe_malloc p
     QuerySubscribe `fmap` (newForeignPtr snd_seq_query_subscribe_free =<< peek p)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_malloc"
  snd_seq_query_subscribe_malloc :: Ptr (Ptr QuerySubscribe_) -> IO CInt

foreign import ccall unsafe "alsa/asoundlib.h &snd_seq_query_subscribe_free"
   snd_seq_query_subscribe_free :: FunPtr (Ptr QuerySubscribe_ -> IO ())

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

query_subscribe_copy to from =
  with_query_subscribe to $ \p1 ->
  with_query_subscribe from $ \p2 ->
    snd_seq_query_subscribe_copy p1 p2

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_copy"
  snd_seq_query_subscribe_copy :: Ptr QuerySubscribe_ -> Ptr QuerySubscribe_ -> IO ()

-- | Copy the content of an object to a newly created object.
query_subscribe_clone :: QuerySubscribe -> IO QuerySubscribe
query_subscribe_clone from =
  do to <- query_subscribe_malloc
     query_subscribe_copy to from
     return to

instance C QuerySubscribe where
  malloc = query_subscribe_malloc
  copy = query_subscribe_copy
  clone = query_subscribe_clone

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

query_subscribe_get_client :: QuerySubscribe -> IO Client.T
query_subscribe_get_client i =
  Client.imp
      `fmap` with_query_subscribe i snd_seq_query_subscribe_get_client

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_get_client"
  snd_seq_query_subscribe_get_client :: Ptr QuerySubscribe_ -> IO CInt

{-# LINE 233 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_set_client :: QuerySubscribe -> Client.T -> IO ()
query_subscribe_set_client i c =
  with_query_subscribe i (`snd_seq_query_subscribe_set_client` Client.exp c)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_set_client"
  snd_seq_query_subscribe_set_client  :: Ptr QuerySubscribe_ -> CInt -> IO ()

{-# LINE 235 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_get_port :: QuerySubscribe -> IO Port.T
query_subscribe_get_port i =
  Port.imp
      `fmap` with_query_subscribe i snd_seq_query_subscribe_get_port

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_get_port"
  snd_seq_query_subscribe_get_port :: Ptr QuerySubscribe_ -> IO CInt

{-# LINE 237 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_set_port :: QuerySubscribe -> Port.T -> IO ()
query_subscribe_set_port i c =
  with_query_subscribe i (`snd_seq_query_subscribe_set_port` Port.exp c)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_set_port"
  snd_seq_query_subscribe_set_port  :: Ptr QuerySubscribe_ -> CInt -> IO ()

{-# LINE 239 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_get_type :: QuerySubscribe -> IO QuerySubscribe.Type
query_subscribe_get_type i =
  QuerySubscribe.impType
      `fmap` with_query_subscribe i snd_seq_query_subscribe_get_type

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_get_type"
  snd_seq_query_subscribe_get_type :: Ptr QuerySubscribe_ -> IO CInt

{-# LINE 241 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_set_type :: QuerySubscribe -> QuerySubscribe.Type -> IO ()
query_subscribe_set_type i c =
  with_query_subscribe i (`snd_seq_query_subscribe_set_type` QuerySubscribe.expType c)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_set_type"
  snd_seq_query_subscribe_set_type  :: Ptr QuerySubscribe_ -> CInt -> IO ()

{-# LINE 243 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_get_index :: QuerySubscribe -> IO Word
query_subscribe_get_index i =
  fromIntegral
      `fmap` with_query_subscribe i snd_seq_query_subscribe_get_index

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_get_index"
  snd_seq_query_subscribe_get_index :: Ptr QuerySubscribe_ -> IO CInt

{-# LINE 245 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_set_index :: QuerySubscribe -> Word -> IO ()
query_subscribe_set_index i c =
  with_query_subscribe i (`snd_seq_query_subscribe_set_index` fromIntegral c)

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_set_index"
  snd_seq_query_subscribe_set_index  :: Ptr QuerySubscribe_ -> CInt -> IO ()

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

-- RO
query_subscribe_get_num_subs :: QuerySubscribe -> IO Word
query_subscribe_get_num_subs i =
  fromIntegral
      `fmap` with_query_subscribe i snd_seq_query_subscribe_get_num_subs

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_get_num_subs"
  snd_seq_query_subscribe_get_num_subs :: Ptr QuerySubscribe_ -> IO CInt

{-# LINE 251 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_get_queue :: QuerySubscribe -> IO Queue.T
query_subscribe_get_queue i =
  Queue.imp
      `fmap` with_query_subscribe i snd_seq_query_subscribe_get_queue

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_get_queue"
  snd_seq_query_subscribe_get_queue :: Ptr QuerySubscribe_ -> IO CInt

{-# LINE 253 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_get_exclusive :: QuerySubscribe -> IO Bool
query_subscribe_get_exclusive i =
  (0 /=) `fmap` with_query_subscribe i snd_seq_query_subscribe_get_exclusive

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_get_exclusive"
  snd_seq_query_subscribe_get_exclusive :: Ptr QuerySubscribe_ -> IO CInt

{-# LINE 254 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_get_time_update :: QuerySubscribe -> IO Bool
query_subscribe_get_time_update i =
  (0 /=) `fmap` with_query_subscribe i snd_seq_query_subscribe_get_time_update

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_get_time_update"
  snd_seq_query_subscribe_get_time_update :: Ptr QuerySubscribe_ -> IO CInt

{-# LINE 255 "src/Sound/ALSA/Sequencer/Area.hsc" #-}
query_subscribe_get_time_real :: QuerySubscribe -> IO Bool
query_subscribe_get_time_real i =
  (0 /=) `fmap` with_query_subscribe i snd_seq_query_subscribe_get_time_real

foreign import ccall unsafe "alsa/asoundlib.h snd_seq_query_subscribe_get_time_real"
  snd_seq_query_subscribe_get_time_real :: Ptr QuerySubscribe_ -> IO CInt

{-# LINE 256 "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 unsafe "alsa/asoundlib.h snd_seq_queue_info_malloc"
  snd_seq_queue_info_malloc :: Ptr (Ptr QueueInfo_) -> IO CInt

foreign import ccall unsafe "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 unsafe "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 259 "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 unsafe "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 unsafe "alsa/asoundlib.h snd_seq_queue_info_set_name"
  snd_seq_queue_info_set_name :: Ptr QueueInfo_ -> CString -> IO ()

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

foreign import ccall unsafe "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 unsafe "alsa/asoundlib.h snd_seq_queue_info_set_locked"
  snd_seq_queue_info_set_locked :: Ptr QueueInfo_ -> CInt -> IO ()

{-# LINE 261 "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 unsafe "alsa/asoundlib.h snd_seq_queue_info_get_owner"
  snd_seq_queue_info_get_owner :: Ptr QueueInfo_ -> IO CInt

{-# LINE 264 "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 unsafe "alsa/asoundlib.h snd_seq_queue_info_set_owner"
  snd_seq_queue_info_set_owner  :: Ptr QueueInfo_ -> CInt -> IO ()

{-# LINE 266 "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 unsafe "alsa/asoundlib.h snd_seq_queue_info_get_flags"
  snd_seq_queue_info_get_flags :: Ptr QueueInfo_ -> IO CInt

{-# LINE 268 "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 unsafe "alsa/asoundlib.h snd_seq_queue_info_set_flags"
  snd_seq_queue_info_set_flags  :: Ptr QueueInfo_ -> CInt -> IO ()

{-# LINE 270 "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 unsafe "alsa/asoundlib.h snd_seq_queue_info_get_queue"
  snd_seq_queue_info_get_queue :: Ptr QueueInfo_ -> IO CInt

{-# LINE 274 "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 unsafe "alsa/asoundlib.h snd_seq_queue_status_malloc"
  snd_seq_queue_status_malloc :: Ptr (Ptr QueueStatus_) -> IO CInt

foreign import ccall unsafe "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 unsafe "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 277 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_malloc"
  snd_seq_queue_tempo_malloc :: Ptr (Ptr QueueTempo_) -> IO CInt

foreign import ccall unsafe "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 unsafe "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 280 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_get_queue"
  snd_seq_queue_tempo_get_queue :: Ptr QueueTempo_ -> IO CInt

{-# LINE 284 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_get_tempo"
  snd_seq_queue_tempo_get_tempo :: Ptr QueueTempo_ -> IO CInt

{-# LINE 287 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_set_tempo"
  snd_seq_queue_tempo_set_tempo  :: Ptr QueueTempo_ -> CInt -> IO ()

{-# LINE 288 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_get_ppq"
  snd_seq_queue_tempo_get_ppq :: Ptr QueueTempo_ -> IO CInt

{-# LINE 290 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_set_ppq"
  snd_seq_queue_tempo_set_ppq  :: Ptr QueueTempo_ -> CInt -> IO ()

{-# LINE 291 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_get_skew"
  snd_seq_queue_tempo_get_skew :: Ptr QueueTempo_ -> IO CInt

{-# LINE 293 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_set_skew"
  snd_seq_queue_tempo_set_skew  :: Ptr QueueTempo_ -> CInt -> IO ()

{-# LINE 294 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_get_skew_base"
  snd_seq_queue_tempo_get_skew_base :: Ptr QueueTempo_ -> IO CInt

{-# LINE 296 "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 unsafe "alsa/asoundlib.h snd_seq_queue_tempo_set_skew_base"
  snd_seq_queue_tempo_set_skew_base  :: Ptr QueueTempo_ -> CInt -> IO ()

{-# LINE 297 "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 unsafe "alsa/asoundlib.h snd_seq_queue_timer_malloc"
  snd_seq_queue_timer_malloc :: Ptr (Ptr QueueTimer_) -> IO CInt

foreign import ccall unsafe "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 unsafe "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 300 "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 unsafe "alsa/asoundlib.h snd_seq_queue_timer_get_queue"
  snd_seq_queue_timer_get_queue :: Ptr QueueTimer_ -> IO CInt

{-# LINE 305 "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 unsafe "alsa/asoundlib.h snd_seq_queue_timer_get_type"
  snd_seq_queue_timer_get_type :: Ptr QueueTimer_ -> IO CInt

{-# LINE 310 "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 unsafe "alsa/asoundlib.h snd_seq_queue_timer_set_type"
  snd_seq_queue_timer_set_type  :: Ptr QueueTimer_ -> CInt -> IO ()

{-# LINE 312 "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 unsafe "alsa/asoundlib.h snd_seq_queue_timer_get_resolution"
  snd_seq_queue_timer_get_resolution :: Ptr QueueTimer_ -> IO CInt

{-# LINE 314 "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 unsafe "alsa/asoundlib.h snd_seq_queue_timer_set_resolution"
  snd_seq_queue_timer_set_resolution  :: Ptr QueueTimer_ -> CInt -> IO ()

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