{-# LINE 1 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
{-# LANGUAGE ForeignFunctionInterface #-}
module Sound.ALSA.PCM.Core.HwParams where

import Sound.ALSA.PCM.Core.Handle (Handle, Time, Size, SampleFreq, )
import qualified Sound.ALSA.PCM.Core.Handle as H -- expose Handle constructor to FFI
import qualified Sound.ALSA.PCM.Core.Convert as Conv
import Sound.ALSA.PCM.Core.Convert (fromHaskell, )

import Sound.ALSA.Exception (checkResult, checkResult_, )

import Control.Applicative (Applicative(pure, (<*>)))

import Control.Exception (bracket, )

import qualified Foreign.Storable.Newtype as Store

import qualified Foreign.C.Types as C
import qualified Foreign.C.Error as E
import Foreign.Ptr (Ptr, )
import Foreign.Storable (Storable, sizeOf, alignment, peek, poke, )
import Foreign.Marshal.Alloc (alloca, )

import Data.Word (Word, )

import Prelude hiding (any, )






newtype T i y a = Cons (H.Handle i y -> Ptr Params -> IO a)

data Params = Params


{-
T is a Reader monad.
-}
instance Functor (T i y) where
   fmap :: forall a b. (a -> b) -> T i y a -> T i y b
fmap a -> b
f (Cons Handle i y -> Ptr Params -> IO a
act) = (Handle i y -> Ptr Params -> IO b) -> T i y b
forall i y a. (Handle i y -> Ptr Params -> IO a) -> T i y a
Cons ((Handle i y -> Ptr Params -> IO b) -> T i y b)
-> (Handle i y -> Ptr Params -> IO b) -> T i y b
forall a b. (a -> b) -> a -> b
$ \Handle i y
h Ptr Params
p -> (a -> b) -> IO a -> IO b
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f (IO a -> IO b) -> IO a -> IO b
forall a b. (a -> b) -> a -> b
$ Handle i y -> Ptr Params -> IO a
act Handle i y
h Ptr Params
p

instance Applicative (T i y) where
   pure :: forall a. a -> T i y a
pure a
a = (Handle i y -> Ptr Params -> IO a) -> T i y a
forall i y a. (Handle i y -> Ptr Params -> IO a) -> T i y a
Cons ((Handle i y -> Ptr Params -> IO a) -> T i y a)
-> (Handle i y -> Ptr Params -> IO a) -> T i y a
forall a b. (a -> b) -> a -> b
$ \ Handle i y
_h Ptr Params
_p -> a -> IO a
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
a
   Cons Handle i y -> Ptr Params -> IO (a -> b)
f <*> :: forall a b. T i y (a -> b) -> T i y a -> T i y b
<*> Cons Handle i y -> Ptr Params -> IO a
x = (Handle i y -> Ptr Params -> IO b) -> T i y b
forall i y a. (Handle i y -> Ptr Params -> IO a) -> T i y a
Cons ((Handle i y -> Ptr Params -> IO b) -> T i y b)
-> (Handle i y -> Ptr Params -> IO b) -> T i y b
forall a b. (a -> b) -> a -> b
$ \Handle i y
h Ptr Params
p -> Handle i y -> Ptr Params -> IO (a -> b)
f Handle i y
h Ptr Params
p IO (a -> b) -> IO a -> IO b
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Handle i y -> Ptr Params -> IO a
x Handle i y
h Ptr Params
p

instance Monad (T i y) where
   return :: forall a. a -> T i y a
return = a -> T i y a
forall a. a -> T i y a
forall (f :: * -> *) a. Applicative f => a -> f a
pure
   Cons Handle i y -> Ptr Params -> IO a
x >>= :: forall a b. T i y a -> (a -> T i y b) -> T i y b
>>= a -> T i y b
k =
      (Handle i y -> Ptr Params -> IO b) -> T i y b
forall i y a. (Handle i y -> Ptr Params -> IO a) -> T i y a
Cons ((Handle i y -> Ptr Params -> IO b) -> T i y b)
-> (Handle i y -> Ptr Params -> IO b) -> T i y b
forall a b. (a -> b) -> a -> b
$ \Handle i y
h Ptr Params
p -> Handle i y -> Ptr Params -> IO a
x Handle i y
h Ptr Params
p IO a -> (a -> IO b) -> IO b
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \a
a -> case a -> T i y b
k a
a of Cons Handle i y -> Ptr Params -> IO b
y -> Handle i y -> Ptr Params -> IO b
y Handle i y
h Ptr Params
p



withIO :: Handle i y -> (Ptr Params -> IO a) -> IO a
withIO :: forall i y a. Handle i y -> (Ptr Params -> IO a) -> IO a
withIO Handle i y
h Ptr Params -> IO a
f =
   IO (Ptr Params)
-> (Ptr Params -> IO ()) -> (Ptr Params -> IO a) -> IO a
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket IO (Ptr Params)
malloc Ptr Params -> IO ()
free ((Ptr Params -> IO a) -> IO a) -> (Ptr Params -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \Ptr Params
p -> do
      Handle i y -> Ptr Params -> IO ()
forall i y. Handle i y -> Ptr Params -> IO ()
any Handle i y
h Ptr Params
p
      a
x <- Ptr Params -> IO a
f Ptr Params
p
      Handle i y -> Ptr Params -> IO ()
forall i y. Handle i y -> Ptr Params -> IO ()
set Handle i y
h Ptr Params
p
      a -> IO a
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return a
x
--    bracket_ (any h p) (set h p) (f p)


foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_malloc"
   malloc_ :: Ptr (Ptr Params) -> IO C.CInt

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_free"
   free :: Ptr Params -> IO ()

malloc :: IO (Ptr Params)
malloc :: IO (Ptr Params)
malloc =
   (Ptr (Ptr Params) -> IO (Ptr Params)) -> IO (Ptr Params)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr (Ptr Params) -> IO (Ptr Params)) -> IO (Ptr Params))
-> (Ptr (Ptr Params) -> IO (Ptr Params)) -> IO (Ptr Params)
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr Params)
pp ->
   Ptr (Ptr Params) -> IO CInt
malloc_ Ptr (Ptr Params)
pp IO CInt -> (CInt -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
   String -> CInt -> IO ()
forall a. Integral a => String -> a -> IO ()
checkResult_ String
"HwParams.malloc" IO () -> IO (Ptr Params) -> IO (Ptr Params)
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
   Ptr (Ptr Params) -> IO (Ptr Params)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Params)
pp



foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params"
   set_ :: Handle i y -> Ptr Params -> IO C.CInt

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_any"
   any_ :: Handle i y -> Ptr Params -> IO C.CInt

set :: Handle i y -> Ptr Params -> IO ()
set :: forall i y. Handle i y -> Ptr Params -> IO ()
set Handle i y
h Ptr Params
p =
   Handle i y -> Ptr Params -> IO CInt
forall i y. Handle i y -> Ptr Params -> IO CInt
set_ Handle i y
h Ptr Params
p IO CInt -> (CInt -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= String -> CInt -> IO ()
forall a. Integral a => String -> a -> IO ()
checkResult_ String
"HwParams.set"

any :: Handle i y -> Ptr Params -> IO ()
any :: forall i y. Handle i y -> Ptr Params -> IO ()
any Handle i y
h Ptr Params
p =
   Handle i y -> Ptr Params -> IO CInt
forall i y. Handle i y -> Ptr Params -> IO CInt
any_ Handle i y
h Ptr Params
p IO CInt -> (CInt -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= String -> CInt -> IO ()
forall a. Integral a => String -> a -> IO ()
checkResult_ String
"HwParams.any"

-- #accessor checked, "any", pcm_params, NULL


newtype Bool_ = Bool_ {Bool_ -> CInt
fromBool_ :: C.CInt}
   deriving (Bool_ -> Bool_ -> Bool
(Bool_ -> Bool_ -> Bool) -> (Bool_ -> Bool_ -> Bool) -> Eq Bool_
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Bool_ -> Bool_ -> Bool
== :: Bool_ -> Bool_ -> Bool
$c/= :: Bool_ -> Bool_ -> Bool
/= :: Bool_ -> Bool_ -> Bool
Eq, Eq Bool_
Eq Bool_
-> (Bool_ -> Bool_ -> Ordering)
-> (Bool_ -> Bool_ -> Bool)
-> (Bool_ -> Bool_ -> Bool)
-> (Bool_ -> Bool_ -> Bool)
-> (Bool_ -> Bool_ -> Bool)
-> (Bool_ -> Bool_ -> Bool_)
-> (Bool_ -> Bool_ -> Bool_)
-> Ord Bool_
Bool_ -> Bool_ -> Bool
Bool_ -> Bool_ -> Ordering
Bool_ -> Bool_ -> Bool_
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Bool_ -> Bool_ -> Ordering
compare :: Bool_ -> Bool_ -> Ordering
$c< :: Bool_ -> Bool_ -> Bool
< :: Bool_ -> Bool_ -> Bool
$c<= :: Bool_ -> Bool_ -> Bool
<= :: Bool_ -> Bool_ -> Bool
$c> :: Bool_ -> Bool_ -> Bool
> :: Bool_ -> Bool_ -> Bool
$c>= :: Bool_ -> Bool_ -> Bool
>= :: Bool_ -> Bool_ -> Bool
$cmax :: Bool_ -> Bool_ -> Bool_
max :: Bool_ -> Bool_ -> Bool_
$cmin :: Bool_ -> Bool_ -> Bool_
min :: Bool_ -> Bool_ -> Bool_
Ord)

instance Storable Bool_ where
   sizeOf :: Bool_ -> Int
sizeOf = (Bool_ -> CInt) -> Bool_ -> Int
forall core wrapper.
Storable core =>
(wrapper -> core) -> wrapper -> Int
Store.sizeOf Bool_ -> CInt
fromBool_
   alignment :: Bool_ -> Int
alignment = (Bool_ -> CInt) -> Bool_ -> Int
forall core wrapper.
Storable core =>
(wrapper -> core) -> wrapper -> Int
Store.alignment Bool_ -> CInt
fromBool_
   peek :: Ptr Bool_ -> IO Bool_
peek = (CInt -> Bool_) -> Ptr Bool_ -> IO Bool_
forall core wrapper.
Storable core =>
(core -> wrapper) -> Ptr wrapper -> IO wrapper
Store.peek CInt -> Bool_
Bool_
   poke :: Ptr Bool_ -> Bool_ -> IO ()
poke = (Bool_ -> CInt) -> Ptr Bool_ -> Bool_ -> IO ()
forall core wrapper.
Storable core =>
(wrapper -> core) -> Ptr wrapper -> wrapper -> IO ()
Store.poke Bool_ -> CInt
fromBool_

boolConv :: Conv.T Bool Bool_
boolConv :: T Bool Bool_
boolConv =
   (Bool -> Bool_) -> (Bool_ -> Bool) -> T Bool Bool_
forall h c. (h -> c) -> (c -> h) -> T h c
Conv.Cons
      (\Bool
b -> CInt -> Bool_
Bool_ (CInt -> Bool_) -> CInt -> Bool_
forall a b. (a -> b) -> a -> b
$ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Int -> CInt
forall a b. (a -> b) -> a -> b
$ Bool -> Int
forall a. Enum a => a -> Int
fromEnum Bool
b)
      (CInt -> Bool_
Bool_ CInt
0 Bool_ -> Bool_ -> Bool
forall a. Eq a => a -> a -> Bool
/=)


newtype Direction = Direction {Direction -> CInt
fromDirection :: C.CInt}
   deriving (Direction -> Direction -> Bool
(Direction -> Direction -> Bool)
-> (Direction -> Direction -> Bool) -> Eq Direction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Direction -> Direction -> Bool
== :: Direction -> Direction -> Bool
$c/= :: Direction -> Direction -> Bool
/= :: Direction -> Direction -> Bool
Eq, Eq Direction
Eq Direction
-> (Direction -> Direction -> Ordering)
-> (Direction -> Direction -> Bool)
-> (Direction -> Direction -> Bool)
-> (Direction -> Direction -> Bool)
-> (Direction -> Direction -> Bool)
-> (Direction -> Direction -> Direction)
-> (Direction -> Direction -> Direction)
-> Ord Direction
Direction -> Direction -> Bool
Direction -> Direction -> Ordering
Direction -> Direction -> Direction
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Direction -> Direction -> Ordering
compare :: Direction -> Direction -> Ordering
$c< :: Direction -> Direction -> Bool
< :: Direction -> Direction -> Bool
$c<= :: Direction -> Direction -> Bool
<= :: Direction -> Direction -> Bool
$c> :: Direction -> Direction -> Bool
> :: Direction -> Direction -> Bool
$c>= :: Direction -> Direction -> Bool
>= :: Direction -> Direction -> Bool
$cmax :: Direction -> Direction -> Direction
max :: Direction -> Direction -> Direction
$cmin :: Direction -> Direction -> Direction
min :: Direction -> Direction -> Direction
Ord)

instance Storable Direction where
   sizeOf :: Direction -> Int
sizeOf = (Direction -> CInt) -> Direction -> Int
forall core wrapper.
Storable core =>
(wrapper -> core) -> wrapper -> Int
Store.sizeOf Direction -> CInt
fromDirection
   alignment :: Direction -> Int
alignment = (Direction -> CInt) -> Direction -> Int
forall core wrapper.
Storable core =>
(wrapper -> core) -> wrapper -> Int
Store.alignment Direction -> CInt
fromDirection
   peek :: Ptr Direction -> IO Direction
peek = (CInt -> Direction) -> Ptr Direction -> IO Direction
forall core wrapper.
Storable core =>
(core -> wrapper) -> Ptr wrapper -> IO wrapper
Store.peek CInt -> Direction
Direction
   poke :: Ptr Direction -> Direction -> IO ()
poke = (Direction -> CInt) -> Ptr Direction -> Direction -> IO ()
forall core wrapper.
Storable core =>
(wrapper -> core) -> Ptr wrapper -> wrapper -> IO ()
Store.poke Direction -> CInt
fromDirection

ordConv :: Conv.T Ordering Direction
ordConv :: T Ordering Direction
ordConv =
   (Ordering -> Direction)
-> (Direction -> Ordering) -> T Ordering Direction
forall h c. (h -> c) -> (c -> h) -> T h c
Conv.Cons
      (\Ordering
o -> CInt -> Direction
Direction (CInt -> Direction) -> CInt -> Direction
forall a b. (a -> b) -> a -> b
$ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Int -> CInt
forall a b. (a -> b) -> a -> b
$ Ordering -> Int
forall a. Enum a => a -> Int
fromEnum Ordering
o Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1)
      (\Direction
d -> Direction -> Direction -> Ordering
forall a. Ord a => a -> a -> Ordering
compare Direction
d (Direction -> Ordering) -> Direction -> Ordering
forall a b. (a -> b) -> a -> b
$ CInt -> Direction
Direction CInt
0)


newtype Access = Access {Access -> CInt
fromAccess :: C.CInt}
   deriving (Access -> Access -> Bool
(Access -> Access -> Bool)
-> (Access -> Access -> Bool) -> Eq Access
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Access -> Access -> Bool
== :: Access -> Access -> Bool
$c/= :: Access -> Access -> Bool
/= :: Access -> Access -> Bool
Eq, Eq Access
Eq Access
-> (Access -> Access -> Ordering)
-> (Access -> Access -> Bool)
-> (Access -> Access -> Bool)
-> (Access -> Access -> Bool)
-> (Access -> Access -> Bool)
-> (Access -> Access -> Access)
-> (Access -> Access -> Access)
-> Ord Access
Access -> Access -> Bool
Access -> Access -> Ordering
Access -> Access -> Access
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Access -> Access -> Ordering
compare :: Access -> Access -> Ordering
$c< :: Access -> Access -> Bool
< :: Access -> Access -> Bool
$c<= :: Access -> Access -> Bool
<= :: Access -> Access -> Bool
$c> :: Access -> Access -> Bool
> :: Access -> Access -> Bool
$c>= :: Access -> Access -> Bool
>= :: Access -> Access -> Bool
$cmax :: Access -> Access -> Access
max :: Access -> Access -> Access
$cmin :: Access -> Access -> Access
min :: Access -> Access -> Access
Ord)

instance Enum Access where
   toEnum :: Int -> Access
toEnum Int
n = CInt -> Access
Access (CInt -> Access) -> CInt -> Access
forall a b. (a -> b) -> a -> b
$ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n
   fromEnum :: Access -> Int
fromEnum (Access CInt
n) = CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
n

instance Bounded Access where
   minBound :: Access
minBound = CInt -> Access
Access CInt
0
{-# LINE 137 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
   maxBound = Access 4
{-# LINE 138 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

instance Storable Access where
   sizeOf :: Access -> Int
sizeOf = (Access -> CInt) -> Access -> Int
forall core wrapper.
Storable core =>
(wrapper -> core) -> wrapper -> Int
Store.sizeOf Access -> CInt
fromAccess
   alignment :: Access -> Int
alignment = (Access -> CInt) -> Access -> Int
forall core wrapper.
Storable core =>
(wrapper -> core) -> wrapper -> Int
Store.alignment Access -> CInt
fromAccess
   peek :: Ptr Access -> IO Access
peek = (CInt -> Access) -> Ptr Access -> IO Access
forall core wrapper.
Storable core =>
(core -> wrapper) -> Ptr wrapper -> IO wrapper
Store.peek CInt -> Access
Access
   poke :: Ptr Access -> Access -> IO ()
poke = (Access -> CInt) -> Ptr Access -> Access -> IO ()
forall core wrapper.
Storable core =>
(wrapper -> core) -> Ptr wrapper -> wrapper -> IO ()
Store.poke Access -> CInt
fromAccess

accessMmapInterleaved     :: Access
accessMmapInterleaved :: Access
accessMmapInterleaved     = CInt -> Access
Access CInt
0
accessMmapNoninterleaved  :: Access
accessMmapNoninterleaved :: Access
accessMmapNoninterleaved  = CInt -> Access
Access CInt
1
accessMmapComplex         :: Access
accessMmapComplex :: Access
accessMmapComplex         = CInt -> Access
Access CInt
2
accessRwInterleaved       :: Access
accessRwInterleaved :: Access
accessRwInterleaved       = CInt -> Access
Access CInt
3
accessRwNoninterleaved    :: Access
accessRwNoninterleaved :: Access
accessRwNoninterleaved    = Access 4

{-# LINE 151 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}



newtype Format = Format {fromFormat :: C.CInt}
   deriving (Eq, Ord)

instance Enum Format where
   toEnum :: Int -> Format
toEnum Int
n = CInt -> Format
Format (CInt -> Format) -> CInt -> Format
forall a b. (a -> b) -> a -> b
$ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n
   fromEnum :: Format -> Int
fromEnum (Format CInt
n) = CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
n

instance Bounded Format where
   minBound :: Format
minBound = Format
formatUnknown
   maxBound :: Format
maxBound = CInt -> Format
Format CInt
52
{-# LINE 164 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

instance Storable Format where
   sizeOf :: Format -> Int
sizeOf = (Format -> CInt) -> Format -> Int
forall core wrapper.
Storable core =>
(wrapper -> core) -> wrapper -> Int
Store.sizeOf Format -> CInt
fromFormat
   alignment :: Format -> Int
alignment = (Format -> CInt) -> Format -> Int
forall core wrapper.
Storable core =>
(wrapper -> core) -> wrapper -> Int
Store.alignment Format -> CInt
fromFormat
   peek :: Ptr Format -> IO Format
peek = (CInt -> Format) -> Ptr Format -> IO Format
forall core wrapper.
Storable core =>
(core -> wrapper) -> Ptr wrapper -> IO wrapper
Store.peek CInt -> Format
Format
   poke :: Ptr Format -> Format -> IO ()
poke = (Format -> CInt) -> Ptr Format -> Format -> IO ()
forall core wrapper.
Storable core =>
(wrapper -> core) -> Ptr wrapper -> wrapper -> IO ()
Store.poke Format -> CInt
fromFormat

formatUnknown           :: Format
formatUnknown :: Format
formatUnknown           = CInt -> Format
Format (-CInt
1)
formatS8                :: Format
formatS8 :: Format
formatS8                = CInt -> Format
Format CInt
0
formatU8                :: Format
formatU8 :: Format
formatU8                = CInt -> Format
Format CInt
1
formatS16Le             :: Format
formatS16Le :: Format
formatS16Le             = CInt -> Format
Format CInt
2
formatS16Be             :: Format
formatS16Be :: Format
formatS16Be             = CInt -> Format
Format CInt
3
formatU16Le             :: Format
formatU16Le :: Format
formatU16Le             = CInt -> Format
Format CInt
4
formatU16Be             :: Format
formatU16Be :: Format
formatU16Be             = CInt -> Format
Format CInt
5
formatS24Le             :: Format
formatS24Le :: Format
formatS24Le             = CInt -> Format
Format CInt
6
formatS24Be             :: Format
formatS24Be :: Format
formatS24Be             = CInt -> Format
Format CInt
7
formatU24Le             :: Format
formatU24Le :: Format
formatU24Le             = CInt -> Format
Format CInt
8
formatU24Be             :: Format
formatU24Be :: Format
formatU24Be             = CInt -> Format
Format CInt
9
formatS32Le             :: Format
formatS32Le :: Format
formatS32Le             = CInt -> Format
Format CInt
10
formatS32Be             :: Format
formatS32Be :: Format
formatS32Be             = CInt -> Format
Format CInt
11
formatU32Le             :: Format
formatU32Le :: Format
formatU32Le             = CInt -> Format
Format CInt
12
formatU32Be             :: Format
formatU32Be :: Format
formatU32Be             = CInt -> Format
Format CInt
13
formatFloatLe           :: Format
formatFloatLe :: Format
formatFloatLe           = CInt -> Format
Format CInt
14
formatFloatBe           :: Format
formatFloatBe :: Format
formatFloatBe           = CInt -> Format
Format CInt
15
formatFloat64Le         :: Format
formatFloat64Le :: Format
formatFloat64Le         = CInt -> Format
Format CInt
16
formatFloat64Be         :: Format
formatFloat64Be :: Format
formatFloat64Be         = CInt -> Format
Format CInt
17
formatIec958SubframeLe  :: Format
formatIec958SubframeLe :: Format
formatIec958SubframeLe  = CInt -> Format
Format CInt
18
formatIec958SubframeBe  :: Format
formatIec958SubframeBe :: Format
formatIec958SubframeBe  = CInt -> Format
Format CInt
19
formatMuLaw             :: Format
formatMuLaw :: Format
formatMuLaw             = CInt -> Format
Format CInt
20
formatALaw              :: Format
formatALaw :: Format
formatALaw              = CInt -> Format
Format CInt
21
formatImaAdpcm          :: Format
formatImaAdpcm :: Format
formatImaAdpcm          = CInt -> Format
Format CInt
22
formatMpeg              :: Format
formatMpeg :: Format
formatMpeg              = CInt -> Format
Format CInt
23
formatGsm               :: Format
formatGsm :: Format
formatGsm               = CInt -> Format
Format CInt
24
formatSpecial           :: Format
formatSpecial :: Format
formatSpecial           = CInt -> Format
Format CInt
31
formatS243le            :: Format
formatS243le :: Format
formatS243le            = CInt -> Format
Format CInt
32
formatS243be            :: Format
formatS243be :: Format
formatS243be            = CInt -> Format
Format CInt
33
formatU243le            :: Format
formatU243le :: Format
formatU243le            = CInt -> Format
Format CInt
34
formatU243be            :: Format
formatU243be :: Format
formatU243be            = CInt -> Format
Format CInt
35
formatS203le            :: Format
formatS203le :: Format
formatS203le            = CInt -> Format
Format CInt
36
formatS203be            :: Format
formatS203be :: Format
formatS203be            = CInt -> Format
Format CInt
37
formatU203le            :: Format
formatU203le :: Format
formatU203le            = CInt -> Format
Format CInt
38
formatU203be            :: Format
formatU203be            = Format 39
canOverrange :: forall i y. T i y Bool
formatS183le            :: Format
formatS183le            = Format 40
formatS183be            :: Format
formatS183be            = Format 41
formatU183le            :: Format
formatU183le            = Format 42
formatU183be            :: Format
formatU183be            = Format 43
formatS16               :: Format
formatS16               = Format 2
formatU16               :: Format
formatU16               = Format 4
formatS24               :: Format
formatS24               = Format 6
formatU24               :: Format
formatU24               = Format 8
formatS32               :: Format
formatS32               = Format 10
formatU32               :: Format
formatU32               = Format 12
formatFloat             :: Format
formatFloat             = Format 14
formatFloat64           :: Format
formatFloat64           = Format 16
formatIec958Subframe    :: Format
formatIec958Subframe    = Format 18

{-# LINE 220 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}


newtype Subformat = Subformat {fromSubformat :: C.CUInt}
   deriving (Eq, Ord)

instance Storable Subformat where
   sizeOf = Store.sizeOf fromSubformat
   alignment = Store.alignment fromSubformat
   peek = Store.peek Subformat
   poke = Store.poke fromSubformat



foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_can_mmap_sample_resolution"
   canMmapSampleResolution_ :: Ptr Params -> IO C.CInt

canMmapSampleResolution :: T i y (Bool)
canMmapSampleResolution =
   Cons $ \ _ p ->
   canMmapSampleResolution_ p >>= \res ->
   return (res/=0)

{-# LINE 234 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_is_double"
   isDouble_ :: Ptr Params -> IO C.CInt

isDouble :: T i y (Bool)
isDouble =
   Cons $ \ _ p ->
   isDouble_ p >>= \res ->
   return (res/=0)

{-# LINE 235 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_is_batch"
   isBatch_ :: Ptr Params -> IO C.CInt

isBatch :: T i y (Bool)
isBatch =
   Cons $ \ _ p ->
   isBatch_ p >>= \res ->
   return (res/=0)

{-# LINE 236 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_is_block_transfer"
   isBlockTransfer_ :: Ptr Params -> IO C.CInt

isBlockTransfer :: T i y (Bool)
isBlockTransfer =
   Cons $ \ _ p ->
   isBlockTransfer_ p >>= \res ->
   return (res/=0)

{-# LINE 237 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_can_overrange"
   canOverrange_ :: Ptr Params -> IO C.CInt

canOverrange :: T i y (Bool)
canOverrange =
   Cons $ \ _ p ->
   canOverrange_ p >>= \res ->
   return (res/=0)

{-# LINE 238 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_can_pause"
   canPause_ :: Ptr Params -> IO C.CInt

canPause :: T i y (Bool)
canPause =
   Cons $ \ _ p ->
   canPause_ p >>= \res ->
   return (res/=0)

{-# LINE 239 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_can_resume"
   canResume_ :: Ptr Params -> IO C.CInt

canResume :: T i y (Bool)
canResume =
   Cons $ \ _ p ->
   canResume_ p >>= \res ->
   return (res/=0)

{-# LINE 240 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_is_half_duplex"
   isHalfDuplex_ :: Ptr Params -> IO C.CInt

isHalfDuplex :: T i y (Bool)
isHalfDuplex =
   Cons $ \ _ p ->
   isHalfDuplex_ p >>= \res ->
   return (res/=0)

{-# LINE 241 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_is_joint_duplex"
   isJointDuplex_ :: Ptr Params -> IO C.CInt

isJointDuplex :: T i y (Bool)
isJointDuplex =
   Cons $ \ _ p ->
   isJointDuplex_ p >>= \res ->
   return (res/=0)

{-# LINE 242 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_can_sync_start"
   canSyncStart_ :: Ptr Params -> IO C.CInt

canSyncStart :: T i y (Bool)
canSyncStart =
   Cons $ \ _ p ->
   canSyncStart_ p >>= \res ->
   return (res/=0)

{-# LINE 243 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}


foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_rate_numden"
   getRateNumden_ :: Ptr Params -> Ptr C.CUInt -> Ptr C.CUInt -> IO C.CInt

getRateNumden :: T i y (Word, Word)
getRateNumden =
   Cons $ \ _ p ->
   alloca $ \rateNumPtr ->
   alloca $ \rateDenPtr ->
   getRateNumden_ p rateNumPtr rateDenPtr >>=
   checkResult_ "HwParams.getRateNumden" >>
   Conv.peek Conv.int rateNumPtr >>= \rateNumResult ->
   Conv.peek Conv.int rateDenPtr >>= \rateDenResult ->
   return (rateNumResult, rateDenResult)

{-# LINE 247 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_sbits"
   getSbits_ :: Ptr Params -> IO C.CInt

getSbits :: T i y (Word)
getSbits =
   Cons $ \ _ p ->
   getSbits_ p >>=
   checkResult "HwParams.getSbits" >>= \res ->
   return (fromIntegral res)

{-# LINE 248 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_fifo_size"
   getFifoSize_ :: Ptr Params -> IO C.CInt

getFifoSize :: T i y (Word)
getFifoSize =
   Cons $ \ _ p ->
   getFifoSize_ p >>=
   checkResult "HwParams.getFifoSize" >>= \res ->
   return (fromIntegral res)

{-# LINE 249 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_access"
   getAccess_ :: Ptr Params -> Ptr Access -> IO C.CInt

getAccess :: T i y (Access)
getAccess =
   Cons $ \ _ p ->
   alloca $ \accessPtr ->
   getAccess_ p accessPtr >>=
   checkResult_ "HwParams.getAccess" >>
   Conv.peek Conv.id accessPtr >>= \accessResult ->
   return (accessResult)

{-# LINE 251 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_access"
   testAccess_ :: Handle i y -> Ptr Params -> Access -> IO E.Errno

testAccess :: Access -> T i y (E.Errno)
testAccess access =
   Cons $ \h p ->
   testAccess_ h p (fromHaskell Conv.id access) >>= \res ->
   return (res)

{-# LINE 252 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_access"
   setAccess_ :: Handle i y -> Ptr Params -> Access -> IO C.CInt

setAccess :: Access -> T i y ()
setAccess access =
   Cons $ \h p ->
   setAccess_ h p (fromHaskell Conv.id access) >>=
   checkResult_ "HwParams.setAccess" >>
   return ()

{-# LINE 253 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_access_first"
   setAccessFirst_ :: Handle i y -> Ptr Params -> Ptr Access -> IO C.CInt

setAccessFirst :: Access -> T i y (Access)
setAccessFirst access =
   Cons $ \h p ->
   Conv.with Conv.id access $ \accessPtr ->
   setAccessFirst_ h p accessPtr >>=
   checkResult_ "HwParams.setAccessFirst" >>
   Conv.peek Conv.id accessPtr >>= \accessResult ->
   return (accessResult)

{-# LINE 254 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_access_last"
   setAccessLast_ :: Handle i y -> Ptr Params -> Ptr Access -> IO C.CInt

setAccessLast :: Access -> T i y (Access)
setAccessLast access =
   Cons $ \h p ->
   Conv.with Conv.id access $ \accessPtr ->
   setAccessLast_ h p accessPtr >>=
   checkResult_ "HwParams.setAccessLast" >>
   Conv.peek Conv.id accessPtr >>= \accessResult ->
   return (accessResult)

{-# LINE 255 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
{- in order to use this, we would have to implement mask accessors, too
#accessor checked, "set_access_mask", pcm_params, inout(&access_mask, "mask"), NULL
#accessor checked, "get_access_mask", params_only, out(&access_mask, "mask"), NULL
-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_format"
   getFormat_ :: Ptr Params -> Ptr Format -> IO C.CInt

getFormat :: T i y (Format)
getFormat =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   getFormat_ p valPtr >>=
   checkResult_ "HwParams.getFormat" >>
   Conv.peek Conv.id valPtr >>= \valResult ->
   return (valResult)

{-# LINE 261 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_format"
   testFormat_ :: Handle i y -> Ptr Params -> Format -> IO E.Errno

testFormat :: Format -> T i y (E.Errno)
testFormat val =
   Cons $ \h p ->
   testFormat_ h p (fromHaskell Conv.id val) >>= \res ->
   return (res)

{-# LINE 262 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_format"
   setFormat_ :: Handle i y -> Ptr Params -> Format -> IO C.CInt

setFormat :: Format -> T i y ()
setFormat val =
   Cons $ \h p ->
   setFormat_ h p (fromHaskell Conv.id val) >>=
   checkResult_ "HwParams.setFormat" >>
   return ()

{-# LINE 263 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_format_first"
   setFormatFirst_ :: Handle i y -> Ptr Params -> Ptr Format -> IO C.CInt

setFormatFirst :: Format -> T i y (Format)
setFormatFirst format =
   Cons $ \h p ->
   Conv.with Conv.id format $ \formatPtr ->
   setFormatFirst_ h p formatPtr >>=
   checkResult_ "HwParams.setFormatFirst" >>
   Conv.peek Conv.id formatPtr >>= \formatResult ->
   return (formatResult)

{-# LINE 264 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_format_last"
   setFormatLast_ :: Handle i y -> Ptr Params -> Ptr Format -> IO C.CInt

setFormatLast :: Format -> T i y (Format)
setFormatLast format =
   Cons $ \h p ->
   Conv.with Conv.id format $ \formatPtr ->
   setFormatLast_ h p formatPtr >>=
   checkResult_ "HwParams.setFormatLast" >>
   Conv.peek Conv.id formatPtr >>= \formatResult ->
   return (formatResult)

{-# LINE 265 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
{-
#accessor checked, "set_format_mask", pcm_params, inout(&format_mask_p, "mask"), NULL
#accessor noresult, "get_format_mask", params_only, out(&format_mask_p, "mask"), NULL
-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_subformat"
   getSubformat_ :: Ptr Params -> Ptr Subformat -> IO C.CInt

getSubformat :: T i y (Subformat)
getSubformat =
   Cons $ \ _ p ->
   alloca $ \subformatPtr ->
   getSubformat_ p subformatPtr >>=
   checkResult_ "HwParams.getSubformat" >>
   Conv.peek Conv.id subformatPtr >>= \subformatResult ->
   return (subformatResult)

{-# LINE 271 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_subformat"
   testSubformat_ :: Handle i y -> Ptr Params -> Subformat -> IO E.Errno

testSubformat :: Subformat -> T i y (E.Errno)
testSubformat subformat =
   Cons $ \h p ->
   testSubformat_ h p (fromHaskell Conv.id subformat) >>= \res ->
   return (res)

{-# LINE 272 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_subformat"
   setSubformat_ :: Handle i y -> Ptr Params -> Subformat -> IO C.CInt

setSubformat :: Subformat -> T i y ()
setSubformat subformat =
   Cons $ \h p ->
   setSubformat_ h p (fromHaskell Conv.id subformat) >>=
   checkResult_ "HwParams.setSubformat" >>
   return ()

{-# LINE 273 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_subformat_first"
   setSubformatFirst_ :: Handle i y -> Ptr Params -> Ptr Subformat -> IO C.CInt

setSubformatFirst :: Subformat -> T i y (Subformat)
setSubformatFirst subformat =
   Cons $ \h p ->
   Conv.with Conv.id subformat $ \subformatPtr ->
   setSubformatFirst_ h p subformatPtr >>=
   checkResult_ "HwParams.setSubformatFirst" >>
   Conv.peek Conv.id subformatPtr >>= \subformatResult ->
   return (subformatResult)

{-# LINE 274 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_subformat_last"
   setSubformatLast_ :: Handle i y -> Ptr Params -> Ptr Subformat -> IO C.CInt

setSubformatLast :: Subformat -> T i y (Subformat)
setSubformatLast subformat =
   Cons $ \h p ->
   Conv.with Conv.id subformat $ \subformatPtr ->
   setSubformatLast_ h p subformatPtr >>=
   checkResult_ "HwParams.setSubformatLast" >>
   Conv.peek Conv.id subformatPtr >>= \subformatResult ->
   return (subformatResult)

{-# LINE 275 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
{-
#accessor checked, "set_subformat_mask", pcm_params, inout(&subformat_mask_p, "mask"), NULL
#accessor noresult, "get_subformat_mask", params_only, out(&subformat_mask_p, "mask"), NULL
-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_channels"
   getChannels_ :: Ptr Params -> Ptr C.CUInt -> IO C.CInt

getChannels :: T i y (Word)
getChannels =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   getChannels_ p valPtr >>=
   checkResult_ "HwParams.getChannels" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 281 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_channels_min"
   getChannelsMin_ :: Ptr Params -> Ptr C.CUInt -> IO C.CInt

getChannelsMin :: T i y (Word)
getChannelsMin =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   getChannelsMin_ p valPtr >>=
   checkResult_ "HwParams.getChannelsMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 282 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_channels_max"
   getChannelsMax_ :: Ptr Params -> Ptr C.CUInt -> IO C.CInt

getChannelsMax :: T i y (Word)
getChannelsMax =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   getChannelsMax_ p valPtr >>=
   checkResult_ "HwParams.getChannelsMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 283 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_channels"
   testChannels_ :: Handle i y -> Ptr Params -> C.CUInt -> IO E.Errno

testChannels :: Word -> T i y (E.Errno)
testChannels val =
   Cons $ \h p ->
   testChannels_ h p (fromHaskell Conv.int val) >>= \res ->
   return (res)

{-# LINE 284 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_channels"
   setChannels_ :: Handle i y -> Ptr Params -> C.CUInt -> IO C.CInt

setChannels :: Word -> T i y ()
setChannels val =
   Cons $ \h p ->
   setChannels_ h p (fromHaskell Conv.int val) >>=
   checkResult_ "HwParams.setChannels" >>
   return ()

{-# LINE 285 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_channels_min"
   setChannelsMin_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setChannelsMin :: Word -> T i y (Word)
setChannelsMin val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setChannelsMin_ h p valPtr >>=
   checkResult_ "HwParams.setChannelsMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 286 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_channels_max"
   setChannelsMax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setChannelsMax :: Word -> T i y (Word)
setChannelsMax val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setChannelsMax_ h p valPtr >>=
   checkResult_ "HwParams.setChannelsMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 287 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_channels_minmax"
   setChannelsMinmax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr C.CUInt -> IO C.CInt

setChannelsMinmax :: Word -> Word -> T i y (Word, Word)
setChannelsMinmax vmin vmax =
   Cons $ \h p ->
   Conv.with Conv.int vmin $ \vminPtr ->
   Conv.with Conv.int vmax $ \vmaxPtr ->
   setChannelsMinmax_ h p vminPtr vmaxPtr >>=
   checkResult_ "HwParams.setChannelsMinmax" >>
   Conv.peek Conv.int vminPtr >>= \vminResult ->
   Conv.peek Conv.int vmaxPtr >>= \vmaxResult ->
   return (vminResult, vmaxResult)

{-# LINE 288 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_channels_near"
   setChannelsNear_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setChannelsNear :: Word -> T i y (Word)
setChannelsNear val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setChannelsNear_ h p valPtr >>=
   checkResult_ "HwParams.setChannelsNear" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 289 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_channels_first"
   setChannelsFirst_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setChannelsFirst :: Word -> T i y (Word)
setChannelsFirst val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setChannelsFirst_ h p valPtr >>=
   checkResult_ "HwParams.setChannelsFirst" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 290 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_channels_last"
   setChannelsLast_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setChannelsLast :: Word -> T i y (Word)
setChannelsLast val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setChannelsLast_ h p valPtr >>=
   checkResult_ "HwParams.setChannelsLast" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 291 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_rate"
   getRate_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getRate :: T i y (SampleFreq, Ordering)
getRate =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getRate_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getRate" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 293 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_rate_min"
   getRateMin_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getRateMin :: T i y (SampleFreq, Ordering)
getRateMin =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getRateMin_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getRateMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 294 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_rate_max"
   getRateMax_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getRateMax :: T i y (SampleFreq, Ordering)
getRateMax =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getRateMax_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getRateMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 295 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_rate"
   testRate_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO E.Errno

testRate :: SampleFreq -> Ordering -> T i y (E.Errno)
testRate val dir =
   Cons $ \h p ->
   testRate_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>= \res ->
   return (res)

{-# LINE 296 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_rate"
   setRate_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO C.CInt

setRate :: SampleFreq -> Ordering -> T i y ()
setRate val dir =
   Cons $ \h p ->
   setRate_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>=
   checkResult_ "HwParams.setRate" >>
   return ()

{-# LINE 297 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_rate_min"
   setRateMin_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setRateMin :: SampleFreq -> Ordering -> T i y (SampleFreq, Ordering)
setRateMin val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setRateMin_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setRateMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 298 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_rate_max"
   setRateMax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setRateMax :: SampleFreq -> Ordering -> T i y (SampleFreq, Ordering)
setRateMax val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setRateMax_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setRateMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 299 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_rate_minmax"
   setRateMinmax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setRateMinmax :: SampleFreq -> Ordering -> SampleFreq -> Ordering -> T i y (SampleFreq, Ordering, SampleFreq, Ordering)
setRateMinmax vmin mindir vmax maxdir =
   Cons $ \h p ->
   Conv.with Conv.int vmin $ \vminPtr ->
   Conv.with ordConv mindir $ \mindirPtr ->
   Conv.with Conv.int vmax $ \vmaxPtr ->
   Conv.with ordConv maxdir $ \maxdirPtr ->
   setRateMinmax_ h p vminPtr mindirPtr vmaxPtr maxdirPtr >>=
   checkResult_ "HwParams.setRateMinmax" >>
   Conv.peek Conv.int vminPtr >>= \vminResult ->
   Conv.peek ordConv mindirPtr >>= \mindirResult ->
   Conv.peek Conv.int vmaxPtr >>= \vmaxResult ->
   Conv.peek ordConv maxdirPtr >>= \maxdirResult ->
   return (vminResult, mindirResult, vmaxResult, maxdirResult)

{-# LINE 300 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_rate_near"
   setRateNear_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setRateNear :: SampleFreq -> Ordering -> T i y (SampleFreq, Ordering)
setRateNear val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setRateNear_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setRateNear" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 301 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_rate_first"
   setRateFirst_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setRateFirst :: SampleFreq -> Ordering -> T i y (SampleFreq, Ordering)
setRateFirst val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setRateFirst_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setRateFirst" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 302 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_rate_last"
   setRateLast_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setRateLast :: SampleFreq -> Ordering -> T i y (SampleFreq, Ordering)
setRateLast val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setRateLast_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setRateLast" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 303 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_rate_resample"
   setRateResample_ :: Handle i y -> Ptr Params -> Bool_ -> IO C.CInt

setRateResample :: Bool -> T i y ()
setRateResample val =
   Cons $ \h p ->
   setRateResample_ h p (fromHaskell boolConv val) >>=
   checkResult_ "HwParams.setRateResample" >>
   return ()

{-# LINE 304 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_rate_resample"
   getRateResample_ :: Handle i y -> Ptr Params -> Ptr Bool_ -> IO C.CInt

getRateResample :: T i y (Bool)
getRateResample =
   Cons $ \h p ->
   alloca $ \valPtr ->
   getRateResample_ h p valPtr >>=
   checkResult_ "HwParams.getRateResample" >>
   Conv.peek boolConv valPtr >>= \valResult ->
   return (valResult)

{-# LINE 305 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_export_buffer"
   setExportBuffer_ :: Handle i y -> Ptr Params -> Bool_ -> IO C.CInt

setExportBuffer :: Bool -> T i y ()
setExportBuffer val =
   Cons $ \h p ->
   setExportBuffer_ h p (fromHaskell boolConv val) >>=
   checkResult_ "HwParams.setExportBuffer" >>
   return ()

{-# LINE 306 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_export_buffer"
   getExportBuffer_ :: Handle i y -> Ptr Params -> Ptr Bool_ -> IO C.CInt

getExportBuffer :: T i y (Bool)
getExportBuffer =
   Cons $ \h p ->
   alloca $ \valPtr ->
   getExportBuffer_ h p valPtr >>=
   checkResult_ "HwParams.getExportBuffer" >>
   Conv.peek boolConv valPtr >>= \valResult ->
   return (valResult)

{-# LINE 307 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_period_time"
   getPeriodTime_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getPeriodTime :: T i y (Time, Ordering)
getPeriodTime =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getPeriodTime_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getPeriodTime" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 309 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_period_time_min"
   getPeriodTimeMin_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getPeriodTimeMin :: T i y (Time, Ordering)
getPeriodTimeMin =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getPeriodTimeMin_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getPeriodTimeMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 310 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_period_time_max"
   getPeriodTimeMax_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getPeriodTimeMax :: T i y (Time, Ordering)
getPeriodTimeMax =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getPeriodTimeMax_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getPeriodTimeMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 311 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_period_time"
   testPeriodTime_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO E.Errno

testPeriodTime :: Time -> Ordering -> T i y (E.Errno)
testPeriodTime val dir =
   Cons $ \h p ->
   testPeriodTime_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>= \res ->
   return (res)

{-# LINE 312 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_time"
   setPeriodTime_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO C.CInt

setPeriodTime :: Time -> Ordering -> T i y ()
setPeriodTime val dir =
   Cons $ \h p ->
   setPeriodTime_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>=
   checkResult_ "HwParams.setPeriodTime" >>
   return ()

{-# LINE 313 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_time_min"
   setPeriodTimeMin_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodTimeMin :: Time -> Ordering -> T i y (Time, Ordering)
setPeriodTimeMin val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodTimeMin_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodTimeMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 314 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_time_max"
   setPeriodTimeMax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodTimeMax :: Time -> Ordering -> T i y (Time, Ordering)
setPeriodTimeMax val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodTimeMax_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodTimeMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 315 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_time_minmax"
   setPeriodTimeMinmax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodTimeMinmax :: Time -> Ordering -> Time -> Ordering -> T i y (Time, Ordering, Time, Ordering)
setPeriodTimeMinmax vmin mindir vmax maxdir =
   Cons $ \h p ->
   Conv.with Conv.int vmin $ \vminPtr ->
   Conv.with ordConv mindir $ \mindirPtr ->
   Conv.with Conv.int vmax $ \vmaxPtr ->
   Conv.with ordConv maxdir $ \maxdirPtr ->
   setPeriodTimeMinmax_ h p vminPtr mindirPtr vmaxPtr maxdirPtr >>=
   checkResult_ "HwParams.setPeriodTimeMinmax" >>
   Conv.peek Conv.int vminPtr >>= \vminResult ->
   Conv.peek ordConv mindirPtr >>= \mindirResult ->
   Conv.peek Conv.int vmaxPtr >>= \vmaxResult ->
   Conv.peek ordConv maxdirPtr >>= \maxdirResult ->
   return (vminResult, mindirResult, vmaxResult, maxdirResult)

{-# LINE 316 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_time_near"
   setPeriodTimeNear_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodTimeNear :: Time -> Ordering -> T i y (Time, Ordering)
setPeriodTimeNear val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodTimeNear_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodTimeNear" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 317 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_time_first"
   setPeriodTimeFirst_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodTimeFirst :: Time -> Ordering -> T i y (Time, Ordering)
setPeriodTimeFirst val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodTimeFirst_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodTimeFirst" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 318 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_time_last"
   setPeriodTimeLast_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodTimeLast :: Time -> Ordering -> T i y (Time, Ordering)
setPeriodTimeLast val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodTimeLast_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodTimeLast" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 319 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_period_size"
   getPeriodSize_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getPeriodSize :: T i y (Size, Ordering)
getPeriodSize =
   Cons $ \ _ p ->
   alloca $ \framesPtr ->
   alloca $ \dirPtr ->
   getPeriodSize_ p framesPtr dirPtr >>=
   checkResult_ "HwParams.getPeriodSize" >>
   Conv.peek Conv.int framesPtr >>= \framesResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (framesResult, dirResult)

{-# LINE 321 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_period_size_min"
   getPeriodSizeMin_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getPeriodSizeMin :: T i y (Size, Ordering)
getPeriodSizeMin =
   Cons $ \ _ p ->
   alloca $ \framesPtr ->
   alloca $ \dirPtr ->
   getPeriodSizeMin_ p framesPtr dirPtr >>=
   checkResult_ "HwParams.getPeriodSizeMin" >>
   Conv.peek Conv.int framesPtr >>= \framesResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (framesResult, dirResult)

{-# LINE 322 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_period_size_max"
   getPeriodSizeMax_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getPeriodSizeMax :: T i y (Size, Ordering)
getPeriodSizeMax =
   Cons $ \ _ p ->
   alloca $ \framesPtr ->
   alloca $ \dirPtr ->
   getPeriodSizeMax_ p framesPtr dirPtr >>=
   checkResult_ "HwParams.getPeriodSizeMax" >>
   Conv.peek Conv.int framesPtr >>= \framesResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (framesResult, dirResult)

{-# LINE 323 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_period_size"
   testPeriodSize_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO E.Errno

testPeriodSize :: Size -> Ordering -> T i y (E.Errno)
testPeriodSize val dir =
   Cons $ \h p ->
   testPeriodSize_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>= \res ->
   return (res)

{-# LINE 324 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_size"
   setPeriodSize_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO C.CInt

setPeriodSize :: Size -> Ordering -> T i y ()
setPeriodSize val dir =
   Cons $ \h p ->
   setPeriodSize_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>=
   checkResult_ "HwParams.setPeriodSize" >>
   return ()

{-# LINE 325 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_size_min"
   setPeriodSizeMin_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodSizeMin :: Size -> Ordering -> T i y (Size, Ordering)
setPeriodSizeMin val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodSizeMin_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodSizeMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 326 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_size_max"
   setPeriodSizeMax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodSizeMax :: Size -> Ordering -> T i y (Size, Ordering)
setPeriodSizeMax val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodSizeMax_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodSizeMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 327 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_size_minmax"
   setPeriodSizeMinmax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodSizeMinmax :: Size -> Ordering -> Size -> Ordering -> T i y (Size, Ordering, Size, Ordering)
setPeriodSizeMinmax vmin mindir vmax maxdir =
   Cons $ \h p ->
   Conv.with Conv.int vmin $ \vminPtr ->
   Conv.with ordConv mindir $ \mindirPtr ->
   Conv.with Conv.int vmax $ \vmaxPtr ->
   Conv.with ordConv maxdir $ \maxdirPtr ->
   setPeriodSizeMinmax_ h p vminPtr mindirPtr vmaxPtr maxdirPtr >>=
   checkResult_ "HwParams.setPeriodSizeMinmax" >>
   Conv.peek Conv.int vminPtr >>= \vminResult ->
   Conv.peek ordConv mindirPtr >>= \mindirResult ->
   Conv.peek Conv.int vmaxPtr >>= \vmaxResult ->
   Conv.peek ordConv maxdirPtr >>= \maxdirResult ->
   return (vminResult, mindirResult, vmaxResult, maxdirResult)

{-# LINE 328 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_size_near"
   setPeriodSizeNear_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodSizeNear :: Size -> Ordering -> T i y (Size, Ordering)
setPeriodSizeNear val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodSizeNear_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodSizeNear" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 329 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_size_first"
   setPeriodSizeFirst_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodSizeFirst :: Size -> Ordering -> T i y (Size, Ordering)
setPeriodSizeFirst val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodSizeFirst_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodSizeFirst" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 330 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_size_last"
   setPeriodSizeLast_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodSizeLast :: Size -> Ordering -> T i y (Size, Ordering)
setPeriodSizeLast val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodSizeLast_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodSizeLast" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 331 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_period_size_integer"
   setPeriodSizeInteger_ :: Handle i y -> Ptr Params -> IO C.CInt

setPeriodSizeInteger :: T i y ()
setPeriodSizeInteger =
   Cons $ \h p ->
   setPeriodSizeInteger_ h p >>=
   checkResult_ "HwParams.setPeriodSizeInteger" >>
   return ()

{-# LINE 332 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_periods"
   getPeriods_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getPeriods :: T i y (Word, Ordering)
getPeriods =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getPeriods_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getPeriods" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 334 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_periods_min"
   getPeriodsMin_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getPeriodsMin :: T i y (Word, Ordering)
getPeriodsMin =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getPeriodsMin_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getPeriodsMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 335 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_periods_max"
   getPeriodsMax_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getPeriodsMax :: T i y (Word, Ordering)
getPeriodsMax =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getPeriodsMax_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getPeriodsMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 336 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_periods"
   testPeriods_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO E.Errno

testPeriods :: Word -> Ordering -> T i y (E.Errno)
testPeriods val dir =
   Cons $ \h p ->
   testPeriods_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>= \res ->
   return (res)

{-# LINE 337 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_periods"
   setPeriods_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO C.CInt

setPeriods :: Word -> Ordering -> T i y ()
setPeriods val dir =
   Cons $ \h p ->
   setPeriods_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>=
   checkResult_ "HwParams.setPeriods" >>
   return ()

{-# LINE 338 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_periods_min"
   setPeriodsMin_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodsMin :: Word -> Ordering -> T i y (Word, Ordering)
setPeriodsMin val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodsMin_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodsMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 339 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_periods_max"
   setPeriodsMax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodsMax :: Word -> Ordering -> T i y (Word, Ordering)
setPeriodsMax val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodsMax_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodsMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 340 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_periods_minmax"
   setPeriodsMinmax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodsMinmax :: Word -> Ordering -> Word -> Ordering -> T i y (Word, Ordering, Word, Ordering)
setPeriodsMinmax vmin mindir vmax maxdir =
   Cons $ \h p ->
   Conv.with Conv.int vmin $ \vminPtr ->
   Conv.with ordConv mindir $ \mindirPtr ->
   Conv.with Conv.int vmax $ \vmaxPtr ->
   Conv.with ordConv maxdir $ \maxdirPtr ->
   setPeriodsMinmax_ h p vminPtr mindirPtr vmaxPtr maxdirPtr >>=
   checkResult_ "HwParams.setPeriodsMinmax" >>
   Conv.peek Conv.int vminPtr >>= \vminResult ->
   Conv.peek ordConv mindirPtr >>= \mindirResult ->
   Conv.peek Conv.int vmaxPtr >>= \vmaxResult ->
   Conv.peek ordConv maxdirPtr >>= \maxdirResult ->
   return (vminResult, mindirResult, vmaxResult, maxdirResult)

{-# LINE 341 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_periods_near"
   setPeriodsNear_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodsNear :: Word -> Ordering -> T i y (Word, Ordering)
setPeriodsNear val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodsNear_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodsNear" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 342 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_periods_first"
   setPeriodsFirst_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodsFirst :: Word -> Ordering -> T i y (Word, Ordering)
setPeriodsFirst val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodsFirst_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodsFirst" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 343 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_periods_last"
   setPeriodsLast_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setPeriodsLast :: Word -> Ordering -> T i y (Word, Ordering)
setPeriodsLast val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setPeriodsLast_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setPeriodsLast" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 344 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_periods_integer"
   setPeriodsInteger_ :: Handle i y -> Ptr Params -> IO C.CInt

setPeriodsInteger :: T i y ()
setPeriodsInteger =
   Cons $ \h p ->
   setPeriodsInteger_ h p >>=
   checkResult_ "HwParams.setPeriodsInteger" >>
   return ()

{-# LINE 345 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_buffer_time"
   getBufferTime_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getBufferTime :: T i y (Time, Ordering)
getBufferTime =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getBufferTime_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getBufferTime" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 347 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_buffer_time_min"
   getBufferTimeMin_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getBufferTimeMin :: T i y (Time, Ordering)
getBufferTimeMin =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getBufferTimeMin_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getBufferTimeMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 348 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_buffer_time_max"
   getBufferTimeMax_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getBufferTimeMax :: T i y (Time, Ordering)
getBufferTimeMax =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getBufferTimeMax_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getBufferTimeMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 349 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_buffer_time"
   testBufferTime_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO E.Errno

testBufferTime :: Time -> Ordering -> T i y (E.Errno)
testBufferTime val dir =
   Cons $ \h p ->
   testBufferTime_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>= \res ->
   return (res)

{-# LINE 350 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_time"
   setBufferTime_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO C.CInt

setBufferTime :: Time -> Ordering -> T i y ()
setBufferTime val dir =
   Cons $ \h p ->
   setBufferTime_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>=
   checkResult_ "HwParams.setBufferTime" >>
   return ()

{-# LINE 351 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_time_min"
   setBufferTimeMin_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setBufferTimeMin :: Time -> Ordering -> T i y (Time, Ordering)
setBufferTimeMin val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setBufferTimeMin_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setBufferTimeMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 352 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_time_max"
   setBufferTimeMax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setBufferTimeMax :: Time -> Ordering -> T i y (Time, Ordering)
setBufferTimeMax val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setBufferTimeMax_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setBufferTimeMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 353 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_time_minmax"
   setBufferTimeMinmax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setBufferTimeMinmax :: Time -> Ordering -> Time -> Ordering -> T i y (Time, Ordering, Time, Ordering)
setBufferTimeMinmax vmin mindir vmax maxdir =
   Cons $ \h p ->
   Conv.with Conv.int vmin $ \vminPtr ->
   Conv.with ordConv mindir $ \mindirPtr ->
   Conv.with Conv.int vmax $ \vmaxPtr ->
   Conv.with ordConv maxdir $ \maxdirPtr ->
   setBufferTimeMinmax_ h p vminPtr mindirPtr vmaxPtr maxdirPtr >>=
   checkResult_ "HwParams.setBufferTimeMinmax" >>
   Conv.peek Conv.int vminPtr >>= \vminResult ->
   Conv.peek ordConv mindirPtr >>= \mindirResult ->
   Conv.peek Conv.int vmaxPtr >>= \vmaxResult ->
   Conv.peek ordConv maxdirPtr >>= \maxdirResult ->
   return (vminResult, mindirResult, vmaxResult, maxdirResult)

{-# LINE 354 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_time_near"
   setBufferTimeNear_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setBufferTimeNear :: Time -> Ordering -> T i y (Time, Ordering)
setBufferTimeNear val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setBufferTimeNear_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setBufferTimeNear" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 355 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_time_first"
   setBufferTimeFirst_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setBufferTimeFirst :: Time -> Ordering -> T i y (Time, Ordering)
setBufferTimeFirst val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setBufferTimeFirst_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setBufferTimeFirst" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 356 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_time_last"
   setBufferTimeLast_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setBufferTimeLast :: Time -> Ordering -> T i y (Time, Ordering)
setBufferTimeLast val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setBufferTimeLast_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setBufferTimeLast" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 357 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_buffer_size"
   getBufferSize_ :: Ptr Params -> Ptr C.CUInt -> IO C.CInt

getBufferSize :: T i y (Size)
getBufferSize =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   getBufferSize_ p valPtr >>=
   checkResult_ "HwParams.getBufferSize" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 359 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_buffer_size_min"
   getBufferSizeMin_ :: Ptr Params -> Ptr C.CUInt -> IO C.CInt

getBufferSizeMin :: T i y (Size)
getBufferSizeMin =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   getBufferSizeMin_ p valPtr >>=
   checkResult_ "HwParams.getBufferSizeMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 360 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_buffer_size_max"
   getBufferSizeMax_ :: Ptr Params -> Ptr C.CUInt -> IO C.CInt

getBufferSizeMax :: T i y (Size)
getBufferSizeMax =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   getBufferSizeMax_ p valPtr >>=
   checkResult_ "HwParams.getBufferSizeMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 361 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_buffer_size"
   testBufferSize_ :: Handle i y -> Ptr Params -> C.CUInt -> IO E.Errno

testBufferSize :: Size -> T i y (E.Errno)
testBufferSize val =
   Cons $ \h p ->
   testBufferSize_ h p (fromHaskell Conv.int val) >>= \res ->
   return (res)

{-# LINE 362 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_size"
   setBufferSize_ :: Handle i y -> Ptr Params -> C.CUInt -> IO C.CInt

setBufferSize :: Size -> T i y ()
setBufferSize val =
   Cons $ \h p ->
   setBufferSize_ h p (fromHaskell Conv.int val) >>=
   checkResult_ "HwParams.setBufferSize" >>
   return ()

{-# LINE 363 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_size_min"
   setBufferSizeMin_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setBufferSizeMin :: Size -> T i y (Size)
setBufferSizeMin val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setBufferSizeMin_ h p valPtr >>=
   checkResult_ "HwParams.setBufferSizeMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 364 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_size_max"
   setBufferSizeMax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setBufferSizeMax :: Size -> T i y (Size)
setBufferSizeMax val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setBufferSizeMax_ h p valPtr >>=
   checkResult_ "HwParams.setBufferSizeMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 365 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_size_minmax"
   setBufferSizeMinmax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr C.CUInt -> IO C.CInt

setBufferSizeMinmax :: Size -> Size -> T i y (Size, Size)
setBufferSizeMinmax vmin vmax =
   Cons $ \h p ->
   Conv.with Conv.int vmin $ \vminPtr ->
   Conv.with Conv.int vmax $ \vmaxPtr ->
   setBufferSizeMinmax_ h p vminPtr vmaxPtr >>=
   checkResult_ "HwParams.setBufferSizeMinmax" >>
   Conv.peek Conv.int vminPtr >>= \vminResult ->
   Conv.peek Conv.int vmaxPtr >>= \vmaxResult ->
   return (vminResult, vmaxResult)

{-# LINE 366 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_size_near"
   setBufferSizeNear_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setBufferSizeNear :: Size -> T i y (Size)
setBufferSizeNear val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setBufferSizeNear_ h p valPtr >>=
   checkResult_ "HwParams.setBufferSizeNear" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 367 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_size_first"
   setBufferSizeFirst_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setBufferSizeFirst :: Size -> T i y (Size)
setBufferSizeFirst val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setBufferSizeFirst_ h p valPtr >>=
   checkResult_ "HwParams.setBufferSizeFirst" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 368 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_buffer_size_last"
   setBufferSizeLast_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> IO C.CInt

setBufferSizeLast :: Size -> T i y (Size)
setBufferSizeLast val =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   setBufferSizeLast_ h p valPtr >>=
   checkResult_ "HwParams.setBufferSizeLast" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 369 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_tick_time"
   getTickTime_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getTickTime :: T i y (Time, Ordering)
getTickTime =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getTickTime_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getTickTime" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 371 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_tick_time_min"
   getTickTimeMin_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getTickTimeMin :: T i y (Time, Ordering)
getTickTimeMin =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getTickTimeMin_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getTickTimeMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 372 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_tick_time_max"
   getTickTimeMax_ :: Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

getTickTimeMax :: T i y (Time, Ordering)
getTickTimeMax =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   alloca $ \dirPtr ->
   getTickTimeMax_ p valPtr dirPtr >>=
   checkResult_ "HwParams.getTickTimeMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 373 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_test_tick_time"
   testTickTime_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO E.Errno

testTickTime :: Time -> Ordering -> T i y (E.Errno)
testTickTime val dir =
   Cons $ \h p ->
   testTickTime_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>= \res ->
   return (res)

{-# LINE 374 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_tick_time"
   setTickTime_ :: Handle i y -> Ptr Params -> C.CUInt -> Direction -> IO C.CInt

setTickTime :: Time -> Ordering -> T i y ()
setTickTime val dir =
   Cons $ \h p ->
   setTickTime_ h p (fromHaskell Conv.int val) (fromHaskell ordConv dir) >>=
   checkResult_ "HwParams.setTickTime" >>
   return ()

{-# LINE 375 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_tick_time_min"
   setTickTimeMin_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setTickTimeMin :: Time -> Ordering -> T i y (Time, Ordering)
setTickTimeMin val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setTickTimeMin_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setTickTimeMin" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 376 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_tick_time_max"
   setTickTimeMax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setTickTimeMax :: Time -> Ordering -> T i y (Time, Ordering)
setTickTimeMax val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setTickTimeMax_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setTickTimeMax" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 377 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_tick_time_minmax"
   setTickTimeMinmax_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setTickTimeMinmax :: Time -> Ordering -> Time -> Ordering -> T i y (Time, Ordering, Time, Ordering)
setTickTimeMinmax vmin mindir vmax maxdir =
   Cons $ \h p ->
   Conv.with Conv.int vmin $ \vminPtr ->
   Conv.with ordConv mindir $ \mindirPtr ->
   Conv.with Conv.int vmax $ \vmaxPtr ->
   Conv.with ordConv maxdir $ \maxdirPtr ->
   setTickTimeMinmax_ h p vminPtr mindirPtr vmaxPtr maxdirPtr >>=
   checkResult_ "HwParams.setTickTimeMinmax" >>
   Conv.peek Conv.int vminPtr >>= \vminResult ->
   Conv.peek ordConv mindirPtr >>= \mindirResult ->
   Conv.peek Conv.int vmaxPtr >>= \vmaxResult ->
   Conv.peek ordConv maxdirPtr >>= \maxdirResult ->
   return (vminResult, mindirResult, vmaxResult, maxdirResult)

{-# LINE 378 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_tick_time_near"
   setTickTimeNear_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setTickTimeNear :: Time -> Ordering -> T i y (Time, Ordering)
setTickTimeNear val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setTickTimeNear_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setTickTimeNear" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 379 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_tick_time_first"
   setTickTimeFirst_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setTickTimeFirst :: Time -> Ordering -> T i y (Time, Ordering)
setTickTimeFirst val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setTickTimeFirst_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setTickTimeFirst" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 380 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}
foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_set_tick_time_last"
   setTickTimeLast_ :: Handle i y -> Ptr Params -> Ptr C.CUInt -> Ptr Direction -> IO C.CInt

setTickTimeLast :: Time -> Ordering -> T i y (Time, Ordering)
setTickTimeLast val dir =
   Cons $ \h p ->
   Conv.with Conv.int val $ \valPtr ->
   Conv.with ordConv dir $ \dirPtr ->
   setTickTimeLast_ h p valPtr dirPtr >>=
   checkResult_ "HwParams.setTickTimeLast" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   Conv.peek ordConv dirPtr >>= \dirResult ->
   return (valResult, dirResult)

{-# LINE 381 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}

foreign import ccall safe "alsa/pcm.h snd_pcm_hw_params_get_min_align"
   getMinAlign_ :: Ptr Params -> Ptr C.CUInt -> IO C.CInt

getMinAlign :: T i y (Size)
getMinAlign =
   Cons $ \ _ p ->
   alloca $ \valPtr ->
   getMinAlign_ p valPtr >>=
   checkResult_ "HwParams.getMinAlign" >>
   Conv.peek Conv.int valPtr >>= \valResult ->
   return (valResult)

{-# LINE 383 "src/Sound/ALSA/PCM/Core/HwParams.hsc" #-}