{-# 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.IVS.Types.AudioConfiguration
-- 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.IVS.Types.AudioConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Object specifying a stream’s audio configuration, as set up by the
-- broadcaster (usually in an encoder). This is part of the
-- IngestConfiguration object and used for monitoring stream health.
--
-- /See:/ 'newAudioConfiguration' smart constructor.
data AudioConfiguration = AudioConfiguration'
  { -- | Number of audio channels.
    AudioConfiguration -> Maybe Integer
channels :: Prelude.Maybe Prelude.Integer,
    -- | Codec used for the audio encoding.
    AudioConfiguration -> Maybe Text
codec :: Prelude.Maybe Prelude.Text,
    -- | Number of audio samples recorded per second.
    AudioConfiguration -> Maybe Integer
sampleRate :: Prelude.Maybe Prelude.Integer,
    -- | The expected ingest bitrate (bits per second). This is configured in the
    -- encoder.
    AudioConfiguration -> Maybe Integer
targetBitrate :: Prelude.Maybe Prelude.Integer
  }
  deriving (AudioConfiguration -> AudioConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioConfiguration -> AudioConfiguration -> Bool
$c/= :: AudioConfiguration -> AudioConfiguration -> Bool
== :: AudioConfiguration -> AudioConfiguration -> Bool
$c== :: AudioConfiguration -> AudioConfiguration -> Bool
Prelude.Eq, ReadPrec [AudioConfiguration]
ReadPrec AudioConfiguration
Int -> ReadS AudioConfiguration
ReadS [AudioConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioConfiguration]
$creadListPrec :: ReadPrec [AudioConfiguration]
readPrec :: ReadPrec AudioConfiguration
$creadPrec :: ReadPrec AudioConfiguration
readList :: ReadS [AudioConfiguration]
$creadList :: ReadS [AudioConfiguration]
readsPrec :: Int -> ReadS AudioConfiguration
$creadsPrec :: Int -> ReadS AudioConfiguration
Prelude.Read, Int -> AudioConfiguration -> ShowS
[AudioConfiguration] -> ShowS
AudioConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioConfiguration] -> ShowS
$cshowList :: [AudioConfiguration] -> ShowS
show :: AudioConfiguration -> String
$cshow :: AudioConfiguration -> String
showsPrec :: Int -> AudioConfiguration -> ShowS
$cshowsPrec :: Int -> AudioConfiguration -> ShowS
Prelude.Show, forall x. Rep AudioConfiguration x -> AudioConfiguration
forall x. AudioConfiguration -> Rep AudioConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioConfiguration x -> AudioConfiguration
$cfrom :: forall x. AudioConfiguration -> Rep AudioConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AudioConfiguration' 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:
--
-- 'channels', 'audioConfiguration_channels' - Number of audio channels.
--
-- 'codec', 'audioConfiguration_codec' - Codec used for the audio encoding.
--
-- 'sampleRate', 'audioConfiguration_sampleRate' - Number of audio samples recorded per second.
--
-- 'targetBitrate', 'audioConfiguration_targetBitrate' - The expected ingest bitrate (bits per second). This is configured in the
-- encoder.
newAudioConfiguration ::
  AudioConfiguration
newAudioConfiguration :: AudioConfiguration
newAudioConfiguration =
  AudioConfiguration'
    { $sel:channels:AudioConfiguration' :: Maybe Integer
channels = forall a. Maybe a
Prelude.Nothing,
      $sel:codec:AudioConfiguration' :: Maybe Text
codec = forall a. Maybe a
Prelude.Nothing,
      $sel:sampleRate:AudioConfiguration' :: Maybe Integer
sampleRate = forall a. Maybe a
Prelude.Nothing,
      $sel:targetBitrate:AudioConfiguration' :: Maybe Integer
targetBitrate = forall a. Maybe a
Prelude.Nothing
    }

-- | Number of audio channels.
audioConfiguration_channels :: Lens.Lens' AudioConfiguration (Prelude.Maybe Prelude.Integer)
audioConfiguration_channels :: Lens' AudioConfiguration (Maybe Integer)
audioConfiguration_channels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioConfiguration' {Maybe Integer
channels :: Maybe Integer
$sel:channels:AudioConfiguration' :: AudioConfiguration -> Maybe Integer
channels} -> Maybe Integer
channels) (\s :: AudioConfiguration
s@AudioConfiguration' {} Maybe Integer
a -> AudioConfiguration
s {$sel:channels:AudioConfiguration' :: Maybe Integer
channels = Maybe Integer
a} :: AudioConfiguration)

-- | Codec used for the audio encoding.
audioConfiguration_codec :: Lens.Lens' AudioConfiguration (Prelude.Maybe Prelude.Text)
audioConfiguration_codec :: Lens' AudioConfiguration (Maybe Text)
audioConfiguration_codec = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioConfiguration' {Maybe Text
codec :: Maybe Text
$sel:codec:AudioConfiguration' :: AudioConfiguration -> Maybe Text
codec} -> Maybe Text
codec) (\s :: AudioConfiguration
s@AudioConfiguration' {} Maybe Text
a -> AudioConfiguration
s {$sel:codec:AudioConfiguration' :: Maybe Text
codec = Maybe Text
a} :: AudioConfiguration)

-- | Number of audio samples recorded per second.
audioConfiguration_sampleRate :: Lens.Lens' AudioConfiguration (Prelude.Maybe Prelude.Integer)
audioConfiguration_sampleRate :: Lens' AudioConfiguration (Maybe Integer)
audioConfiguration_sampleRate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioConfiguration' {Maybe Integer
sampleRate :: Maybe Integer
$sel:sampleRate:AudioConfiguration' :: AudioConfiguration -> Maybe Integer
sampleRate} -> Maybe Integer
sampleRate) (\s :: AudioConfiguration
s@AudioConfiguration' {} Maybe Integer
a -> AudioConfiguration
s {$sel:sampleRate:AudioConfiguration' :: Maybe Integer
sampleRate = Maybe Integer
a} :: AudioConfiguration)

-- | The expected ingest bitrate (bits per second). This is configured in the
-- encoder.
audioConfiguration_targetBitrate :: Lens.Lens' AudioConfiguration (Prelude.Maybe Prelude.Integer)
audioConfiguration_targetBitrate :: Lens' AudioConfiguration (Maybe Integer)
audioConfiguration_targetBitrate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioConfiguration' {Maybe Integer
targetBitrate :: Maybe Integer
$sel:targetBitrate:AudioConfiguration' :: AudioConfiguration -> Maybe Integer
targetBitrate} -> Maybe Integer
targetBitrate) (\s :: AudioConfiguration
s@AudioConfiguration' {} Maybe Integer
a -> AudioConfiguration
s {$sel:targetBitrate:AudioConfiguration' :: Maybe Integer
targetBitrate = Maybe Integer
a} :: AudioConfiguration)

instance Data.FromJSON AudioConfiguration where
  parseJSON :: Value -> Parser AudioConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AudioConfiguration"
      ( \Object
x ->
          Maybe Integer
-> Maybe Text
-> Maybe Integer
-> Maybe Integer
-> AudioConfiguration
AudioConfiguration'
            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
"channels")
            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
"codec")
            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
"sampleRate")
            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
"targetBitrate")
      )

instance Prelude.Hashable AudioConfiguration where
  hashWithSalt :: Int -> AudioConfiguration -> Int
hashWithSalt Int
_salt AudioConfiguration' {Maybe Integer
Maybe Text
targetBitrate :: Maybe Integer
sampleRate :: Maybe Integer
codec :: Maybe Text
channels :: Maybe Integer
$sel:targetBitrate:AudioConfiguration' :: AudioConfiguration -> Maybe Integer
$sel:sampleRate:AudioConfiguration' :: AudioConfiguration -> Maybe Integer
$sel:codec:AudioConfiguration' :: AudioConfiguration -> Maybe Text
$sel:channels:AudioConfiguration' :: AudioConfiguration -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
channels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
codec
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
sampleRate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
targetBitrate

instance Prelude.NFData AudioConfiguration where
  rnf :: AudioConfiguration -> ()
rnf AudioConfiguration' {Maybe Integer
Maybe Text
targetBitrate :: Maybe Integer
sampleRate :: Maybe Integer
codec :: Maybe Text
channels :: Maybe Integer
$sel:targetBitrate:AudioConfiguration' :: AudioConfiguration -> Maybe Integer
$sel:sampleRate:AudioConfiguration' :: AudioConfiguration -> Maybe Integer
$sel:codec:AudioConfiguration' :: AudioConfiguration -> Maybe Text
$sel:channels:AudioConfiguration' :: AudioConfiguration -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
channels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
codec
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
sampleRate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
targetBitrate