{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.GstAudio.Structs.AudioQuantize
    ( 

-- * Exported types
    AudioQuantize(..)                       ,
    noAudioQuantize                         ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveAudioQuantizeMethod              ,
#endif


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    AudioQuantizeFreeMethodInfo             ,
#endif
    audioQuantizeFree                       ,


-- ** reset #method:reset#

#if defined(ENABLE_OVERLOADING)
    AudioQuantizeResetMethodInfo            ,
#endif
    audioQuantizeReset                      ,


-- ** samples #method:samples#

#if defined(ENABLE_OVERLOADING)
    AudioQuantizeSamplesMethodInfo          ,
#endif
    audioQuantizeSamples                    ,




    ) 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.GI.Base.Signals as B.Signals
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


-- | Memory-managed wrapper type.
newtype AudioQuantize = AudioQuantize (ManagedPtr AudioQuantize)
    deriving (AudioQuantize -> AudioQuantize -> Bool
(AudioQuantize -> AudioQuantize -> Bool)
-> (AudioQuantize -> AudioQuantize -> Bool) -> Eq AudioQuantize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioQuantize -> AudioQuantize -> Bool
$c/= :: AudioQuantize -> AudioQuantize -> Bool
== :: AudioQuantize -> AudioQuantize -> Bool
$c== :: AudioQuantize -> AudioQuantize -> Bool
Eq)
-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance WrappedPtr AudioQuantize where
    wrappedPtrCalloc :: IO (Ptr AudioQuantize)
wrappedPtrCalloc = Ptr AudioQuantize -> IO (Ptr AudioQuantize)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr AudioQuantize
forall a. Ptr a
nullPtr
    wrappedPtrCopy :: AudioQuantize -> IO AudioQuantize
wrappedPtrCopy = AudioQuantize -> IO AudioQuantize
forall (m :: * -> *) a. Monad m => a -> m a
return
    wrappedPtrFree :: Maybe (GDestroyNotify AudioQuantize)
wrappedPtrFree = Maybe (GDestroyNotify AudioQuantize)
forall a. Maybe a
Nothing

-- | A convenience alias for `Nothing` :: `Maybe` `AudioQuantize`.
noAudioQuantize :: Maybe AudioQuantize
noAudioQuantize :: Maybe AudioQuantize
noAudioQuantize = Maybe AudioQuantize
forall a. Maybe a
Nothing


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

-- method AudioQuantize::free
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "quant"
--           , argType =
--               TInterface Name { namespace = "GstAudio" , name = "AudioQuantize" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstAudioQuantize"
--                 , 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_quantize_free" gst_audio_quantize_free :: 
    Ptr AudioQuantize ->                    -- quant : TInterface (Name {namespace = "GstAudio", name = "AudioQuantize"})
    IO ()

-- | Free a t'GI.GstAudio.Structs.AudioQuantize.AudioQuantize'.
audioQuantizeFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioQuantize
    -- ^ /@quant@/: a t'GI.GstAudio.Structs.AudioQuantize.AudioQuantize'
    -> m ()
audioQuantizeFree :: AudioQuantize -> m ()
audioQuantizeFree quant :: AudioQuantize
quant = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr AudioQuantize
quant' <- AudioQuantize -> IO (Ptr AudioQuantize)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AudioQuantize
quant
    Ptr AudioQuantize -> IO ()
gst_audio_quantize_free Ptr AudioQuantize
quant'
    AudioQuantize -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AudioQuantize
quant
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data AudioQuantizeFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioQuantizeFreeMethodInfo AudioQuantize signature where
    overloadedMethod = audioQuantizeFree

#endif

-- method AudioQuantize::reset
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "quant"
--           , argType =
--               TInterface Name { namespace = "GstAudio" , name = "AudioQuantize" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstAudioQuantize"
--                 , 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_quantize_reset" gst_audio_quantize_reset :: 
    Ptr AudioQuantize ->                    -- quant : TInterface (Name {namespace = "GstAudio", name = "AudioQuantize"})
    IO ()

-- | Reset /@quant@/ to the state is was when created, clearing any
-- history it might have.
audioQuantizeReset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioQuantize
    -- ^ /@quant@/: a t'GI.GstAudio.Structs.AudioQuantize.AudioQuantize'
    -> m ()
audioQuantizeReset :: AudioQuantize -> m ()
audioQuantizeReset quant :: AudioQuantize
quant = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr AudioQuantize
quant' <- AudioQuantize -> IO (Ptr AudioQuantize)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AudioQuantize
quant
    Ptr AudioQuantize -> IO ()
gst_audio_quantize_reset Ptr AudioQuantize
quant'
    AudioQuantize -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AudioQuantize
quant
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data AudioQuantizeResetMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioQuantizeResetMethodInfo AudioQuantize signature where
    overloadedMethod = audioQuantizeReset

#endif

-- method AudioQuantize::samples
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "quant"
--           , argType =
--               TInterface Name { namespace = "GstAudio" , name = "AudioQuantize" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstAudioQuantize"
--                 , 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 = "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 = "samples"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of samples" , 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_quantize_samples" gst_audio_quantize_samples :: 
    Ptr AudioQuantize ->                    -- quant : TInterface (Name {namespace = "GstAudio", name = "AudioQuantize"})
    Ptr () ->                               -- in : TBasicType TPtr
    Ptr () ->                               -- out : TBasicType TPtr
    Word32 ->                               -- samples : TBasicType TUInt
    IO ()

-- | Perform quantization on /@samples@/ in /@in@/ and write the result 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@/ and /@out@/ may point to the same memory location, in which case samples will be
-- modified in-place.
audioQuantizeSamples ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioQuantize
    -- ^ /@quant@/: a t'GI.GstAudio.Structs.AudioQuantize.AudioQuantize'
    -> Ptr ()
    -- ^ /@in@/: input samples
    -> Ptr ()
    -- ^ /@out@/: output samples
    -> Word32
    -- ^ /@samples@/: number of samples
    -> m ()
audioQuantizeSamples :: AudioQuantize -> Ptr () -> Ptr () -> Word32 -> m ()
audioQuantizeSamples quant :: AudioQuantize
quant in_ :: Ptr ()
in_ out :: Ptr ()
out samples :: Word32
samples = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr AudioQuantize
quant' <- AudioQuantize -> IO (Ptr AudioQuantize)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AudioQuantize
quant
    Ptr AudioQuantize -> Ptr () -> Ptr () -> Word32 -> IO ()
gst_audio_quantize_samples Ptr AudioQuantize
quant' Ptr ()
in_ Ptr ()
out Word32
samples
    AudioQuantize -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AudioQuantize
quant
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data AudioQuantizeSamplesMethodInfo
instance (signature ~ (Ptr () -> Ptr () -> Word32 -> m ()), MonadIO m) => O.MethodInfo AudioQuantizeSamplesMethodInfo AudioQuantize signature where
    overloadedMethod = audioQuantizeSamples

#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveAudioQuantizeMethod (t :: Symbol) (o :: *) :: * where
    ResolveAudioQuantizeMethod "free" o = AudioQuantizeFreeMethodInfo
    ResolveAudioQuantizeMethod "reset" o = AudioQuantizeResetMethodInfo
    ResolveAudioQuantizeMethod "samples" o = AudioQuantizeSamplesMethodInfo
    ResolveAudioQuantizeMethod l o = O.MethodResolutionFailed l o

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

#endif