{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

'GI.GstAudio.Structs.AudioResampler.AudioResampler' is a structure which holds the information
required to perform various kinds of resampling filtering.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GstAudio.Structs.AudioResampler
    (

-- * Exported types
    AudioResampler(..)                      ,
    noAudioResampler                        ,


 -- * Methods
-- ** free #method:free#

#if ENABLE_OVERLOADING
    AudioResamplerFreeMethodInfo            ,
#endif
    audioResamplerFree                      ,


-- ** getInFrames #method:getInFrames#

#if ENABLE_OVERLOADING
    AudioResamplerGetInFramesMethodInfo     ,
#endif
    audioResamplerGetInFrames               ,


-- ** getMaxLatency #method:getMaxLatency#

#if ENABLE_OVERLOADING
    AudioResamplerGetMaxLatencyMethodInfo   ,
#endif
    audioResamplerGetMaxLatency             ,


-- ** getOutFrames #method:getOutFrames#

#if ENABLE_OVERLOADING
    AudioResamplerGetOutFramesMethodInfo    ,
#endif
    audioResamplerGetOutFrames              ,


-- ** new #method:new#

    audioResamplerNew                       ,


-- ** optionsSetQuality #method:optionsSetQuality#

    audioResamplerOptionsSetQuality         ,


-- ** resample #method:resample#

#if ENABLE_OVERLOADING
    AudioResamplerResampleMethodInfo        ,
#endif
    audioResamplerResample                  ,


-- ** reset #method:reset#

#if ENABLE_OVERLOADING
    AudioResamplerResetMethodInfo           ,
#endif
    audioResamplerReset                     ,


-- ** update #method:update#

#if ENABLE_OVERLOADING
    AudioResamplerUpdateMethodInfo          ,
#endif
    audioResamplerUpdate                    ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.Gst.Structs.Structure as Gst.Structure
import {-# SOURCE #-} qualified GI.GstAudio.Enums as GstAudio.Enums
import {-# SOURCE #-} qualified GI.GstAudio.Flags as GstAudio.Flags

-- | Memory-managed wrapper type.
newtype AudioResampler = AudioResampler (ManagedPtr AudioResampler)
-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance WrappedPtr AudioResampler where
    wrappedPtrCalloc = return nullPtr
    wrappedPtrCopy = return
    wrappedPtrFree = Nothing

-- | A convenience alias for `Nothing` :: `Maybe` `AudioResampler`.
noAudioResampler :: Maybe AudioResampler
noAudioResampler = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList AudioResampler
type instance O.AttributeList AudioResampler = AudioResamplerAttributeList
type AudioResamplerAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method AudioResampler::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "resampler", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResampler"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioResampler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_resampler_free" gst_audio_resampler_free ::
    Ptr AudioResampler ->                   -- resampler : TInterface (Name {namespace = "GstAudio", name = "AudioResampler"})
    IO ()

{- |
Free a previously allocated 'GI.GstAudio.Structs.AudioResampler.AudioResampler' /@resampler@/.

/Since: 1.6/
-}
audioResamplerFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioResampler
    {- ^ /@resampler@/: a 'GI.GstAudio.Structs.AudioResampler.AudioResampler' -}
    -> m ()
audioResamplerFree resampler = liftIO $ do
    resampler' <- unsafeManagedPtrGetPtr resampler
    gst_audio_resampler_free resampler'
    touchManagedPtr resampler
    return ()

#if ENABLE_OVERLOADING
data AudioResamplerFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioResamplerFreeMethodInfo AudioResampler signature where
    overloadedMethod _ = audioResamplerFree

#endif

-- method AudioResampler::get_in_frames
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "resampler", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResampler"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioResampler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_frames", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of input frames", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_resampler_get_in_frames" gst_audio_resampler_get_in_frames ::
    Ptr AudioResampler ->                   -- resampler : TInterface (Name {namespace = "GstAudio", name = "AudioResampler"})
    Word64 ->                               -- out_frames : TBasicType TUInt64
    IO Word64

{- |
Get the number of input frames that would currently be needed
to produce /@outFrames@/ from /@resampler@/.
-}
audioResamplerGetInFrames ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioResampler
    {- ^ /@resampler@/: a 'GI.GstAudio.Structs.AudioResampler.AudioResampler' -}
    -> Word64
    {- ^ /@outFrames@/: number of input frames -}
    -> m Word64
    {- ^ __Returns:__ The number of input frames needed for producing
/@outFrames@/ of data from /@resampler@/. -}
audioResamplerGetInFrames resampler outFrames = liftIO $ do
    resampler' <- unsafeManagedPtrGetPtr resampler
    result <- gst_audio_resampler_get_in_frames resampler' outFrames
    touchManagedPtr resampler
    return result

#if ENABLE_OVERLOADING
data AudioResamplerGetInFramesMethodInfo
instance (signature ~ (Word64 -> m Word64), MonadIO m) => O.MethodInfo AudioResamplerGetInFramesMethodInfo AudioResampler signature where
    overloadedMethod _ = audioResamplerGetInFrames

#endif

-- method AudioResampler::get_max_latency
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "resampler", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResampler"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioResampler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_resampler_get_max_latency" gst_audio_resampler_get_max_latency ::
    Ptr AudioResampler ->                   -- resampler : TInterface (Name {namespace = "GstAudio", name = "AudioResampler"})
    IO Word64

{- |
Get the maximum number of input samples that the resampler would
need before producing output.
-}
audioResamplerGetMaxLatency ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioResampler
    {- ^ /@resampler@/: a 'GI.GstAudio.Structs.AudioResampler.AudioResampler' -}
    -> m Word64
    {- ^ __Returns:__ the latency of /@resampler@/ as expressed in the number of
frames. -}
audioResamplerGetMaxLatency resampler = liftIO $ do
    resampler' <- unsafeManagedPtrGetPtr resampler
    result <- gst_audio_resampler_get_max_latency resampler'
    touchManagedPtr resampler
    return result

#if ENABLE_OVERLOADING
data AudioResamplerGetMaxLatencyMethodInfo
instance (signature ~ (m Word64), MonadIO m) => O.MethodInfo AudioResamplerGetMaxLatencyMethodInfo AudioResampler signature where
    overloadedMethod _ = audioResamplerGetMaxLatency

#endif

-- method AudioResampler::get_out_frames
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "resampler", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResampler"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioResampler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "in_frames", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of input frames", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_resampler_get_out_frames" gst_audio_resampler_get_out_frames ::
    Ptr AudioResampler ->                   -- resampler : TInterface (Name {namespace = "GstAudio", name = "AudioResampler"})
    Word64 ->                               -- in_frames : TBasicType TUInt64
    IO Word64

{- |
Get the number of output frames that would be currently available when
/@inFrames@/ are given to /@resampler@/.
-}
audioResamplerGetOutFrames ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioResampler
    {- ^ /@resampler@/: a 'GI.GstAudio.Structs.AudioResampler.AudioResampler' -}
    -> Word64
    {- ^ /@inFrames@/: number of input frames -}
    -> m Word64
    {- ^ __Returns:__ The number of frames that would be availabe after giving
/@inFrames@/ as input to /@resampler@/. -}
audioResamplerGetOutFrames resampler inFrames = liftIO $ do
    resampler' <- unsafeManagedPtrGetPtr resampler
    result <- gst_audio_resampler_get_out_frames resampler' inFrames
    touchManagedPtr resampler
    return result

#if ENABLE_OVERLOADING
data AudioResamplerGetOutFramesMethodInfo
instance (signature ~ (Word64 -> m Word64), MonadIO m) => O.MethodInfo AudioResamplerGetOutFramesMethodInfo AudioResampler signature where
    overloadedMethod _ = audioResamplerGetOutFrames

#endif

-- method AudioResampler::resample
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "resampler", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResampler"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioResampler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "in", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "input samples", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "in_frames", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of input frames", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "output samples", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_frames", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of output frames", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_resampler_resample" gst_audio_resampler_resample ::
    Ptr AudioResampler ->                   -- resampler : TInterface (Name {namespace = "GstAudio", name = "AudioResampler"})
    Ptr () ->                               -- in : TBasicType TPtr
    Word64 ->                               -- in_frames : TBasicType TUInt64
    Ptr () ->                               -- out : TBasicType TPtr
    Word64 ->                               -- out_frames : TBasicType TUInt64
    IO ()

{- |
Perform resampling on /@inFrames@/ frames in /@in@/ and write /@outFrames@/ to /@out@/.

In case the samples are interleaved, /@in@/ and /@out@/ must point to an
array with a single element pointing to a block of interleaved samples.

If non-interleaved samples are used, /@in@/ and /@out@/ must point to an
array with pointers to memory blocks, one for each channel.

/@in@/ may be 'Nothing', in which case /@inFrames@/ of silence samples are pushed
into the resampler.

This function always produces /@outFrames@/ of output and consumes /@inFrames@/ of
input. Use 'GI.GstAudio.Structs.AudioResampler.audioResamplerGetOutFrames' and
'GI.GstAudio.Structs.AudioResampler.audioResamplerGetInFrames' to make sure /@inFrames@/ and /@outFrames@/
are matching and /@in@/ and /@out@/ point to enough memory.
-}
audioResamplerResample ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioResampler
    {- ^ /@resampler@/: a 'GI.GstAudio.Structs.AudioResampler.AudioResampler' -}
    -> Ptr ()
    {- ^ /@in@/: input samples -}
    -> Word64
    {- ^ /@inFrames@/: number of input frames -}
    -> Ptr ()
    {- ^ /@out@/: output samples -}
    -> Word64
    {- ^ /@outFrames@/: number of output frames -}
    -> m ()
audioResamplerResample resampler in_ inFrames out outFrames = liftIO $ do
    resampler' <- unsafeManagedPtrGetPtr resampler
    gst_audio_resampler_resample resampler' in_ inFrames out outFrames
    touchManagedPtr resampler
    return ()

#if ENABLE_OVERLOADING
data AudioResamplerResampleMethodInfo
instance (signature ~ (Ptr () -> Word64 -> Ptr () -> Word64 -> m ()), MonadIO m) => O.MethodInfo AudioResamplerResampleMethodInfo AudioResampler signature where
    overloadedMethod _ = audioResamplerResample

#endif

-- method AudioResampler::reset
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "resampler", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResampler"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioResampler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_resampler_reset" gst_audio_resampler_reset ::
    Ptr AudioResampler ->                   -- resampler : TInterface (Name {namespace = "GstAudio", name = "AudioResampler"})
    IO ()

{- |
Reset /@resampler@/ to the state it was when it was first created, discarding
all sample history.
-}
audioResamplerReset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioResampler
    {- ^ /@resampler@/: a 'GI.GstAudio.Structs.AudioResampler.AudioResampler' -}
    -> m ()
audioResamplerReset resampler = liftIO $ do
    resampler' <- unsafeManagedPtrGetPtr resampler
    gst_audio_resampler_reset resampler'
    touchManagedPtr resampler
    return ()

#if ENABLE_OVERLOADING
data AudioResamplerResetMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioResamplerResetMethodInfo AudioResampler signature where
    overloadedMethod _ = audioResamplerReset

#endif

-- method AudioResampler::update
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "resampler", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResampler"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioResampler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "in_rate", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "new input rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_rate", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "new output rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "options", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "new options or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_resampler_update" gst_audio_resampler_update ::
    Ptr AudioResampler ->                   -- resampler : TInterface (Name {namespace = "GstAudio", name = "AudioResampler"})
    Int32 ->                                -- in_rate : TBasicType TInt
    Int32 ->                                -- out_rate : TBasicType TInt
    Ptr Gst.Structure.Structure ->          -- options : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO CInt

{- |
Update the resampler parameters for /@resampler@/. This function should
not be called concurrently with any other function on /@resampler@/.

When /@inRate@/ or /@outRate@/ is 0, its value is unchanged.

When /@options@/ is 'Nothing', the previously configured options are reused.
-}
audioResamplerUpdate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioResampler
    {- ^ /@resampler@/: a 'GI.GstAudio.Structs.AudioResampler.AudioResampler' -}
    -> Int32
    {- ^ /@inRate@/: new input rate -}
    -> Int32
    {- ^ /@outRate@/: new output rate -}
    -> Gst.Structure.Structure
    {- ^ /@options@/: new options or 'Nothing' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the new parameters could be set -}
audioResamplerUpdate resampler inRate outRate options = liftIO $ do
    resampler' <- unsafeManagedPtrGetPtr resampler
    options' <- unsafeManagedPtrGetPtr options
    result <- gst_audio_resampler_update resampler' inRate outRate options'
    let result' = (/= 0) result
    touchManagedPtr resampler
    touchManagedPtr options
    return result'

#if ENABLE_OVERLOADING
data AudioResamplerUpdateMethodInfo
instance (signature ~ (Int32 -> Int32 -> Gst.Structure.Structure -> m Bool), MonadIO m) => O.MethodInfo AudioResamplerUpdateMethodInfo AudioResampler signature where
    overloadedMethod _ = audioResamplerUpdate

#endif

-- method AudioResampler::new
-- method type : MemberFunction
-- Args : [Arg {argCName = "method", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResamplerMethod"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioResamplerMethod", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResamplerFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstAudioResamplerFlags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "GstAudio", name = "AudioFormat"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstAudioFormat", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "channels", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of channels", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "in_rate", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "input rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_rate", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "output rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "options", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "extra options", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstAudio", name = "AudioResampler"}))
-- throws : False
-- Skip return : True
-- XXX return value ignored, but it is not a boolean.
--     This may be a memory leak?

foreign import ccall "gst_audio_resampler_new" gst_audio_resampler_new ::
    CUInt ->                                -- method : TInterface (Name {namespace = "GstAudio", name = "AudioResamplerMethod"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "GstAudio", name = "AudioResamplerFlags"})
    CUInt ->                                -- format : TInterface (Name {namespace = "GstAudio", name = "AudioFormat"})
    Int32 ->                                -- channels : TBasicType TInt
    Int32 ->                                -- in_rate : TBasicType TInt
    Int32 ->                                -- out_rate : TBasicType TInt
    Ptr Gst.Structure.Structure ->          -- options : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr AudioResampler)

{- |
Make a new resampler.
-}
audioResamplerNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GstAudio.Enums.AudioResamplerMethod
    {- ^ /@method@/: a 'GI.GstAudio.Enums.AudioResamplerMethod' -}
    -> [GstAudio.Flags.AudioResamplerFlags]
    {- ^ /@flags@/: 'GI.GstAudio.Flags.AudioResamplerFlags' -}
    -> GstAudio.Enums.AudioFormat
    {- ^ /@format@/: the 'GI.GstAudio.Enums.AudioFormat' -}
    -> Int32
    {- ^ /@channels@/: the number of channels -}
    -> Int32
    {- ^ /@inRate@/: input rate -}
    -> Int32
    {- ^ /@outRate@/: output rate -}
    -> Gst.Structure.Structure
    {- ^ /@options@/: extra options -}
    -> m ()
audioResamplerNew method flags format channels inRate outRate options = liftIO $ do
    let method' = (fromIntegral . fromEnum) method
    let flags' = gflagsToWord flags
    let format' = (fromIntegral . fromEnum) format
    options' <- unsafeManagedPtrGetPtr options
    _ <- gst_audio_resampler_new method' flags' format' channels inRate outRate options'
    touchManagedPtr options
    return ()

#if ENABLE_OVERLOADING
#endif

-- method AudioResampler::options_set_quality
-- method type : MemberFunction
-- Args : [Arg {argCName = "method", argType = TInterface (Name {namespace = "GstAudio", name = "AudioResamplerMethod"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioResamplerMethod", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "quality", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the quality", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "in_rate", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the input rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_rate", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the output rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "options", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStructure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_resampler_options_set_quality" gst_audio_resampler_options_set_quality ::
    CUInt ->                                -- method : TInterface (Name {namespace = "GstAudio", name = "AudioResamplerMethod"})
    Word32 ->                               -- quality : TBasicType TUInt
    Int32 ->                                -- in_rate : TBasicType TInt
    Int32 ->                                -- out_rate : TBasicType TInt
    Ptr Gst.Structure.Structure ->          -- options : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Set the parameters for resampling from /@inRate@/ to /@outRate@/ using /@method@/
for /@quality@/ in /@options@/.
-}
audioResamplerOptionsSetQuality ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GstAudio.Enums.AudioResamplerMethod
    {- ^ /@method@/: a 'GI.GstAudio.Enums.AudioResamplerMethod' -}
    -> Word32
    {- ^ /@quality@/: the quality -}
    -> Int32
    {- ^ /@inRate@/: the input rate -}
    -> Int32
    {- ^ /@outRate@/: the output rate -}
    -> Gst.Structure.Structure
    {- ^ /@options@/: a 'GI.Gst.Structs.Structure.Structure' -}
    -> m ()
audioResamplerOptionsSetQuality method quality inRate outRate options = liftIO $ do
    let method' = (fromIntegral . fromEnum) method
    options' <- unsafeManagedPtrGetPtr options
    gst_audio_resampler_options_set_quality method' quality inRate outRate options'
    touchManagedPtr options
    return ()

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveAudioResamplerMethod (t :: Symbol) (o :: *) :: * where
    ResolveAudioResamplerMethod "free" o = AudioResamplerFreeMethodInfo
    ResolveAudioResamplerMethod "resample" o = AudioResamplerResampleMethodInfo
    ResolveAudioResamplerMethod "reset" o = AudioResamplerResetMethodInfo
    ResolveAudioResamplerMethod "update" o = AudioResamplerUpdateMethodInfo
    ResolveAudioResamplerMethod "getInFrames" o = AudioResamplerGetInFramesMethodInfo
    ResolveAudioResamplerMethod "getMaxLatency" o = AudioResamplerGetMaxLatencyMethodInfo
    ResolveAudioResamplerMethod "getOutFrames" o = AudioResamplerGetOutFramesMethodInfo
    ResolveAudioResamplerMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAudioResamplerMethod t AudioResampler, O.MethodInfo info AudioResampler p) => OL.IsLabel t (AudioResampler -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif