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

This interface is implemented by elements that provide a stream volume. Examples for
such elements are @/volume/@ and @/playbin/@.

Applications can use this interface to get or set the current stream volume. For this
the \"volume\" 'GI.GObject.Objects.Object.Object' property can be used or the helper functions 'GI.GstAudio.Interfaces.StreamVolume.streamVolumeSetVolume'
and 'GI.GstAudio.Interfaces.StreamVolume.streamVolumeGetVolume'. This volume is always a linear factor, i.e. 0.0 is muted
1.0 is 100%. For showing the volume in a GUI it might make sense to convert it to
a different format by using 'GI.GstAudio.Functions.streamVolumeConvertVolume'. Volume sliders should usually
use a cubic volume.

Separate from the volume the stream can also be muted by the \"mute\" 'GI.GObject.Objects.Object.Object' property or
'GI.GstAudio.Interfaces.StreamVolume.streamVolumeSetMute' and 'GI.GstAudio.Interfaces.StreamVolume.streamVolumeGetMute'.

Elements that provide some kind of stream volume should implement the \"volume\" and
\"mute\" 'GI.GObject.Objects.Object.Object' properties and handle setting and getting of them properly.
The volume property is defined to be a linear volume factor.
-}

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

module GI.GstAudio.Interfaces.StreamVolume
    (

-- * Exported types
    StreamVolume(..)                        ,
    noStreamVolume                          ,
    IsStreamVolume                          ,
    toStreamVolume                          ,


 -- * Methods
-- ** convertVolume #method:convertVolume#

    streamVolumeConvertVolume               ,


-- ** getMute #method:getMute#

#if ENABLE_OVERLOADING
    StreamVolumeGetMuteMethodInfo           ,
#endif
    streamVolumeGetMute                     ,


-- ** getVolume #method:getVolume#

#if ENABLE_OVERLOADING
    StreamVolumeGetVolumeMethodInfo         ,
#endif
    streamVolumeGetVolume                   ,


-- ** setMute #method:setMute#

#if ENABLE_OVERLOADING
    StreamVolumeSetMuteMethodInfo           ,
#endif
    streamVolumeSetMute                     ,


-- ** setVolume #method:setVolume#

#if ENABLE_OVERLOADING
    StreamVolumeSetVolumeMethodInfo         ,
#endif
    streamVolumeSetVolume                   ,




 -- * Properties
-- ** mute #attr:mute#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    StreamVolumeMutePropertyInfo            ,
#endif
    constructStreamVolumeMute               ,
    getStreamVolumeMute                     ,
    setStreamVolumeMute                     ,
#if ENABLE_OVERLOADING
    streamVolumeMute                        ,
#endif


-- ** volume #attr:volume#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    StreamVolumeVolumePropertyInfo          ,
#endif
    constructStreamVolumeVolume             ,
    getStreamVolumeVolume                   ,
    setStreamVolumeVolume                   ,
#if ENABLE_OVERLOADING
    streamVolumeVolume                      ,
#endif




    ) 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.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.GstAudio.Enums as GstAudio.Enums

-- interface StreamVolume 
-- | Memory-managed wrapper type.
newtype StreamVolume = StreamVolume (ManagedPtr StreamVolume)
-- | A convenience alias for `Nothing` :: `Maybe` `StreamVolume`.
noStreamVolume :: Maybe StreamVolume
noStreamVolume = Nothing

#if ENABLE_OVERLOADING
type instance O.SignalList StreamVolume = StreamVolumeSignalList
type StreamVolumeSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

foreign import ccall "gst_stream_volume_get_type"
    c_gst_stream_volume_get_type :: IO GType

instance GObject StreamVolume where
    gobjectType = c_gst_stream_volume_get_type


-- | Type class for types which can be safely cast to `StreamVolume`, for instance with `toStreamVolume`.
class (GObject o, O.IsDescendantOf StreamVolume o) => IsStreamVolume o
instance (GObject o, O.IsDescendantOf StreamVolume o) => IsStreamVolume o

instance O.HasParentTypes StreamVolume
type instance O.ParentTypes StreamVolume = '[GObject.Object.Object]

-- | Cast to `StreamVolume`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toStreamVolume :: (MonadIO m, IsStreamVolume o) => o -> m StreamVolume
toStreamVolume = liftIO . unsafeCastTo StreamVolume

-- VVV Prop "mute"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

{- |
Get the value of the “@mute@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' streamVolume #mute
@
-}
getStreamVolumeMute :: (MonadIO m, IsStreamVolume o) => o -> m Bool
getStreamVolumeMute obj = liftIO $ B.Properties.getObjectPropertyBool obj "mute"

{- |
Set the value of the “@mute@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' streamVolume [ #mute 'Data.GI.Base.Attributes.:=' value ]
@
-}
setStreamVolumeMute :: (MonadIO m, IsStreamVolume o) => o -> Bool -> m ()
setStreamVolumeMute obj val = liftIO $ B.Properties.setObjectPropertyBool obj "mute" val

{- |
Construct a `GValueConstruct` with valid value for the “@mute@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructStreamVolumeMute :: (IsStreamVolume o) => Bool -> IO (GValueConstruct o)
constructStreamVolumeMute val = B.Properties.constructObjectPropertyBool "mute" val

#if ENABLE_OVERLOADING
data StreamVolumeMutePropertyInfo
instance AttrInfo StreamVolumeMutePropertyInfo where
    type AttrAllowedOps StreamVolumeMutePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint StreamVolumeMutePropertyInfo = (~) Bool
    type AttrBaseTypeConstraint StreamVolumeMutePropertyInfo = IsStreamVolume
    type AttrGetType StreamVolumeMutePropertyInfo = Bool
    type AttrLabel StreamVolumeMutePropertyInfo = "mute"
    type AttrOrigin StreamVolumeMutePropertyInfo = StreamVolume
    attrGet _ = getStreamVolumeMute
    attrSet _ = setStreamVolumeMute
    attrConstruct _ = constructStreamVolumeMute
    attrClear _ = undefined
#endif

-- VVV Prop "volume"
   -- Type: TBasicType TDouble
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@volume@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' streamVolume #volume
@
-}
getStreamVolumeVolume :: (MonadIO m, IsStreamVolume o) => o -> m Double
getStreamVolumeVolume obj = liftIO $ B.Properties.getObjectPropertyDouble obj "volume"

{- |
Set the value of the “@volume@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' streamVolume [ #volume 'Data.GI.Base.Attributes.:=' value ]
@
-}
setStreamVolumeVolume :: (MonadIO m, IsStreamVolume o) => o -> Double -> m ()
setStreamVolumeVolume obj val = liftIO $ B.Properties.setObjectPropertyDouble obj "volume" val

{- |
Construct a `GValueConstruct` with valid value for the “@volume@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructStreamVolumeVolume :: (IsStreamVolume o) => Double -> IO (GValueConstruct o)
constructStreamVolumeVolume val = B.Properties.constructObjectPropertyDouble "volume" val

#if ENABLE_OVERLOADING
data StreamVolumeVolumePropertyInfo
instance AttrInfo StreamVolumeVolumePropertyInfo where
    type AttrAllowedOps StreamVolumeVolumePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint StreamVolumeVolumePropertyInfo = (~) Double
    type AttrBaseTypeConstraint StreamVolumeVolumePropertyInfo = IsStreamVolume
    type AttrGetType StreamVolumeVolumePropertyInfo = Double
    type AttrLabel StreamVolumeVolumePropertyInfo = "volume"
    type AttrOrigin StreamVolumeVolumePropertyInfo = StreamVolume
    attrGet _ = getStreamVolumeVolume
    attrSet _ = setStreamVolumeVolume
    attrConstruct _ = constructStreamVolumeVolume
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList StreamVolume
type instance O.AttributeList StreamVolume = StreamVolumeAttributeList
type StreamVolumeAttributeList = ('[ '("mute", StreamVolumeMutePropertyInfo), '("volume", StreamVolumeVolumePropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
streamVolumeMute :: AttrLabelProxy "mute"
streamVolumeMute = AttrLabelProxy

streamVolumeVolume :: AttrLabelProxy "volume"
streamVolumeVolume = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type family ResolveStreamVolumeMethod (t :: Symbol) (o :: *) :: * where
    ResolveStreamVolumeMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveStreamVolumeMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveStreamVolumeMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveStreamVolumeMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveStreamVolumeMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveStreamVolumeMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveStreamVolumeMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveStreamVolumeMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveStreamVolumeMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveStreamVolumeMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveStreamVolumeMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveStreamVolumeMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveStreamVolumeMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveStreamVolumeMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveStreamVolumeMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveStreamVolumeMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveStreamVolumeMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveStreamVolumeMethod "getMute" o = StreamVolumeGetMuteMethodInfo
    ResolveStreamVolumeMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveStreamVolumeMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveStreamVolumeMethod "getVolume" o = StreamVolumeGetVolumeMethodInfo
    ResolveStreamVolumeMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveStreamVolumeMethod "setMute" o = StreamVolumeSetMuteMethodInfo
    ResolveStreamVolumeMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveStreamVolumeMethod "setVolume" o = StreamVolumeSetVolumeMethodInfo
    ResolveStreamVolumeMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveStreamVolumeMethod t StreamVolume, O.MethodInfo info StreamVolume p) => OL.IsLabel t (StreamVolume -> 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

-- method StreamVolume::get_mute
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "volume", argType = TInterface (Name {namespace = "GstAudio", name = "StreamVolume"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstStreamVolume that should be used", 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_stream_volume_get_mute" gst_stream_volume_get_mute ::
    Ptr StreamVolume ->                     -- volume : TInterface (Name {namespace = "GstAudio", name = "StreamVolume"})
    IO CInt

{- |
/No description available in the introspection data./
-}
streamVolumeGetMute ::
    (B.CallStack.HasCallStack, MonadIO m, IsStreamVolume a) =>
    a
    {- ^ /@volume@/: 'GI.GstAudio.Interfaces.StreamVolume.StreamVolume' that should be used -}
    -> m Bool
    {- ^ __Returns:__ Returns 'True' if the stream is muted -}
streamVolumeGetMute volume = liftIO $ do
    volume' <- unsafeManagedPtrCastPtr volume
    result <- gst_stream_volume_get_mute volume'
    let result' = (/= 0) result
    touchManagedPtr volume
    return result'

#if ENABLE_OVERLOADING
data StreamVolumeGetMuteMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsStreamVolume a) => O.MethodInfo StreamVolumeGetMuteMethodInfo a signature where
    overloadedMethod _ = streamVolumeGetMute

#endif

-- method StreamVolume::get_volume
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "volume", argType = TInterface (Name {namespace = "GstAudio", name = "StreamVolume"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstStreamVolume that should be used", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "GstAudio", name = "StreamVolumeFormat"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstStreamVolumeFormat which should be returned", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_volume_get_volume" gst_stream_volume_get_volume ::
    Ptr StreamVolume ->                     -- volume : TInterface (Name {namespace = "GstAudio", name = "StreamVolume"})
    CUInt ->                                -- format : TInterface (Name {namespace = "GstAudio", name = "StreamVolumeFormat"})
    IO CDouble

{- |
/No description available in the introspection data./
-}
streamVolumeGetVolume ::
    (B.CallStack.HasCallStack, MonadIO m, IsStreamVolume a) =>
    a
    {- ^ /@volume@/: 'GI.GstAudio.Interfaces.StreamVolume.StreamVolume' that should be used -}
    -> GstAudio.Enums.StreamVolumeFormat
    {- ^ /@format@/: 'GI.GstAudio.Enums.StreamVolumeFormat' which should be returned -}
    -> m Double
    {- ^ __Returns:__ The current stream volume as linear factor -}
streamVolumeGetVolume volume format = liftIO $ do
    volume' <- unsafeManagedPtrCastPtr volume
    let format' = (fromIntegral . fromEnum) format
    result <- gst_stream_volume_get_volume volume' format'
    let result' = realToFrac result
    touchManagedPtr volume
    return result'

#if ENABLE_OVERLOADING
data StreamVolumeGetVolumeMethodInfo
instance (signature ~ (GstAudio.Enums.StreamVolumeFormat -> m Double), MonadIO m, IsStreamVolume a) => O.MethodInfo StreamVolumeGetVolumeMethodInfo a signature where
    overloadedMethod _ = streamVolumeGetVolume

#endif

-- method StreamVolume::set_mute
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "volume", argType = TInterface (Name {namespace = "GstAudio", name = "StreamVolume"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstStreamVolume that should be used", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mute", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Mute state that should be set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_volume_set_mute" gst_stream_volume_set_mute ::
    Ptr StreamVolume ->                     -- volume : TInterface (Name {namespace = "GstAudio", name = "StreamVolume"})
    CInt ->                                 -- mute : TBasicType TBoolean
    IO ()

{- |
/No description available in the introspection data./
-}
streamVolumeSetMute ::
    (B.CallStack.HasCallStack, MonadIO m, IsStreamVolume a) =>
    a
    {- ^ /@volume@/: 'GI.GstAudio.Interfaces.StreamVolume.StreamVolume' that should be used -}
    -> Bool
    {- ^ /@mute@/: Mute state that should be set -}
    -> m ()
streamVolumeSetMute volume mute = liftIO $ do
    volume' <- unsafeManagedPtrCastPtr volume
    let mute' = (fromIntegral . fromEnum) mute
    gst_stream_volume_set_mute volume' mute'
    touchManagedPtr volume
    return ()

#if ENABLE_OVERLOADING
data StreamVolumeSetMuteMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsStreamVolume a) => O.MethodInfo StreamVolumeSetMuteMethodInfo a signature where
    overloadedMethod _ = streamVolumeSetMute

#endif

-- method StreamVolume::set_volume
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "volume", argType = TInterface (Name {namespace = "GstAudio", name = "StreamVolume"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstStreamVolume that should be used", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "GstAudio", name = "StreamVolumeFormat"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstStreamVolumeFormat of @val", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "val", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Linear volume factor that should be set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_volume_set_volume" gst_stream_volume_set_volume ::
    Ptr StreamVolume ->                     -- volume : TInterface (Name {namespace = "GstAudio", name = "StreamVolume"})
    CUInt ->                                -- format : TInterface (Name {namespace = "GstAudio", name = "StreamVolumeFormat"})
    CDouble ->                              -- val : TBasicType TDouble
    IO ()

{- |
/No description available in the introspection data./
-}
streamVolumeSetVolume ::
    (B.CallStack.HasCallStack, MonadIO m, IsStreamVolume a) =>
    a
    {- ^ /@volume@/: 'GI.GstAudio.Interfaces.StreamVolume.StreamVolume' that should be used -}
    -> GstAudio.Enums.StreamVolumeFormat
    {- ^ /@format@/: 'GI.GstAudio.Enums.StreamVolumeFormat' of /@val@/ -}
    -> Double
    {- ^ /@val@/: Linear volume factor that should be set -}
    -> m ()
streamVolumeSetVolume volume format val = liftIO $ do
    volume' <- unsafeManagedPtrCastPtr volume
    let format' = (fromIntegral . fromEnum) format
    let val' = realToFrac val
    gst_stream_volume_set_volume volume' format' val'
    touchManagedPtr volume
    return ()

#if ENABLE_OVERLOADING
data StreamVolumeSetVolumeMethodInfo
instance (signature ~ (GstAudio.Enums.StreamVolumeFormat -> Double -> m ()), MonadIO m, IsStreamVolume a) => O.MethodInfo StreamVolumeSetVolumeMethodInfo a signature where
    overloadedMethod _ = streamVolumeSetVolume

#endif

-- method StreamVolume::convert_volume
-- method type : MemberFunction
-- Args : [Arg {argCName = "from", argType = TInterface (Name {namespace = "GstAudio", name = "StreamVolumeFormat"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstStreamVolumeFormat to convert from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "to", argType = TInterface (Name {namespace = "GstAudio", name = "StreamVolumeFormat"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstStreamVolumeFormat to convert to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "val", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Volume in @from format that should be converted", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "gst_stream_volume_convert_volume" gst_stream_volume_convert_volume ::
    CUInt ->                                -- from : TInterface (Name {namespace = "GstAudio", name = "StreamVolumeFormat"})
    CUInt ->                                -- to : TInterface (Name {namespace = "GstAudio", name = "StreamVolumeFormat"})
    CDouble ->                              -- val : TBasicType TDouble
    IO CDouble

{- |
/No description available in the introspection data./
-}
streamVolumeConvertVolume ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GstAudio.Enums.StreamVolumeFormat
    {- ^ /@from@/: 'GI.GstAudio.Enums.StreamVolumeFormat' to convert from -}
    -> GstAudio.Enums.StreamVolumeFormat
    {- ^ /@to@/: 'GI.GstAudio.Enums.StreamVolumeFormat' to convert to -}
    -> Double
    {- ^ /@val@/: Volume in /@from@/ format that should be converted -}
    -> m Double
    {- ^ __Returns:__ the converted volume -}
streamVolumeConvertVolume from to val = liftIO $ do
    let from' = (fromIntegral . fromEnum) from
    let to' = (fromIntegral . fromEnum) to
    let val' = realToFrac val
    result <- gst_stream_volume_convert_volume from' to' val'
    let result' = realToFrac result
    return result'

#if ENABLE_OVERLOADING
#endif