{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- 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(..)                       ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [free]("GI.GstAudio.Structs.AudioQuantize#g:method:free"), [reset]("GI.GstAudio.Structs.AudioQuantize#g:method:reset"), [samples]("GI.GstAudio.Structs.AudioQuantize#g:method:samples").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- /None/.

#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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R


-- | Memory-managed wrapper type.
newtype AudioQuantize = AudioQuantize (SP.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)

instance SP.ManagedPtrNewtype AudioQuantize where
    toManagedPtr :: AudioQuantize -> ManagedPtr AudioQuantize
toManagedPtr (AudioQuantize ManagedPtr AudioQuantize
p) = ManagedPtr AudioQuantize
p

-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance BoxedPtr AudioQuantize where
    boxedPtrCopy :: AudioQuantize -> IO AudioQuantize
boxedPtrCopy = AudioQuantize -> IO AudioQuantize
forall (m :: * -> *) a. Monad m => a -> m a
return
    boxedPtrFree :: AudioQuantize -> IO ()
boxedPtrFree = \AudioQuantize
_x -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


#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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AudioQuantize -> m ()
audioQuantizeFree 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.OverloadedMethod AudioQuantizeFreeMethodInfo AudioQuantize signature where
    overloadedMethod = audioQuantizeFree

instance O.OverloadedMethodInfo AudioQuantizeFreeMethodInfo AudioQuantize where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GstAudio.Structs.AudioQuantize.audioQuantizeFree",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gstaudio-1.0.24/docs/GI-GstAudio-Structs-AudioQuantize.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AudioQuantize -> m ()
audioQuantizeReset 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.OverloadedMethod AudioQuantizeResetMethodInfo AudioQuantize signature where
    overloadedMethod = audioQuantizeReset

instance O.OverloadedMethodInfo AudioQuantizeResetMethodInfo AudioQuantize where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GstAudio.Structs.AudioQuantize.audioQuantizeReset",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gstaudio-1.0.24/docs/GI-GstAudio-Structs-AudioQuantize.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
AudioQuantize -> Ptr () -> Ptr () -> Word32 -> m ()
audioQuantizeSamples AudioQuantize
quant Ptr ()
in_ Ptr ()
out 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.OverloadedMethod AudioQuantizeSamplesMethodInfo AudioQuantize signature where
    overloadedMethod = audioQuantizeSamples

instance O.OverloadedMethodInfo AudioQuantizeSamplesMethodInfo AudioQuantize where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GstAudio.Structs.AudioQuantize.audioQuantizeSamples",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gstaudio-1.0.24/docs/GI-GstAudio-Structs-AudioQuantize.html#v: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.OverloadedMethod 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

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveAudioQuantizeMethod t AudioQuantize, O.OverloadedMethod info AudioQuantize p, R.HasField t AudioQuantize p) => R.HasField t AudioQuantize p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveAudioQuantizeMethod t AudioQuantize, O.OverloadedMethodInfo info AudioQuantize) => OL.IsLabel t (O.MethodProxy info AudioQuantize) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif