{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MediaConvert.Types.AudioNormalizationSettings
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConvert.Types.AudioNormalizationSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.AudioNormalizationAlgorithm
import Amazonka.MediaConvert.Types.AudioNormalizationAlgorithmControl
import Amazonka.MediaConvert.Types.AudioNormalizationLoudnessLogging
import Amazonka.MediaConvert.Types.AudioNormalizationPeakCalculation
import qualified Amazonka.Prelude as Prelude

-- | Advanced audio normalization settings. Ignore these settings unless you
-- need to comply with a loudness standard.
--
-- /See:/ 'newAudioNormalizationSettings' smart constructor.
data AudioNormalizationSettings = AudioNormalizationSettings'
  { -- | When enabled the output audio is corrected using the chosen algorithm.
    -- If disabled, the audio will be measured but not adjusted.
    AudioNormalizationSettings
-> Maybe AudioNormalizationAlgorithmControl
algorithmControl :: Prelude.Maybe AudioNormalizationAlgorithmControl,
    -- | When you use Audio normalization (AudioNormalizationSettings),
    -- optionally use this setting to specify a target loudness. If you don\'t
    -- specify a value here, the encoder chooses a value for you, based on the
    -- algorithm that you choose for Algorithm (algorithm). If you choose
    -- algorithm 1770-1, the encoder will choose -24 LKFS; otherwise, the
    -- encoder will choose -23 LKFS.
    AudioNormalizationSettings -> Maybe Double
targetLkfs :: Prelude.Maybe Prelude.Double,
    -- | If set to TRUE_PEAK, calculate and log the TruePeak for each output\'s
    -- audio track loudness.
    AudioNormalizationSettings
-> Maybe AudioNormalizationPeakCalculation
peakCalculation :: Prelude.Maybe AudioNormalizationPeakCalculation,
    -- | Content measuring above this level will be corrected to the target
    -- level. Content measuring below this level will not be corrected.
    AudioNormalizationSettings -> Maybe Int
correctionGateLevel :: Prelude.Maybe Prelude.Int,
    -- | Choose one of the following audio normalization algorithms: ITU-R
    -- BS.1770-1: Ungated loudness. A measurement of ungated average loudness
    -- for an entire piece of content, suitable for measurement of short-form
    -- content under ATSC recommendation A\/85. Supports up to 5.1 audio
    -- channels. ITU-R BS.1770-2: Gated loudness. A measurement of gated
    -- average loudness compliant with the requirements of EBU-R128. Supports
    -- up to 5.1 audio channels. ITU-R BS.1770-3: Modified peak. The same
    -- loudness measurement algorithm as 1770-2, with an updated true peak
    -- measurement. ITU-R BS.1770-4: Higher channel count. Allows for more
    -- audio channels than the other algorithms, including configurations such
    -- as 7.1.
    AudioNormalizationSettings -> Maybe AudioNormalizationAlgorithm
algorithm :: Prelude.Maybe AudioNormalizationAlgorithm,
    -- | If set to LOG, log each output\'s audio track loudness to a CSV file.
    AudioNormalizationSettings
-> Maybe AudioNormalizationLoudnessLogging
loudnessLogging :: Prelude.Maybe AudioNormalizationLoudnessLogging
  }
  deriving (AudioNormalizationSettings -> AudioNormalizationSettings -> Bool
(AudioNormalizationSettings -> AudioNormalizationSettings -> Bool)
-> (AudioNormalizationSettings
    -> AudioNormalizationSettings -> Bool)
-> Eq AudioNormalizationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioNormalizationSettings -> AudioNormalizationSettings -> Bool
$c/= :: AudioNormalizationSettings -> AudioNormalizationSettings -> Bool
== :: AudioNormalizationSettings -> AudioNormalizationSettings -> Bool
$c== :: AudioNormalizationSettings -> AudioNormalizationSettings -> Bool
Prelude.Eq, ReadPrec [AudioNormalizationSettings]
ReadPrec AudioNormalizationSettings
Int -> ReadS AudioNormalizationSettings
ReadS [AudioNormalizationSettings]
(Int -> ReadS AudioNormalizationSettings)
-> ReadS [AudioNormalizationSettings]
-> ReadPrec AudioNormalizationSettings
-> ReadPrec [AudioNormalizationSettings]
-> Read AudioNormalizationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioNormalizationSettings]
$creadListPrec :: ReadPrec [AudioNormalizationSettings]
readPrec :: ReadPrec AudioNormalizationSettings
$creadPrec :: ReadPrec AudioNormalizationSettings
readList :: ReadS [AudioNormalizationSettings]
$creadList :: ReadS [AudioNormalizationSettings]
readsPrec :: Int -> ReadS AudioNormalizationSettings
$creadsPrec :: Int -> ReadS AudioNormalizationSettings
Prelude.Read, Int -> AudioNormalizationSettings -> ShowS
[AudioNormalizationSettings] -> ShowS
AudioNormalizationSettings -> String
(Int -> AudioNormalizationSettings -> ShowS)
-> (AudioNormalizationSettings -> String)
-> ([AudioNormalizationSettings] -> ShowS)
-> Show AudioNormalizationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioNormalizationSettings] -> ShowS
$cshowList :: [AudioNormalizationSettings] -> ShowS
show :: AudioNormalizationSettings -> String
$cshow :: AudioNormalizationSettings -> String
showsPrec :: Int -> AudioNormalizationSettings -> ShowS
$cshowsPrec :: Int -> AudioNormalizationSettings -> ShowS
Prelude.Show, (forall x.
 AudioNormalizationSettings -> Rep AudioNormalizationSettings x)
-> (forall x.
    Rep AudioNormalizationSettings x -> AudioNormalizationSettings)
-> Generic AudioNormalizationSettings
forall x.
Rep AudioNormalizationSettings x -> AudioNormalizationSettings
forall x.
AudioNormalizationSettings -> Rep AudioNormalizationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AudioNormalizationSettings x -> AudioNormalizationSettings
$cfrom :: forall x.
AudioNormalizationSettings -> Rep AudioNormalizationSettings x
Prelude.Generic)

-- |
-- Create a value of 'AudioNormalizationSettings' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'algorithmControl', 'audioNormalizationSettings_algorithmControl' - When enabled the output audio is corrected using the chosen algorithm.
-- If disabled, the audio will be measured but not adjusted.
--
-- 'targetLkfs', 'audioNormalizationSettings_targetLkfs' - When you use Audio normalization (AudioNormalizationSettings),
-- optionally use this setting to specify a target loudness. If you don\'t
-- specify a value here, the encoder chooses a value for you, based on the
-- algorithm that you choose for Algorithm (algorithm). If you choose
-- algorithm 1770-1, the encoder will choose -24 LKFS; otherwise, the
-- encoder will choose -23 LKFS.
--
-- 'peakCalculation', 'audioNormalizationSettings_peakCalculation' - If set to TRUE_PEAK, calculate and log the TruePeak for each output\'s
-- audio track loudness.
--
-- 'correctionGateLevel', 'audioNormalizationSettings_correctionGateLevel' - Content measuring above this level will be corrected to the target
-- level. Content measuring below this level will not be corrected.
--
-- 'algorithm', 'audioNormalizationSettings_algorithm' - Choose one of the following audio normalization algorithms: ITU-R
-- BS.1770-1: Ungated loudness. A measurement of ungated average loudness
-- for an entire piece of content, suitable for measurement of short-form
-- content under ATSC recommendation A\/85. Supports up to 5.1 audio
-- channels. ITU-R BS.1770-2: Gated loudness. A measurement of gated
-- average loudness compliant with the requirements of EBU-R128. Supports
-- up to 5.1 audio channels. ITU-R BS.1770-3: Modified peak. The same
-- loudness measurement algorithm as 1770-2, with an updated true peak
-- measurement. ITU-R BS.1770-4: Higher channel count. Allows for more
-- audio channels than the other algorithms, including configurations such
-- as 7.1.
--
-- 'loudnessLogging', 'audioNormalizationSettings_loudnessLogging' - If set to LOG, log each output\'s audio track loudness to a CSV file.
newAudioNormalizationSettings ::
  AudioNormalizationSettings
newAudioNormalizationSettings :: AudioNormalizationSettings
newAudioNormalizationSettings =
  AudioNormalizationSettings' :: Maybe AudioNormalizationAlgorithmControl
-> Maybe Double
-> Maybe AudioNormalizationPeakCalculation
-> Maybe Int
-> Maybe AudioNormalizationAlgorithm
-> Maybe AudioNormalizationLoudnessLogging
-> AudioNormalizationSettings
AudioNormalizationSettings'
    { $sel:algorithmControl:AudioNormalizationSettings' :: Maybe AudioNormalizationAlgorithmControl
algorithmControl =
        Maybe AudioNormalizationAlgorithmControl
forall a. Maybe a
Prelude.Nothing,
      $sel:targetLkfs:AudioNormalizationSettings' :: Maybe Double
targetLkfs = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:peakCalculation:AudioNormalizationSettings' :: Maybe AudioNormalizationPeakCalculation
peakCalculation = Maybe AudioNormalizationPeakCalculation
forall a. Maybe a
Prelude.Nothing,
      $sel:correctionGateLevel:AudioNormalizationSettings' :: Maybe Int
correctionGateLevel = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:algorithm:AudioNormalizationSettings' :: Maybe AudioNormalizationAlgorithm
algorithm = Maybe AudioNormalizationAlgorithm
forall a. Maybe a
Prelude.Nothing,
      $sel:loudnessLogging:AudioNormalizationSettings' :: Maybe AudioNormalizationLoudnessLogging
loudnessLogging = Maybe AudioNormalizationLoudnessLogging
forall a. Maybe a
Prelude.Nothing
    }

-- | When enabled the output audio is corrected using the chosen algorithm.
-- If disabled, the audio will be measured but not adjusted.
audioNormalizationSettings_algorithmControl :: Lens.Lens' AudioNormalizationSettings (Prelude.Maybe AudioNormalizationAlgorithmControl)
audioNormalizationSettings_algorithmControl :: (Maybe AudioNormalizationAlgorithmControl
 -> f (Maybe AudioNormalizationAlgorithmControl))
-> AudioNormalizationSettings -> f AudioNormalizationSettings
audioNormalizationSettings_algorithmControl = (AudioNormalizationSettings
 -> Maybe AudioNormalizationAlgorithmControl)
-> (AudioNormalizationSettings
    -> Maybe AudioNormalizationAlgorithmControl
    -> AudioNormalizationSettings)
-> Lens
     AudioNormalizationSettings
     AudioNormalizationSettings
     (Maybe AudioNormalizationAlgorithmControl)
     (Maybe AudioNormalizationAlgorithmControl)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioNormalizationSettings' {Maybe AudioNormalizationAlgorithmControl
algorithmControl :: Maybe AudioNormalizationAlgorithmControl
$sel:algorithmControl:AudioNormalizationSettings' :: AudioNormalizationSettings
-> Maybe AudioNormalizationAlgorithmControl
algorithmControl} -> Maybe AudioNormalizationAlgorithmControl
algorithmControl) (\s :: AudioNormalizationSettings
s@AudioNormalizationSettings' {} Maybe AudioNormalizationAlgorithmControl
a -> AudioNormalizationSettings
s {$sel:algorithmControl:AudioNormalizationSettings' :: Maybe AudioNormalizationAlgorithmControl
algorithmControl = Maybe AudioNormalizationAlgorithmControl
a} :: AudioNormalizationSettings)

-- | When you use Audio normalization (AudioNormalizationSettings),
-- optionally use this setting to specify a target loudness. If you don\'t
-- specify a value here, the encoder chooses a value for you, based on the
-- algorithm that you choose for Algorithm (algorithm). If you choose
-- algorithm 1770-1, the encoder will choose -24 LKFS; otherwise, the
-- encoder will choose -23 LKFS.
audioNormalizationSettings_targetLkfs :: Lens.Lens' AudioNormalizationSettings (Prelude.Maybe Prelude.Double)
audioNormalizationSettings_targetLkfs :: (Maybe Double -> f (Maybe Double))
-> AudioNormalizationSettings -> f AudioNormalizationSettings
audioNormalizationSettings_targetLkfs = (AudioNormalizationSettings -> Maybe Double)
-> (AudioNormalizationSettings
    -> Maybe Double -> AudioNormalizationSettings)
-> Lens
     AudioNormalizationSettings
     AudioNormalizationSettings
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioNormalizationSettings' {Maybe Double
targetLkfs :: Maybe Double
$sel:targetLkfs:AudioNormalizationSettings' :: AudioNormalizationSettings -> Maybe Double
targetLkfs} -> Maybe Double
targetLkfs) (\s :: AudioNormalizationSettings
s@AudioNormalizationSettings' {} Maybe Double
a -> AudioNormalizationSettings
s {$sel:targetLkfs:AudioNormalizationSettings' :: Maybe Double
targetLkfs = Maybe Double
a} :: AudioNormalizationSettings)

-- | If set to TRUE_PEAK, calculate and log the TruePeak for each output\'s
-- audio track loudness.
audioNormalizationSettings_peakCalculation :: Lens.Lens' AudioNormalizationSettings (Prelude.Maybe AudioNormalizationPeakCalculation)
audioNormalizationSettings_peakCalculation :: (Maybe AudioNormalizationPeakCalculation
 -> f (Maybe AudioNormalizationPeakCalculation))
-> AudioNormalizationSettings -> f AudioNormalizationSettings
audioNormalizationSettings_peakCalculation = (AudioNormalizationSettings
 -> Maybe AudioNormalizationPeakCalculation)
-> (AudioNormalizationSettings
    -> Maybe AudioNormalizationPeakCalculation
    -> AudioNormalizationSettings)
-> Lens
     AudioNormalizationSettings
     AudioNormalizationSettings
     (Maybe AudioNormalizationPeakCalculation)
     (Maybe AudioNormalizationPeakCalculation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioNormalizationSettings' {Maybe AudioNormalizationPeakCalculation
peakCalculation :: Maybe AudioNormalizationPeakCalculation
$sel:peakCalculation:AudioNormalizationSettings' :: AudioNormalizationSettings
-> Maybe AudioNormalizationPeakCalculation
peakCalculation} -> Maybe AudioNormalizationPeakCalculation
peakCalculation) (\s :: AudioNormalizationSettings
s@AudioNormalizationSettings' {} Maybe AudioNormalizationPeakCalculation
a -> AudioNormalizationSettings
s {$sel:peakCalculation:AudioNormalizationSettings' :: Maybe AudioNormalizationPeakCalculation
peakCalculation = Maybe AudioNormalizationPeakCalculation
a} :: AudioNormalizationSettings)

-- | Content measuring above this level will be corrected to the target
-- level. Content measuring below this level will not be corrected.
audioNormalizationSettings_correctionGateLevel :: Lens.Lens' AudioNormalizationSettings (Prelude.Maybe Prelude.Int)
audioNormalizationSettings_correctionGateLevel :: (Maybe Int -> f (Maybe Int))
-> AudioNormalizationSettings -> f AudioNormalizationSettings
audioNormalizationSettings_correctionGateLevel = (AudioNormalizationSettings -> Maybe Int)
-> (AudioNormalizationSettings
    -> Maybe Int -> AudioNormalizationSettings)
-> Lens
     AudioNormalizationSettings
     AudioNormalizationSettings
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioNormalizationSettings' {Maybe Int
correctionGateLevel :: Maybe Int
$sel:correctionGateLevel:AudioNormalizationSettings' :: AudioNormalizationSettings -> Maybe Int
correctionGateLevel} -> Maybe Int
correctionGateLevel) (\s :: AudioNormalizationSettings
s@AudioNormalizationSettings' {} Maybe Int
a -> AudioNormalizationSettings
s {$sel:correctionGateLevel:AudioNormalizationSettings' :: Maybe Int
correctionGateLevel = Maybe Int
a} :: AudioNormalizationSettings)

-- | Choose one of the following audio normalization algorithms: ITU-R
-- BS.1770-1: Ungated loudness. A measurement of ungated average loudness
-- for an entire piece of content, suitable for measurement of short-form
-- content under ATSC recommendation A\/85. Supports up to 5.1 audio
-- channels. ITU-R BS.1770-2: Gated loudness. A measurement of gated
-- average loudness compliant with the requirements of EBU-R128. Supports
-- up to 5.1 audio channels. ITU-R BS.1770-3: Modified peak. The same
-- loudness measurement algorithm as 1770-2, with an updated true peak
-- measurement. ITU-R BS.1770-4: Higher channel count. Allows for more
-- audio channels than the other algorithms, including configurations such
-- as 7.1.
audioNormalizationSettings_algorithm :: Lens.Lens' AudioNormalizationSettings (Prelude.Maybe AudioNormalizationAlgorithm)
audioNormalizationSettings_algorithm :: (Maybe AudioNormalizationAlgorithm
 -> f (Maybe AudioNormalizationAlgorithm))
-> AudioNormalizationSettings -> f AudioNormalizationSettings
audioNormalizationSettings_algorithm = (AudioNormalizationSettings -> Maybe AudioNormalizationAlgorithm)
-> (AudioNormalizationSettings
    -> Maybe AudioNormalizationAlgorithm -> AudioNormalizationSettings)
-> Lens
     AudioNormalizationSettings
     AudioNormalizationSettings
     (Maybe AudioNormalizationAlgorithm)
     (Maybe AudioNormalizationAlgorithm)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioNormalizationSettings' {Maybe AudioNormalizationAlgorithm
algorithm :: Maybe AudioNormalizationAlgorithm
$sel:algorithm:AudioNormalizationSettings' :: AudioNormalizationSettings -> Maybe AudioNormalizationAlgorithm
algorithm} -> Maybe AudioNormalizationAlgorithm
algorithm) (\s :: AudioNormalizationSettings
s@AudioNormalizationSettings' {} Maybe AudioNormalizationAlgorithm
a -> AudioNormalizationSettings
s {$sel:algorithm:AudioNormalizationSettings' :: Maybe AudioNormalizationAlgorithm
algorithm = Maybe AudioNormalizationAlgorithm
a} :: AudioNormalizationSettings)

-- | If set to LOG, log each output\'s audio track loudness to a CSV file.
audioNormalizationSettings_loudnessLogging :: Lens.Lens' AudioNormalizationSettings (Prelude.Maybe AudioNormalizationLoudnessLogging)
audioNormalizationSettings_loudnessLogging :: (Maybe AudioNormalizationLoudnessLogging
 -> f (Maybe AudioNormalizationLoudnessLogging))
-> AudioNormalizationSettings -> f AudioNormalizationSettings
audioNormalizationSettings_loudnessLogging = (AudioNormalizationSettings
 -> Maybe AudioNormalizationLoudnessLogging)
-> (AudioNormalizationSettings
    -> Maybe AudioNormalizationLoudnessLogging
    -> AudioNormalizationSettings)
-> Lens
     AudioNormalizationSettings
     AudioNormalizationSettings
     (Maybe AudioNormalizationLoudnessLogging)
     (Maybe AudioNormalizationLoudnessLogging)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioNormalizationSettings' {Maybe AudioNormalizationLoudnessLogging
loudnessLogging :: Maybe AudioNormalizationLoudnessLogging
$sel:loudnessLogging:AudioNormalizationSettings' :: AudioNormalizationSettings
-> Maybe AudioNormalizationLoudnessLogging
loudnessLogging} -> Maybe AudioNormalizationLoudnessLogging
loudnessLogging) (\s :: AudioNormalizationSettings
s@AudioNormalizationSettings' {} Maybe AudioNormalizationLoudnessLogging
a -> AudioNormalizationSettings
s {$sel:loudnessLogging:AudioNormalizationSettings' :: Maybe AudioNormalizationLoudnessLogging
loudnessLogging = Maybe AudioNormalizationLoudnessLogging
a} :: AudioNormalizationSettings)

instance Core.FromJSON AudioNormalizationSettings where
  parseJSON :: Value -> Parser AudioNormalizationSettings
parseJSON =
    String
-> (Object -> Parser AudioNormalizationSettings)
-> Value
-> Parser AudioNormalizationSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AudioNormalizationSettings"
      ( \Object
x ->
          Maybe AudioNormalizationAlgorithmControl
-> Maybe Double
-> Maybe AudioNormalizationPeakCalculation
-> Maybe Int
-> Maybe AudioNormalizationAlgorithm
-> Maybe AudioNormalizationLoudnessLogging
-> AudioNormalizationSettings
AudioNormalizationSettings'
            (Maybe AudioNormalizationAlgorithmControl
 -> Maybe Double
 -> Maybe AudioNormalizationPeakCalculation
 -> Maybe Int
 -> Maybe AudioNormalizationAlgorithm
 -> Maybe AudioNormalizationLoudnessLogging
 -> AudioNormalizationSettings)
-> Parser (Maybe AudioNormalizationAlgorithmControl)
-> Parser
     (Maybe Double
      -> Maybe AudioNormalizationPeakCalculation
      -> Maybe Int
      -> Maybe AudioNormalizationAlgorithm
      -> Maybe AudioNormalizationLoudnessLogging
      -> AudioNormalizationSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AudioNormalizationAlgorithmControl)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"algorithmControl")
            Parser
  (Maybe Double
   -> Maybe AudioNormalizationPeakCalculation
   -> Maybe Int
   -> Maybe AudioNormalizationAlgorithm
   -> Maybe AudioNormalizationLoudnessLogging
   -> AudioNormalizationSettings)
-> Parser (Maybe Double)
-> Parser
     (Maybe AudioNormalizationPeakCalculation
      -> Maybe Int
      -> Maybe AudioNormalizationAlgorithm
      -> Maybe AudioNormalizationLoudnessLogging
      -> AudioNormalizationSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"targetLkfs")
            Parser
  (Maybe AudioNormalizationPeakCalculation
   -> Maybe Int
   -> Maybe AudioNormalizationAlgorithm
   -> Maybe AudioNormalizationLoudnessLogging
   -> AudioNormalizationSettings)
-> Parser (Maybe AudioNormalizationPeakCalculation)
-> Parser
     (Maybe Int
      -> Maybe AudioNormalizationAlgorithm
      -> Maybe AudioNormalizationLoudnessLogging
      -> AudioNormalizationSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AudioNormalizationPeakCalculation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"peakCalculation")
            Parser
  (Maybe Int
   -> Maybe AudioNormalizationAlgorithm
   -> Maybe AudioNormalizationLoudnessLogging
   -> AudioNormalizationSettings)
-> Parser (Maybe Int)
-> Parser
     (Maybe AudioNormalizationAlgorithm
      -> Maybe AudioNormalizationLoudnessLogging
      -> AudioNormalizationSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"correctionGateLevel")
            Parser
  (Maybe AudioNormalizationAlgorithm
   -> Maybe AudioNormalizationLoudnessLogging
   -> AudioNormalizationSettings)
-> Parser (Maybe AudioNormalizationAlgorithm)
-> Parser
     (Maybe AudioNormalizationLoudnessLogging
      -> AudioNormalizationSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AudioNormalizationAlgorithm)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"algorithm")
            Parser
  (Maybe AudioNormalizationLoudnessLogging
   -> AudioNormalizationSettings)
-> Parser (Maybe AudioNormalizationLoudnessLogging)
-> Parser AudioNormalizationSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AudioNormalizationLoudnessLogging)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"loudnessLogging")
      )

instance Prelude.Hashable AudioNormalizationSettings

instance Prelude.NFData AudioNormalizationSettings

instance Core.ToJSON AudioNormalizationSettings where
  toJSON :: AudioNormalizationSettings -> Value
toJSON AudioNormalizationSettings' {Maybe Double
Maybe Int
Maybe AudioNormalizationAlgorithm
Maybe AudioNormalizationAlgorithmControl
Maybe AudioNormalizationLoudnessLogging
Maybe AudioNormalizationPeakCalculation
loudnessLogging :: Maybe AudioNormalizationLoudnessLogging
algorithm :: Maybe AudioNormalizationAlgorithm
correctionGateLevel :: Maybe Int
peakCalculation :: Maybe AudioNormalizationPeakCalculation
targetLkfs :: Maybe Double
algorithmControl :: Maybe AudioNormalizationAlgorithmControl
$sel:loudnessLogging:AudioNormalizationSettings' :: AudioNormalizationSettings
-> Maybe AudioNormalizationLoudnessLogging
$sel:algorithm:AudioNormalizationSettings' :: AudioNormalizationSettings -> Maybe AudioNormalizationAlgorithm
$sel:correctionGateLevel:AudioNormalizationSettings' :: AudioNormalizationSettings -> Maybe Int
$sel:peakCalculation:AudioNormalizationSettings' :: AudioNormalizationSettings
-> Maybe AudioNormalizationPeakCalculation
$sel:targetLkfs:AudioNormalizationSettings' :: AudioNormalizationSettings -> Maybe Double
$sel:algorithmControl:AudioNormalizationSettings' :: AudioNormalizationSettings
-> Maybe AudioNormalizationAlgorithmControl
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"algorithmControl" Text -> AudioNormalizationAlgorithmControl -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AudioNormalizationAlgorithmControl -> Pair)
-> Maybe AudioNormalizationAlgorithmControl -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AudioNormalizationAlgorithmControl
algorithmControl,
            (Text
"targetLkfs" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
targetLkfs,
            (Text
"peakCalculation" Text -> AudioNormalizationPeakCalculation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AudioNormalizationPeakCalculation -> Pair)
-> Maybe AudioNormalizationPeakCalculation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AudioNormalizationPeakCalculation
peakCalculation,
            (Text
"correctionGateLevel" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
correctionGateLevel,
            (Text
"algorithm" Text -> AudioNormalizationAlgorithm -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AudioNormalizationAlgorithm -> Pair)
-> Maybe AudioNormalizationAlgorithm -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AudioNormalizationAlgorithm
algorithm,
            (Text
"loudnessLogging" Text -> AudioNormalizationLoudnessLogging -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AudioNormalizationLoudnessLogging -> Pair)
-> Maybe AudioNormalizationLoudnessLogging -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AudioNormalizationLoudnessLogging
loudnessLogging
          ]
      )