{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConvert.Types.RemixSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:channelMapping:RemixSettings' :: Maybe ChannelMapping
channelMapping = forall a. Maybe a
Prelude.Nothing,
      $sel:channelsIn:RemixSettings' :: Maybe Natural
channelsIn = forall a. Maybe a
Prelude.Nothing,
      $sel:channelsOut:RemixSettings' :: Maybe Natural
channelsOut = 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 :: Lens' RemixSettings (Maybe ChannelMapping)
remixSettings_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 :: Lens' RemixSettings (Maybe Natural)
remixSettings_channelsIn = 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 :: Lens' RemixSettings (Maybe Natural)
remixSettings_channelsOut = 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 Data.FromJSON RemixSettings where
  parseJSON :: Value -> Parser RemixSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RemixSettings"
      ( \Object
x ->
          Maybe ChannelMapping
-> Maybe Natural -> Maybe Natural -> RemixSettings
RemixSettings'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"channelMapping")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"channelsIn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"channelsOut")
      )

instance Prelude.Hashable RemixSettings where
  hashWithSalt :: Int -> RemixSettings -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChannelMapping
channelMapping
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
channelsIn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
channelsOut

instance Prelude.NFData RemixSettings where
  rnf :: RemixSettings -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ChannelMapping
channelMapping
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
channelsIn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
channelsOut

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"channelMapping" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ChannelMapping
channelMapping,
            (Key
"channelsIn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
channelsIn,
            (Key
"channelsOut" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
channelsOut
          ]
      )