{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.GstAudio.Structs.AudioConverter
    ( 

-- * Exported types
    AudioConverter(..)                      ,
    noAudioConverter                        ,


 -- * Methods
-- ** free #method:free#
    AudioConverterFreeMethodInfo            ,
    audioConverterFree                      ,


-- ** getConfig #method:getConfig#
    AudioConverterGetConfigMethodInfo       ,
    audioConverterGetConfig                 ,


-- ** getInFrames #method:getInFrames#
    AudioConverterGetInFramesMethodInfo     ,
    audioConverterGetInFrames               ,


-- ** getMaxLatency #method:getMaxLatency#
    AudioConverterGetMaxLatencyMethodInfo   ,
    audioConverterGetMaxLatency             ,


-- ** getOutFrames #method:getOutFrames#
    AudioConverterGetOutFramesMethodInfo    ,
    audioConverterGetOutFrames              ,


-- ** reset #method:reset#
    AudioConverterResetMethodInfo           ,
    audioConverterReset                     ,


-- ** samples #method:samples#
    AudioConverterSamplesMethodInfo         ,
    audioConverterSamples                   ,


-- ** updateConfig #method:updateConfig#
    AudioConverterUpdateConfigMethodInfo    ,
    audioConverterUpdateConfig              ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 GI.Gst.Structs.Structure as Gst.Structure
import {-# SOURCE #-} qualified GI.GstAudio.Flags as GstAudio.Flags

newtype AudioConverter = AudioConverter (ManagedPtr AudioConverter)
-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance WrappedPtr AudioConverter where
    wrappedPtrCalloc = return nullPtr
    wrappedPtrCopy = return
    wrappedPtrFree = Nothing

noAudioConverter :: Maybe AudioConverter
noAudioConverter = Nothing


instance O.HasAttributeList AudioConverter
type instance O.AttributeList AudioConverter = AudioConverterAttributeList
type AudioConverterAttributeList = ('[ ] :: [(Symbol, *)])

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

{- |
Free a previously allocated /@convert@/ instance.
-}
audioConverterFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioConverter
    {- ^ /@convert@/: a 'GI.GstAudio.Structs.AudioConverter.AudioConverter' -}
    -> m ()
audioConverterFree convert = liftIO $ do
    convert' <- unsafeManagedPtrGetPtr convert
    gst_audio_converter_free convert'
    touchManagedPtr convert
    return ()

data AudioConverterFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioConverterFreeMethodInfo AudioConverter signature where
    overloadedMethod _ = audioConverterFree

-- method AudioConverter::get_config
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "convert", argType = TInterface (Name {namespace = "GstAudio", name = "AudioConverter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioConverter", 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 "result 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 "result output rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_converter_get_config" gst_audio_converter_get_config :: 
    Ptr AudioConverter ->                   -- convert : TInterface (Name {namespace = "GstAudio", name = "AudioConverter"})
    Int32 ->                                -- in_rate : TBasicType TInt
    Int32 ->                                -- out_rate : TBasicType TInt
    IO (Ptr Gst.Structure.Structure)

{- |
Get the current configuration of /@convert@/.
-}
audioConverterGetConfig ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioConverter
    {- ^ /@convert@/: a 'GI.GstAudio.Structs.AudioConverter.AudioConverter' -}
    -> Int32
    {- ^ /@inRate@/: result input rate -}
    -> Int32
    {- ^ /@outRate@/: result output rate -}
    -> m Gst.Structure.Structure
    {- ^ __Returns:__ a 'GI.Gst.Structs.Structure.Structure' that remains valid for as long as /@convert@/ is valid
  or until 'GI.GstAudio.Structs.AudioConverter.audioConverterUpdateConfig' is called. -}
audioConverterGetConfig convert inRate outRate = liftIO $ do
    convert' <- unsafeManagedPtrGetPtr convert
    result <- gst_audio_converter_get_config convert' inRate outRate
    checkUnexpectedReturnNULL "audioConverterGetConfig" result
    result' <- (newBoxed Gst.Structure.Structure) result
    touchManagedPtr convert
    return result'

data AudioConverterGetConfigMethodInfo
instance (signature ~ (Int32 -> Int32 -> m Gst.Structure.Structure), MonadIO m) => O.MethodInfo AudioConverterGetConfigMethodInfo AudioConverter signature where
    overloadedMethod _ = audioConverterGetConfig

-- method AudioConverter::get_in_frames
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "convert", argType = TInterface (Name {namespace = "GstAudio", name = "AudioConverter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioConverter", 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 : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

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

{- |
Calculate how many input frames are currently needed by /@convert@/ to produce
/@outFrames@/ of output frames.
-}
audioConverterGetInFrames ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioConverter
    {- ^ /@convert@/: a 'GI.GstAudio.Structs.AudioConverter.AudioConverter' -}
    -> Word64
    {- ^ /@outFrames@/: number of output frames -}
    -> m Word64
    {- ^ __Returns:__ the number of input frames -}
audioConverterGetInFrames convert outFrames = liftIO $ do
    convert' <- unsafeManagedPtrGetPtr convert
    result <- gst_audio_converter_get_in_frames convert' outFrames
    touchManagedPtr convert
    return result

data AudioConverterGetInFramesMethodInfo
instance (signature ~ (Word64 -> m Word64), MonadIO m) => O.MethodInfo AudioConverterGetInFramesMethodInfo AudioConverter signature where
    overloadedMethod _ = audioConverterGetInFrames

-- method AudioConverter::get_max_latency
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "convert", argType = TInterface (Name {namespace = "GstAudio", name = "AudioConverter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioConverter", 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_converter_get_max_latency" gst_audio_converter_get_max_latency :: 
    Ptr AudioConverter ->                   -- convert : TInterface (Name {namespace = "GstAudio", name = "AudioConverter"})
    IO Word64

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

data AudioConverterGetMaxLatencyMethodInfo
instance (signature ~ (m Word64), MonadIO m) => O.MethodInfo AudioConverterGetMaxLatencyMethodInfo AudioConverter signature where
    overloadedMethod _ = audioConverterGetMaxLatency

-- method AudioConverter::get_out_frames
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "convert", argType = TInterface (Name {namespace = "GstAudio", name = "AudioConverter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioConverter", 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_converter_get_out_frames" gst_audio_converter_get_out_frames :: 
    Ptr AudioConverter ->                   -- convert : TInterface (Name {namespace = "GstAudio", name = "AudioConverter"})
    Word64 ->                               -- in_frames : TBasicType TUInt64
    IO Word64

{- |
Calculate how many output frames can be produced when /@inFrames@/ input
frames are given to /@convert@/.
-}
audioConverterGetOutFrames ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioConverter
    {- ^ /@convert@/: a 'GI.GstAudio.Structs.AudioConverter.AudioConverter' -}
    -> Word64
    {- ^ /@inFrames@/: number of input frames -}
    -> m Word64
    {- ^ __Returns:__ the number of output frames -}
audioConverterGetOutFrames convert inFrames = liftIO $ do
    convert' <- unsafeManagedPtrGetPtr convert
    result <- gst_audio_converter_get_out_frames convert' inFrames
    touchManagedPtr convert
    return result

data AudioConverterGetOutFramesMethodInfo
instance (signature ~ (Word64 -> m Word64), MonadIO m) => O.MethodInfo AudioConverterGetOutFramesMethodInfo AudioConverter signature where
    overloadedMethod _ = audioConverterGetOutFrames

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

{- |
Reset /@convert@/ to the state it was when it was first created, clearing
any history it might currently have.
-}
audioConverterReset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioConverter
    {- ^ /@convert@/: a 'GI.GstAudio.Structs.AudioConverter.AudioConverter' -}
    -> m ()
audioConverterReset convert = liftIO $ do
    convert' <- unsafeManagedPtrGetPtr convert
    gst_audio_converter_reset convert'
    touchManagedPtr convert
    return ()

data AudioConverterResetMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioConverterResetMethodInfo AudioConverter signature where
    overloadedMethod _ = audioConverterReset

-- method AudioConverter::samples
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "convert", argType = TInterface (Name {namespace = "GstAudio", name = "AudioConverter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioConverter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GstAudio", name = "AudioConverterFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "extra #GstAudioConverterFlags", 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 frames", 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 frames", 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 : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_converter_samples" gst_audio_converter_samples :: 
    Ptr AudioConverter ->                   -- convert : TInterface (Name {namespace = "GstAudio", name = "AudioConverter"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "GstAudio", name = "AudioConverterFlags"})
    Ptr () ->                               -- in : TBasicType TPtr
    Word64 ->                               -- in_frames : TBasicType TUInt64
    Ptr () ->                               -- out : TBasicType TPtr
    Word64 ->                               -- out_frames : TBasicType TUInt64
    IO CInt

{- |
Perform the conversion with /@inFrames@/ in /@in@/ to /@outFrames@/ in /@out@/
using /@convert@/.

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 processed
by the converter.

This function always produces /@outFrames@/ of output and consumes /@inFrames@/ of
input. Use 'GI.GstAudio.Structs.AudioConverter.audioConverterGetOutFrames' and
'GI.GstAudio.Structs.AudioConverter.audioConverterGetInFrames' to make sure /@inFrames@/ and /@outFrames@/
are matching and /@in@/ and /@out@/ point to enough memory.
-}
audioConverterSamples ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioConverter
    {- ^ /@convert@/: a 'GI.GstAudio.Structs.AudioConverter.AudioConverter' -}
    -> [GstAudio.Flags.AudioConverterFlags]
    {- ^ /@flags@/: extra 'GI.GstAudio.Flags.AudioConverterFlags' -}
    -> Ptr ()
    {- ^ /@in@/: input frames -}
    -> Word64
    {- ^ /@inFrames@/: number of input frames -}
    -> Ptr ()
    {- ^ /@out@/: output frames -}
    -> Word64
    {- ^ /@outFrames@/: number of output frames -}
    -> m Bool
    {- ^ __Returns:__ 'True' is the conversion could be performed. -}
audioConverterSamples convert flags in_ inFrames out outFrames = liftIO $ do
    convert' <- unsafeManagedPtrGetPtr convert
    let flags' = gflagsToWord flags
    result <- gst_audio_converter_samples convert' flags' in_ inFrames out outFrames
    let result' = (/= 0) result
    touchManagedPtr convert
    return result'

data AudioConverterSamplesMethodInfo
instance (signature ~ ([GstAudio.Flags.AudioConverterFlags] -> Ptr () -> Word64 -> Ptr () -> Word64 -> m Bool), MonadIO m) => O.MethodInfo AudioConverterSamplesMethodInfo AudioConverter signature where
    overloadedMethod _ = audioConverterSamples

-- method AudioConverter::update_config
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "convert", argType = TInterface (Name {namespace = "GstAudio", name = "AudioConverter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioConverter", 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 = "config", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GstStructure or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_audio_converter_update_config" gst_audio_converter_update_config :: 
    Ptr AudioConverter ->                   -- convert : TInterface (Name {namespace = "GstAudio", name = "AudioConverter"})
    Int32 ->                                -- in_rate : TBasicType TInt
    Int32 ->                                -- out_rate : TBasicType TInt
    Ptr Gst.Structure.Structure ->          -- config : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO CInt

{- |
Set /@inRate@/, /@outRate@/ and /@config@/ as extra configuration for /@convert@/.

/@inRate@/ and /@outRate@/ specify the new sample rates of input and output
formats. A value of 0 leaves the sample rate unchanged.

/@config@/ can be 'Nothing', in which case, the current configuration is not
changed.

If the parameters in /@config@/ can not be set exactly, this function returns
'False' and will try to update as much state as possible. The new state can
then be retrieved and refined with 'GI.GstAudio.Structs.AudioConverter.audioConverterGetConfig'.

Look at the @/GST_AUDIO_CONVERTER_OPT_/@* fields to check valid configuration
option and values.
-}
audioConverterUpdateConfig ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    AudioConverter
    {- ^ /@convert@/: a 'GI.GstAudio.Structs.AudioConverter.AudioConverter' -}
    -> Int32
    {- ^ /@inRate@/: input rate -}
    -> Int32
    {- ^ /@outRate@/: output rate -}
    -> Maybe (Gst.Structure.Structure)
    {- ^ /@config@/: a 'GI.Gst.Structs.Structure.Structure' or 'Nothing' -}
    -> m Bool
    {- ^ __Returns:__ 'True' when the new parameters could be set -}
audioConverterUpdateConfig convert inRate outRate config = liftIO $ do
    convert' <- unsafeManagedPtrGetPtr convert
    maybeConfig <- case config of
        Nothing -> return nullPtr
        Just jConfig -> do
            jConfig' <- B.ManagedPtr.disownBoxed jConfig
            return jConfig'
    result <- gst_audio_converter_update_config convert' inRate outRate maybeConfig
    let result' = (/= 0) result
    touchManagedPtr convert
    whenJust config touchManagedPtr
    return result'

data AudioConverterUpdateConfigMethodInfo
instance (signature ~ (Int32 -> Int32 -> Maybe (Gst.Structure.Structure) -> m Bool), MonadIO m) => O.MethodInfo AudioConverterUpdateConfigMethodInfo AudioConverter signature where
    overloadedMethod _ = audioConverterUpdateConfig

type family ResolveAudioConverterMethod (t :: Symbol) (o :: *) :: * where
    ResolveAudioConverterMethod "free" o = AudioConverterFreeMethodInfo
    ResolveAudioConverterMethod "reset" o = AudioConverterResetMethodInfo
    ResolveAudioConverterMethod "samples" o = AudioConverterSamplesMethodInfo
    ResolveAudioConverterMethod "updateConfig" o = AudioConverterUpdateConfigMethodInfo
    ResolveAudioConverterMethod "getConfig" o = AudioConverterGetConfigMethodInfo
    ResolveAudioConverterMethod "getInFrames" o = AudioConverterGetInFramesMethodInfo
    ResolveAudioConverterMethod "getMaxLatency" o = AudioConverterGetMaxLatencyMethodInfo
    ResolveAudioConverterMethod "getOutFrames" o = AudioConverterGetOutFramesMethodInfo
    ResolveAudioConverterMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAudioConverterMethod t AudioConverter, O.MethodInfo info AudioConverter p) => O.IsLabelProxy t (AudioConverter -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveAudioConverterMethod t AudioConverter, O.MethodInfo info AudioConverter p) => O.IsLabel t (AudioConverter -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif