{-# 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.RemixSettings
-- 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.RemixSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.ChannelMapping
import qualified Amazonka.Prelude as Prelude

-- | Use Manual audio remixing (RemixSettings) to adjust audio levels for
-- each audio channel in each output of your job. With audio remixing, you
-- can output more or fewer audio channels than your input audio source
-- provides.
--
-- /See:/ 'newRemixSettings' smart constructor.
data RemixSettings = RemixSettings'
  { -- | Channel mapping (ChannelMapping) contains the group of fields that hold
    -- the remixing value for each channel, in dB. Specify remix values to
    -- indicate how much of the content from your input audio channel you want
    -- in your output audio channels. Each instance of the InputChannels or
    -- InputChannelsFineTune array specifies these values for one output
    -- channel. Use one instance of this array for each output channel. In the
    -- console, each array corresponds to a column in the graphical depiction
    -- of the mapping matrix. The rows of the graphical matrix correspond to
    -- input channels. Valid values are within the range from -60 (mute)
    -- through 6. A setting of 0 passes the input channel unchanged to the
    -- output channel (no attenuation or amplification). Use InputChannels or
    -- InputChannelsFineTune to specify your remix values. Don\'t use both.
    RemixSettings -> Maybe ChannelMapping
channelMapping :: Prelude.Maybe ChannelMapping,
    -- | Specify the number of audio channels from your input that you want to
    -- use in your output. With remixing, you might combine or split the data
    -- in these channels, so the number of channels in your final output might
    -- be different. If you are doing both input channel mapping and output
    -- channel mapping, the number of output channels in your input mapping
    -- must be the same as the number of input channels in your output mapping.
    RemixSettings -> Maybe Natural
channelsIn :: Prelude.Maybe Prelude.Natural,
    -- | Specify the number of channels in this output after remixing. Valid
    -- values: 1, 2, 4, 6, 8... 64. (1 and even numbers to 64.) If you are
    -- doing both input channel mapping and output channel mapping, the number
    -- of output channels in your input mapping must be the same as the number
    -- of input channels in your output mapping.
    RemixSettings -> Maybe Natural
channelsOut :: Prelude.Maybe Prelude.Natural
  }
  deriving (RemixSettings -> RemixSettings -> Bool
(RemixSettings -> RemixSettings -> Bool)
-> (RemixSettings -> RemixSettings -> Bool) -> Eq RemixSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemixSettings -> RemixSettings -> Bool
$c/= :: RemixSettings -> RemixSettings -> Bool
== :: RemixSettings -> RemixSettings -> Bool
$c== :: RemixSettings -> RemixSettings -> Bool
Prelude.Eq, ReadPrec [RemixSettings]
ReadPrec RemixSettings
Int -> ReadS RemixSettings
ReadS [RemixSettings]
(Int -> ReadS RemixSettings)
-> ReadS [RemixSettings]
-> ReadPrec RemixSettings
-> ReadPrec [RemixSettings]
-> Read RemixSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemixSettings]
$creadListPrec :: ReadPrec [RemixSettings]
readPrec :: ReadPrec RemixSettings
$creadPrec :: ReadPrec RemixSettings
readList :: ReadS [RemixSettings]
$creadList :: ReadS [RemixSettings]
readsPrec :: Int -> ReadS RemixSettings
$creadsPrec :: Int -> ReadS RemixSettings
Prelude.Read, Int -> RemixSettings -> ShowS
[RemixSettings] -> ShowS
RemixSettings -> String
(Int -> RemixSettings -> ShowS)
-> (RemixSettings -> String)
-> ([RemixSettings] -> ShowS)
-> Show RemixSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemixSettings] -> ShowS
$cshowList :: [RemixSettings] -> ShowS
show :: RemixSettings -> String
$cshow :: RemixSettings -> String
showsPrec :: Int -> RemixSettings -> ShowS
$cshowsPrec :: Int -> RemixSettings -> ShowS
Prelude.Show, (forall x. RemixSettings -> Rep RemixSettings x)
-> (forall x. Rep RemixSettings x -> RemixSettings)
-> Generic RemixSettings
forall x. Rep RemixSettings x -> RemixSettings
forall x. RemixSettings -> Rep RemixSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemixSettings x -> RemixSettings
$cfrom :: forall x. RemixSettings -> Rep RemixSettings x
Prelude.Generic)

-- |
-- Create a value of 'RemixSettings' 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:
--
-- 'channelMapping', 'remixSettings_channelMapping' - Channel mapping (ChannelMapping) contains the group of fields that hold
-- the remixing value for each channel, in dB. Specify remix values to
-- indicate how much of the content from your input audio channel you want
-- in your output audio channels. Each instance of the InputChannels or
-- InputChannelsFineTune array specifies these values for one output
-- channel. Use one instance of this array for each output channel. In the
-- console, each array corresponds to a column in the graphical depiction
-- of the mapping matrix. The rows of the graphical matrix correspond to
-- input channels. Valid values are within the range from -60 (mute)
-- through 6. A setting of 0 passes the input channel unchanged to the
-- output channel (no attenuation or amplification). Use InputChannels or
-- InputChannelsFineTune to specify your remix values. Don\'t use both.
--
-- 'channelsIn', 'remixSettings_channelsIn' - Specify the number of audio channels from your input that you want to
-- use in your output. With remixing, you might combine or split the data
-- in these channels, so the number of channels in your final output might
-- be different. If you are doing both input channel mapping and output
-- channel mapping, the number of output channels in your input mapping
-- must be the same as the number of input channels in your output mapping.
--
-- 'channelsOut', 'remixSettings_channelsOut' - Specify the number of channels in this output after remixing. Valid
-- values: 1, 2, 4, 6, 8... 64. (1 and even numbers to 64.) If you are
-- doing both input channel mapping and output channel mapping, the number
-- of output channels in your input mapping must be the same as the number
-- of input channels in your output mapping.
newRemixSettings ::
  RemixSettings
newRemixSettings :: RemixSettings
newRemixSettings =
  RemixSettings' :: Maybe ChannelMapping
-> Maybe Natural -> Maybe Natural -> RemixSettings
RemixSettings'
    { $sel:channelMapping:RemixSettings' :: Maybe ChannelMapping
channelMapping = Maybe ChannelMapping
forall a. Maybe a
Prelude.Nothing,
      $sel:channelsIn:RemixSettings' :: Maybe Natural
channelsIn = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:channelsOut:RemixSettings' :: Maybe Natural
channelsOut = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Channel mapping (ChannelMapping) contains the group of fields that hold
-- the remixing value for each channel, in dB. Specify remix values to
-- indicate how much of the content from your input audio channel you want
-- in your output audio channels. Each instance of the InputChannels or
-- InputChannelsFineTune array specifies these values for one output
-- channel. Use one instance of this array for each output channel. In the
-- console, each array corresponds to a column in the graphical depiction
-- of the mapping matrix. The rows of the graphical matrix correspond to
-- input channels. Valid values are within the range from -60 (mute)
-- through 6. A setting of 0 passes the input channel unchanged to the
-- output channel (no attenuation or amplification). Use InputChannels or
-- InputChannelsFineTune to specify your remix values. Don\'t use both.
remixSettings_channelMapping :: Lens.Lens' RemixSettings (Prelude.Maybe ChannelMapping)
remixSettings_channelMapping :: (Maybe ChannelMapping -> f (Maybe ChannelMapping))
-> RemixSettings -> f RemixSettings
remixSettings_channelMapping = (RemixSettings -> Maybe ChannelMapping)
-> (RemixSettings -> Maybe ChannelMapping -> RemixSettings)
-> Lens
     RemixSettings
     RemixSettings
     (Maybe ChannelMapping)
     (Maybe ChannelMapping)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemixSettings' {Maybe ChannelMapping
channelMapping :: Maybe ChannelMapping
$sel:channelMapping:RemixSettings' :: RemixSettings -> Maybe ChannelMapping
channelMapping} -> Maybe ChannelMapping
channelMapping) (\s :: RemixSettings
s@RemixSettings' {} Maybe ChannelMapping
a -> RemixSettings
s {$sel:channelMapping:RemixSettings' :: Maybe ChannelMapping
channelMapping = Maybe ChannelMapping
a} :: RemixSettings)

-- | Specify the number of audio channels from your input that you want to
-- use in your output. With remixing, you might combine or split the data
-- in these channels, so the number of channels in your final output might
-- be different. If you are doing both input channel mapping and output
-- channel mapping, the number of output channels in your input mapping
-- must be the same as the number of input channels in your output mapping.
remixSettings_channelsIn :: Lens.Lens' RemixSettings (Prelude.Maybe Prelude.Natural)
remixSettings_channelsIn :: (Maybe Natural -> f (Maybe Natural))
-> RemixSettings -> f RemixSettings
remixSettings_channelsIn = (RemixSettings -> Maybe Natural)
-> (RemixSettings -> Maybe Natural -> RemixSettings)
-> Lens RemixSettings RemixSettings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemixSettings' {Maybe Natural
channelsIn :: Maybe Natural
$sel:channelsIn:RemixSettings' :: RemixSettings -> Maybe Natural
channelsIn} -> Maybe Natural
channelsIn) (\s :: RemixSettings
s@RemixSettings' {} Maybe Natural
a -> RemixSettings
s {$sel:channelsIn:RemixSettings' :: Maybe Natural
channelsIn = Maybe Natural
a} :: RemixSettings)

-- | Specify the number of channels in this output after remixing. Valid
-- values: 1, 2, 4, 6, 8... 64. (1 and even numbers to 64.) If you are
-- doing both input channel mapping and output channel mapping, the number
-- of output channels in your input mapping must be the same as the number
-- of input channels in your output mapping.
remixSettings_channelsOut :: Lens.Lens' RemixSettings (Prelude.Maybe Prelude.Natural)
remixSettings_channelsOut :: (Maybe Natural -> f (Maybe Natural))
-> RemixSettings -> f RemixSettings
remixSettings_channelsOut = (RemixSettings -> Maybe Natural)
-> (RemixSettings -> Maybe Natural -> RemixSettings)
-> Lens RemixSettings RemixSettings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemixSettings' {Maybe Natural
channelsOut :: Maybe Natural
$sel:channelsOut:RemixSettings' :: RemixSettings -> Maybe Natural
channelsOut} -> Maybe Natural
channelsOut) (\s :: RemixSettings
s@RemixSettings' {} Maybe Natural
a -> RemixSettings
s {$sel:channelsOut:RemixSettings' :: Maybe Natural
channelsOut = Maybe Natural
a} :: RemixSettings)

instance Core.FromJSON RemixSettings where
  parseJSON :: Value -> Parser RemixSettings
parseJSON =
    String
-> (Object -> Parser RemixSettings)
-> Value
-> Parser RemixSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RemixSettings"
      ( \Object
x ->
          Maybe ChannelMapping
-> Maybe Natural -> Maybe Natural -> RemixSettings
RemixSettings'
            (Maybe ChannelMapping
 -> Maybe Natural -> Maybe Natural -> RemixSettings)
-> Parser (Maybe ChannelMapping)
-> Parser (Maybe Natural -> Maybe Natural -> RemixSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ChannelMapping)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"channelMapping")
            Parser (Maybe Natural -> Maybe Natural -> RemixSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> RemixSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"channelsIn")
            Parser (Maybe Natural -> RemixSettings)
-> Parser (Maybe Natural) -> Parser RemixSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"channelsOut")
      )

instance Prelude.Hashable RemixSettings

instance Prelude.NFData RemixSettings

instance Core.ToJSON RemixSettings where
  toJSON :: RemixSettings -> Value
toJSON RemixSettings' {Maybe Natural
Maybe ChannelMapping
channelsOut :: Maybe Natural
channelsIn :: Maybe Natural
channelMapping :: Maybe ChannelMapping
$sel:channelsOut:RemixSettings' :: RemixSettings -> Maybe Natural
$sel:channelsIn:RemixSettings' :: RemixSettings -> Maybe Natural
$sel:channelMapping:RemixSettings' :: RemixSettings -> Maybe ChannelMapping
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"channelMapping" Text -> ChannelMapping -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ChannelMapping -> Pair) -> Maybe ChannelMapping -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ChannelMapping
channelMapping,
            (Text
"channelsIn" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
channelsIn,
            (Text
"channelsOut" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
channelsOut
          ]
      )