    {-# LANGUAGE CPP #-}
    {-# LANGUAGE ConstraintKinds #-}
    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveFoldable #-}
    {-# LANGUAGE DeriveFunctor #-}
    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE DeriveTraversable #-}
    {-# LANGUAGE ForeignFunctionInterface #-}
    {-# LANGUAGE GADTs #-}
    {-# LANGUAGE KindSignatures #-}
    {-# LANGUAGE OverloadedStrings #-}
    {-# LANGUAGE PatternSynonyms #-}
    {-# LANGUAGE RankNTypes #-}
    {-# LANGUAGE RecordWildCards #-}
    {-# LANGUAGE StandaloneDeriving #-}
    {-# LANGUAGE ScopedTypeVariables #-}

    {-|

    "SDL.Audio" provides a high-level API to SDL's audio device capabilities.

    -}

    module SDL.Audio
      ( -- * Managing 'AudioDevice's
        -- $audioDevice
        AudioDevice

        -- ** Opening and Closing 'AudioDevice's
      , openAudioDevice
      , closeAudioDevice
      , OpenDeviceSpec(..)
      , AudioDeviceUsage(..)
      , Channels(..)
      , Changeable(..)

        -- ** Working with Opened Devices
        -- *** Locking 'AudioDevice's
      , setAudioDeviceLocked
      , LockState(..)

        -- *** Switching Playback States
      , PlaybackState(..)
      , setAudioDevicePlaybackState

        -- *** Querying an 'AudioDevice's Status.
      , AudioDeviceStatus(..)
      , audioDeviceStatus

        -- ** 'AudioFormat'
      , AudioFormat(..)

        -- ** Enumerating 'AudioDevice's
      , getAudioDeviceNames

        -- * 'AudioSpec'
      , AudioSpec
      , audioSpecFreq
      , audioSpecFormat
      , audioSpecChannels
      , audioSpecSilence
      , audioSpecSize
      , audioSpecCallback

        -- * Audio Drivers
      , getAudioDrivers
      , currentAudioDriver
      , AudioDriver
      , audioDriverName

        -- * Explicit Initialization
      , audioInit
      ) where

    import Control.Monad.IO.Class (MonadIO, liftIO)
    import Data.Bits
    import Data.Data (Data)
    import Data.IORef (newIORef, writeIORef, readIORef)
    import Data.Int (Int8, Int16, Int32)
    import Data.Text (Text)
    import Data.Traversable (for)
    import Data.Typeable
    import Data.Word
    import Foreign.C.Types
    import Foreign.ForeignPtr
    import Foreign.Marshal.Alloc
    import Foreign.Marshal.Utils
    import Foreign.Ptr
    import Foreign.Storable
    import GHC.Exts (Constraint)
    import GHC.Generics (Generic)
    import SDL.Internal.Exception
    import qualified Data.ByteString as BS
    import qualified Data.Text.Encoding as Text
    import qualified Data.Vector as V
    import qualified Data.Vector.Storable.Mutable as MV
    import qualified SDL.Raw.Audio as Raw
    import qualified SDL.Raw.Enum as Raw
    import qualified SDL.Raw.Types as Raw

    #if !MIN_VERSION_base(4,8,0)
    import Control.Applicative
    import Data.Foldable (Foldable)
    import Data.Traversable (Traversable)
    #endif

    {-

    $audioDevice

    In order to produce sound, you must first open an 'AudioDevice'. To do so,
    pass an 'OpenDeviceSpec' to 'openAudioDevice'.

    -}

    -- | A specification to 'openAudioDevice', indicating the desired output format.
    -- Note that many of these properties are 'Changeable', meaning that you can
    -- choose whether or not SDL should interpret your specification as an
    -- unbreakable request ('Mandate'), or as an approximation 'Desire'.
    data OpenDeviceSpec = forall sampleType. OpenDeviceSpec
      { OpenDeviceSpec -> Changeable CInt
    openDeviceFreq :: !(Changeable CInt)
        -- ^ The output audio frequency in herts.
      , ()
    openDeviceFormat :: !(Changeable (AudioFormat sampleType))
        -- ^ The format of audio that will be sampled from the output buffer.
      , OpenDeviceSpec -> Changeable Channels
    openDeviceChannels :: !(Changeable Channels)
        -- ^ The amount of audio channels.
      , OpenDeviceSpec -> Word16
    openDeviceSamples :: !Word16
        -- ^ Output audio buffer size in samples. This should be a power of 2.
      , OpenDeviceSpec
    -> forall actualSampleType.
       AudioFormat actualSampleType -> IOVector actualSampleType -> IO ()
    openDeviceCallback :: forall actualSampleType. AudioFormat actualSampleType -> MV.IOVector actualSampleType -> IO ()
        -- ^ A callback to invoke whenever new sample data is required. The callback
        -- will be passed a single 'MV.MVector' that must be filled with audio data.
      , OpenDeviceSpec -> AudioDeviceUsage
    openDeviceUsage :: !AudioDeviceUsage
        -- ^ How you intend to use the opened 'AudioDevice' - either for outputting
        -- or capturing audio.
      , OpenDeviceSpec -> Maybe Text
    openDeviceName :: !(Maybe Text)
        -- ^ The name of the 'AudioDevice' that should be opened. If 'Nothing',
        -- any suitable 'AudioDevice' will be used.
      } deriving (Typeable)

    -- | Attempt to open the closest matching 'AudioDevice', as specified by the
    -- given 'OpenDeviceSpec'.
    --
    -- See @<https://wiki.libsdl.org/SDL_OpenAudioDevice SDL_OpenAudioDevice>@ for C documentation.
    openAudioDevice :: MonadIO m => OpenDeviceSpec -> m (AudioDevice, AudioSpec)
    openAudioDevice :: OpenDeviceSpec -> m (AudioDevice, AudioSpec)
    openAudioDevice OpenDeviceSpec{..} = IO (AudioDevice, AudioSpec) -> m (AudioDevice, AudioSpec)
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (AudioDevice, AudioSpec) -> m (AudioDevice, AudioSpec))
    -> IO (AudioDevice, AudioSpec) -> m (AudioDevice, AudioSpec)
    forall a b. (a -> b) -> a -> b
    $
      (Text
     -> (Ptr CChar -> IO (AudioDevice, AudioSpec))
     -> IO (AudioDevice, AudioSpec))
    -> Maybe Text
    -> (Ptr CChar -> IO (AudioDevice, AudioSpec))
    -> IO (AudioDevice, AudioSpec)
    forall a b c.
    (a -> (Ptr b -> IO c) -> IO c)
    -> Maybe a -> (Ptr b -> IO c) -> IO c
    maybeWith (ByteString
    -> (Ptr CChar -> IO (AudioDevice, AudioSpec))
    -> IO (AudioDevice, AudioSpec)
    forall a. ByteString -> (Ptr CChar -> IO a) -> IO a
    BS.useAsCString (ByteString
     -> (Ptr CChar -> IO (AudioDevice, AudioSpec))
     -> IO (AudioDevice, AudioSpec))
    -> (Text -> ByteString)
    -> Text
    -> (Ptr CChar -> IO (AudioDevice, AudioSpec))
    -> IO (AudioDevice, AudioSpec)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> ByteString
    Text.encodeUtf8) Maybe Text
    openDeviceName ((Ptr CChar -> IO (AudioDevice, AudioSpec))
     -> IO (AudioDevice, AudioSpec))
    -> (Ptr CChar -> IO (AudioDevice, AudioSpec))
    -> IO (AudioDevice, AudioSpec)
    forall a b. (a -> b) -> a -> b
    $ \cDevName :: Ptr CChar
    cDevName -> do
        IORef AnAudioFormat
    anAudioFormatRef <- AnAudioFormat -> IO (IORef AnAudioFormat)
    forall a. a -> IO (IORef a)
    newIORef AnAudioFormat
    forall a. HasCallStack => a
    undefined
        AudioCallback
    cb <- (Ptr () -> Ptr Word8 -> CInt -> IO ()) -> IO AudioCallback
    Raw.mkAudioCallback ((Ptr () -> Ptr Word8 -> CInt -> IO ()) -> IO AudioCallback)
    -> (Ptr () -> Ptr Word8 -> CInt -> IO ()) -> IO AudioCallback
    forall a b. (a -> b) -> a -> b
    $ \_ buffer :: Ptr Word8
    buffer len :: CInt
    len -> do
          ForeignPtr Word8
    fp <- Ptr Word8 -> IO (ForeignPtr Word8)
    forall a. Ptr a -> IO (ForeignPtr a)
    newForeignPtr_ Ptr Word8
    buffer
          AnAudioFormat
    anAudioFormat <- IORef AnAudioFormat -> IO AnAudioFormat
    forall a. IORef a -> IO a
    readIORef IORef AnAudioFormat
    anAudioFormatRef
          case AnAudioFormat
    anAudioFormat of
            AnAudioFormat audioFormat :: AudioFormat sampleType
    audioFormat ->
              case AudioFormat sampleType -> Dict (Storable sampleType)
    forall sampleType.
    AudioFormat sampleType -> Dict (Storable sampleType)
    audioFormatStorable AudioFormat sampleType
    audioFormat of
                Dict -> AudioFormat sampleType -> IOVector sampleType -> IO ()
    forall actualSampleType.
    AudioFormat actualSampleType -> IOVector actualSampleType -> IO ()
    openDeviceCallback AudioFormat sampleType
    audioFormat
                                           (MVector RealWorld Word8 -> IOVector sampleType
    forall a b s.
    (Storable a, Storable b) =>
    MVector s a -> MVector s b
    MV.unsafeCast (ForeignPtr Word8 -> Int -> MVector RealWorld Word8
    forall a s. Storable a => ForeignPtr a -> Int -> MVector s a
    MV.unsafeFromForeignPtr0 ForeignPtr Word8
    fp (CInt -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral CInt
    len)))
        AudioSpec
    -> (Ptr AudioSpec -> IO (AudioDevice, AudioSpec))
    -> IO (AudioDevice, AudioSpec)
    forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
    with (AudioCallback -> AudioSpec
    desiredSpec AudioCallback
    cb) ((Ptr AudioSpec -> IO (AudioDevice, AudioSpec))
     -> IO (AudioDevice, AudioSpec))
    -> (Ptr AudioSpec -> IO (AudioDevice, AudioSpec))
    -> IO (AudioDevice, AudioSpec)
    forall a b. (a -> b) -> a -> b
    $ \desiredSpecPtr :: Ptr AudioSpec
    desiredSpecPtr ->
          (Ptr AudioSpec -> IO (AudioDevice, AudioSpec))
    -> IO (AudioDevice, AudioSpec)
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr AudioSpec -> IO (AudioDevice, AudioSpec))
     -> IO (AudioDevice, AudioSpec))
    -> (Ptr AudioSpec -> IO (AudioDevice, AudioSpec))
    -> IO (AudioDevice, AudioSpec)
    forall a b. (a -> b) -> a -> b
    $ \actualSpecPtr :: Ptr AudioSpec
    actualSpecPtr -> do
            AudioDeviceID
    devId <- Text -> Text -> IO AudioDeviceID -> IO AudioDeviceID
    forall a (m :: * -> *).
    (Eq a, MonadIO m, Num a) =>
    Text -> Text -> m a -> m a
    throwIf0 "SDL.Audio.openAudioDevice" "SDL_OpenAudioDevice" (IO AudioDeviceID -> IO AudioDeviceID)
    -> IO AudioDeviceID -> IO AudioDeviceID
    forall a b. (a -> b) -> a -> b
    $
              Ptr CChar
    -> CInt
    -> Ptr AudioSpec
    -> Ptr AudioSpec
    -> CInt
    -> IO AudioDeviceID
    forall (m :: * -> *).
    MonadIO m =>
    Ptr CChar
    -> CInt
    -> Ptr AudioSpec
    -> Ptr AudioSpec
    -> CInt
    -> m AudioDeviceID
    Raw.openAudioDevice Ptr CChar
    cDevName (AudioDeviceUsage -> CInt
    forall a. Num a => AudioDeviceUsage -> a
    encodeUsage AudioDeviceUsage
    openDeviceUsage) Ptr AudioSpec
    desiredSpecPtr Ptr AudioSpec
    actualSpecPtr CInt
    changes
            AudioSpec
    actual <- Ptr AudioSpec -> IO AudioSpec
    forall a. Storable a => Ptr a -> IO a
    peek Ptr AudioSpec
    actualSpecPtr
            let audioDevice :: AudioDevice
    audioDevice = AudioDeviceID -> AudioDevice
    AudioDevice AudioDeviceID
    devId
                anAudioFormat :: AnAudioFormat
    anAudioFormat = Word16 -> AnAudioFormat
    decodeAudioFormat (AudioSpec -> Word16
    Raw.audioSpecFormat AudioSpec
    actual)
                spec :: AudioSpec
    spec =
                  case AnAudioFormat
    anAudioFormat of
                    AnAudioFormat audioFormat :: AudioFormat sampleType
    audioFormat ->
                      $WAudioSpec :: forall sampleType.
    CInt
    -> AudioFormat sampleType
    -> Channels
    -> Word8
    -> Word16
    -> AudioDeviceID
    -> (AudioFormat sampleType -> IOVector sampleType -> IO ())
    -> AudioSpec
    AudioSpec { audioSpecFreq :: CInt
    audioSpecFreq = AudioSpec -> CInt
    Raw.audioSpecFreq AudioSpec
    actual
                                , audioSpecFormat :: AudioFormat sampleType
    audioSpecFormat = AudioFormat sampleType
    audioFormat
                                , audioSpecChannels :: Channels
    audioSpecChannels = Text -> Text -> (Word8 -> Maybe Channels) -> Word8 -> Channels
    forall a b. Show a => Text -> Text -> (a -> Maybe b) -> a -> b
    fromC "SDL.Audio.openAudioDevice" "audioSpecChannels" Word8 -> Maybe Channels
    forall a. (Eq a, Num a) => a -> Maybe Channels
    readChannels (AudioSpec -> Word8
    Raw.audioSpecChannels AudioSpec
    actual)
                                , audioSpecSilence :: Word8
    audioSpecSilence = AudioSpec -> Word8
    Raw.audioSpecSilence AudioSpec
    actual
                                , audioSpecSize :: AudioDeviceID
    audioSpecSize = AudioSpec -> AudioDeviceID
    Raw.audioSpecSize AudioSpec
    actual
                                , audioSpecSamples :: Word16
    audioSpecSamples = AudioSpec -> Word16
    Raw.audioSpecSamples AudioSpec
    actual
                                , audioSpecCallback :: AudioFormat sampleType -> IOVector sampleType -> IO ()
    audioSpecCallback = AudioFormat sampleType -> IOVector sampleType -> IO ()
    forall actualSampleType.
    AudioFormat actualSampleType -> IOVector actualSampleType -> IO ()
    openDeviceCallback
                                }
            IORef AnAudioFormat -> AnAudioFormat -> IO ()
    forall a. IORef a -> a -> IO ()
    writeIORef IORef AnAudioFormat
    anAudioFormatRef AnAudioFormat
    anAudioFormat
            (AudioDevice, AudioSpec) -> IO (AudioDevice, AudioSpec)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (AudioDevice
    audioDevice, AudioSpec
    spec)

      where
      changes :: CInt
    changes = (CInt -> CInt -> CInt) -> CInt -> [CInt] -> CInt
    forall (t :: * -> *) b a.
    Foldable t =>
    (b -> a -> b) -> b -> t a -> b
    foldl CInt -> CInt -> CInt
    forall a. Bits a => a -> a -> a
    (.|.) 0 [ (CInt -> CInt) -> (CInt -> CInt) -> Changeable CInt -> CInt
    forall a b. (a -> b) -> (a -> b) -> Changeable a -> b
    foldChangeable (CInt -> CInt -> CInt
    forall a b. a -> b -> a
    const CInt
    forall a. (Eq a, Num a) => a
    Raw.SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) (CInt -> CInt -> CInt
    forall a b. a -> b -> a
    const 0) Changeable CInt
    openDeviceFreq
                              , (AudioFormat sampleType -> CInt)
    -> (AudioFormat sampleType -> CInt)
    -> Changeable (AudioFormat sampleType)
    -> CInt
    forall a b. (a -> b) -> (a -> b) -> Changeable a -> b
    foldChangeable (CInt -> AudioFormat sampleType -> CInt
    forall a b. a -> b -> a
    const CInt
    forall a. (Eq a, Num a) => a
    Raw.SDL_AUDIO_ALLOW_FORMAT_CHANGE) (CInt -> AudioFormat sampleType -> CInt
    forall a b. a -> b -> a
    const 0) Changeable (AudioFormat sampleType)
    openDeviceFormat
                              , (Channels -> CInt)
    -> (Channels -> CInt) -> Changeable Channels -> CInt
    forall a b. (a -> b) -> (a -> b) -> Changeable a -> b
    foldChangeable (CInt -> Channels -> CInt
    forall a b. a -> b -> a
    const CInt
    forall a. (Eq a, Num a) => a
    Raw.SDL_AUDIO_ALLOW_CHANNELS_CHANGE) (CInt -> Channels -> CInt
    forall a b. a -> b -> a
    const 0) Changeable Channels
    openDeviceChannels
                              ]

      channelsToWord8 :: Channels -> p
    channelsToWord8 Mono = 1
      channelsToWord8 Stereo = 2
      channelsToWord8 Quad = 4
      channelsToWord8 FivePointOne = 6

      readChannels :: a -> Maybe Channels
    readChannels 1 = Channels -> Maybe Channels
    forall a. a -> Maybe a
    Just Channels
    Mono
      readChannels 2 = Channels -> Maybe Channels
    forall a. a -> Maybe a
    Just Channels
    Stereo
      readChannels 4 = Channels -> Maybe Channels
    forall a. a -> Maybe a
    Just Channels
    Quad
      readChannels 6 = Channels -> Maybe Channels
    forall a. a -> Maybe a
    Just Channels
    FivePointOne
      readChannels _ = Maybe Channels
    forall a. Maybe a
    Nothing

      desiredSpec :: AudioCallback -> AudioSpec
    desiredSpec cb :: AudioCallback
    cb = $WAudioSpec :: CInt
    -> Word16
    -> Word8
    -> Word8
    -> Word16
    -> AudioDeviceID
    -> AudioCallback
    -> Ptr ()
    -> AudioSpec
    Raw.AudioSpec
        { audioSpecFreq :: CInt
    Raw.audioSpecFreq = Changeable CInt -> CInt
    forall a. Changeable a -> a
    unpackChangeable Changeable CInt
    openDeviceFreq
        , audioSpecFormat :: Word16
    Raw.audioSpecFormat = AudioFormat sampleType -> Word16
    forall sampleType. AudioFormat sampleType -> Word16
    encodeAudioFormat (Changeable (AudioFormat sampleType) -> AudioFormat sampleType
    forall a. Changeable a -> a
    unpackChangeable Changeable (AudioFormat sampleType)
    openDeviceFormat)
        , audioSpecChannels :: Word8
    Raw.audioSpecChannels = Channels -> Word8
    forall p. Num p => Channels -> p
    channelsToWord8 (Changeable Channels -> Channels
    forall a. Changeable a -> a
    unpackChangeable Changeable Channels
    openDeviceChannels)
        , audioSpecSilence :: Word8
    Raw.audioSpecSilence = 0
        , audioSpecSize :: AudioDeviceID
    Raw.audioSpecSize = 0
        , audioSpecSamples :: Word16
    Raw.audioSpecSamples = Word16
    openDeviceSamples
        , audioSpecCallback :: AudioCallback
    Raw.audioSpecCallback = AudioCallback
    cb
        , audioSpecUserdata :: Ptr ()
    Raw.audioSpecUserdata = Ptr ()
    forall a. Ptr a
    nullPtr
        }

      -- Witness the 'Storable' instance for the sample type of any audio format. Needed in order to use 'MV.unsafeCast'
      audioFormatStorable :: AudioFormat sampleType -> Dict (Storable sampleType)
      audioFormatStorable :: AudioFormat sampleType -> Dict (Storable sampleType)
    audioFormatStorable Signed8BitAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Unsigned8BitAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Signed16BitLEAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Signed16BitBEAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Signed16BitNativeAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Unsigned16BitLEAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Unsigned16BitBEAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Unsigned16BitNativeAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Signed32BitLEAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Signed32BitBEAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable Signed32BitNativeAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable FloatingLEAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable FloatingBEAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict
      audioFormatStorable FloatingNativeAudio = Dict (Storable sampleType)
    forall (c :: Constraint). c => Dict c
    Dict

    data Dict :: Constraint -> * where
      Dict :: c => Dict c

    -- |
    --
    -- See @<https://wiki.libsdl.org/SDL_CloseAudioDevice SDL_CloseAudioDevice>@ for C documentation.
    closeAudioDevice :: MonadIO m => AudioDevice -> m ()
    closeAudioDevice :: AudioDevice -> m ()
    closeAudioDevice (AudioDevice d :: AudioDeviceID
    d) = AudioDeviceID -> m ()
    forall (m :: * -> *). MonadIO m => AudioDeviceID -> m ()
    Raw.closeAudioDevice AudioDeviceID
    d

    -- | An open audio device. These can be created via 'openAudioDevice' and should be closed with 'closeAudioDevice'
    newtype AudioDevice = AudioDevice (Raw.AudioDeviceID)
      deriving (AudioDevice -> AudioDevice -> Bool
    (AudioDevice -> AudioDevice -> Bool)
    -> (AudioDevice -> AudioDevice -> Bool) -> Eq AudioDevice
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: AudioDevice -> AudioDevice -> Bool
    $c/= :: AudioDevice -> AudioDevice -> Bool
    == :: AudioDevice -> AudioDevice -> Bool
    $c== :: AudioDevice -> AudioDevice -> Bool
    Eq, Typeable)

    -- | Enumerate all 'AudioDevice's attached to this system, that can be used as
    -- specified by the given 'AudioDeviceUsage'. SDL cannot always guarantee
    -- that this list can be produced, in which case 'Nothing' will be returned.
    getAudioDeviceNames :: MonadIO m => AudioDeviceUsage -> m (Maybe (V.Vector Text))
    getAudioDeviceNames :: AudioDeviceUsage -> m (Maybe (Vector Text))
    getAudioDeviceNames usage :: AudioDeviceUsage
    usage = IO (Maybe (Vector Text)) -> m (Maybe (Vector Text))
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Maybe (Vector Text)) -> m (Maybe (Vector Text)))
    -> IO (Maybe (Vector Text)) -> m (Maybe (Vector Text))
    forall a b. (a -> b) -> a -> b
    $ do
      CInt
    n <- CInt -> IO CInt
    forall (m :: * -> *). MonadIO m => CInt -> m CInt
    Raw.getNumAudioDevices CInt
    usage'
      if CInt
    n CInt -> CInt -> Bool
    forall a. Eq a => a -> a -> Bool
    == -1
        then Maybe (Vector Text) -> IO (Maybe (Vector Text))
    forall (m :: * -> *) a. Monad m => a -> m a
    return Maybe (Vector Text)
    forall a. Maybe a
    Nothing
        else ([Text] -> Maybe (Vector Text))
    -> IO [Text] -> IO (Maybe (Vector Text))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Vector Text -> Maybe (Vector Text)
    forall a. a -> Maybe a
    Just (Vector Text -> Maybe (Vector Text))
    -> ([Text] -> Vector Text) -> [Text] -> Maybe (Vector Text)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Text] -> Vector Text
    forall a. [a] -> Vector a
    V.fromList) (IO [Text] -> IO (Maybe (Vector Text)))
    -> IO [Text] -> IO (Maybe (Vector Text))
    forall a b. (a -> b) -> a -> b
    $
             [CInt] -> (CInt -> IO Text) -> IO [Text]
    forall (t :: * -> *) (f :: * -> *) a b.
    (Traversable t, Applicative f) =>
    t a -> (a -> f b) -> f (t b)
    for [0 .. (CInt
    n CInt -> CInt -> CInt
    forall a. Num a => a -> a -> a
    - 1)] ((CInt -> IO Text) -> IO [Text]) -> (CInt -> IO Text) -> IO [Text]
    forall a b. (a -> b) -> a -> b
    $ \i :: CInt
    i -> do
               Ptr CChar
    cstr <- Text -> Text -> IO (Ptr CChar) -> IO (Ptr CChar)
    forall (m :: * -> *) a.
    MonadIO m =>
    Text -> Text -> m (Ptr a) -> m (Ptr a)
    throwIfNull "SDL.Audio.getAudioDeviceNames" "SDL_GetAudioDeviceName" (IO (Ptr CChar) -> IO (Ptr CChar))
    -> IO (Ptr CChar) -> IO (Ptr CChar)
    forall a b. (a -> b) -> a -> b
    $
                 CInt -> CInt -> IO (Ptr CChar)
    forall (m :: * -> *). MonadIO m => CInt -> CInt -> m (Ptr CChar)
    Raw.getAudioDeviceName CInt
    i CInt
    usage'
               ByteString -> Text
    Text.decodeUtf8 (ByteString -> Text) -> IO ByteString -> IO Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Ptr CChar -> IO ByteString
    BS.packCString Ptr CChar
    cstr

      where usage' :: CInt
    usage' = AudioDeviceUsage -> CInt
    forall a. Num a => AudioDeviceUsage -> a
    encodeUsage AudioDeviceUsage
    usage

    -- | Information about what format an audio bytestream is. The type variable
    -- @t@ indicates the type used for audio buffer samples. It is determined
    -- by the choice of the provided 'SampleBitSize'. For example:
    --
    -- @AudioFormat UnsignedInteger Sample8Bit Native :: AudioFormat Word8@
    --
    -- Indicating that an 8-bit audio format in the platforms native endianness
    -- uses a buffer of 'Word8' values.
    data AudioFormat sampleType where
      Signed8BitAudio :: AudioFormat Int8
      Unsigned8BitAudio :: AudioFormat Word8
      Signed16BitLEAudio :: AudioFormat Int16
      Signed16BitBEAudio :: AudioFormat Int16
      Signed16BitNativeAudio :: AudioFormat Int16
      Unsigned16BitLEAudio :: AudioFormat Word16
      Unsigned16BitBEAudio :: AudioFormat Word16
      Unsigned16BitNativeAudio :: AudioFormat Word16
      Signed32BitLEAudio :: AudioFormat Int32
      Signed32BitBEAudio :: AudioFormat Int32
      Signed32BitNativeAudio :: AudioFormat Int32
      FloatingLEAudio :: AudioFormat Float
      FloatingBEAudio :: AudioFormat Float
      FloatingNativeAudio :: AudioFormat Float

    deriving instance Eq (AudioFormat sampleType)
    deriving instance Ord (AudioFormat sampleType)
    deriving instance Show (AudioFormat sampleType)

    data AnAudioFormat where
      AnAudioFormat :: AudioFormat sampleType -> AnAudioFormat

    encodeAudioFormat :: AudioFormat sampleType -> Word16
    encodeAudioFormat :: AudioFormat sampleType -> Word16
    encodeAudioFormat Signed8BitAudio = Word16
    Raw.SDL_AUDIO_S8
    encodeAudioFormat Unsigned8BitAudio = Word16
    Raw.SDL_AUDIO_U8
    encodeAudioFormat Signed16BitLEAudio = Word16
    Raw.SDL_AUDIO_S16LSB
    encodeAudioFormat Signed16BitBEAudio = Word16
    Raw.SDL_AUDIO_S16MSB
    encodeAudioFormat Signed16BitNativeAudio = Word16
    Raw.SDL_AUDIO_S16SYS
    encodeAudioFormat Unsigned16BitLEAudio = Word16
    Raw.SDL_AUDIO_U16LSB
    encodeAudioFormat Unsigned16BitBEAudio = Word16
    Raw.SDL_AUDIO_U16MSB
    encodeAudioFormat Unsigned16BitNativeAudio = Word16
    Raw.SDL_AUDIO_U16SYS
    encodeAudioFormat Signed32BitLEAudio = Word16
    Raw.SDL_AUDIO_S32LSB
    encodeAudioFormat Signed32BitBEAudio = Word16
    Raw.SDL_AUDIO_S32MSB
    encodeAudioFormat Signed32BitNativeAudio = Word16
    Raw.SDL_AUDIO_S32SYS
    encodeAudioFormat FloatingLEAudio = Word16
    Raw.SDL_AUDIO_F32LSB
    encodeAudioFormat FloatingBEAudio = Word16
    Raw.SDL_AUDIO_F32MSB
    encodeAudioFormat FloatingNativeAudio = Word16
    Raw.SDL_AUDIO_F32SYS

    decodeAudioFormat :: Word16 -> AnAudioFormat
    decodeAudioFormat :: Word16 -> AnAudioFormat
    decodeAudioFormat Raw.SDL_AUDIO_S8 = AudioFormat Int8 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Int8
    Signed8BitAudio
    decodeAudioFormat Raw.SDL_AUDIO_U8 = AudioFormat Word8 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Word8
    Unsigned8BitAudio
    decodeAudioFormat Raw.SDL_AUDIO_S16LSB = AudioFormat Int16 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Int16
    Signed16BitLEAudio
    decodeAudioFormat Raw.SDL_AUDIO_S16MSB = AudioFormat Int16 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Int16
    Signed16BitBEAudio
    decodeAudioFormat Raw.SDL_AUDIO_S16SYS = AudioFormat Int16 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Int16
    Signed16BitNativeAudio
    decodeAudioFormat Raw.SDL_AUDIO_U16LSB = AudioFormat Word16 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Word16
    Unsigned16BitLEAudio
    decodeAudioFormat Raw.SDL_AUDIO_U16MSB = AudioFormat Word16 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Word16
    Unsigned16BitBEAudio
    decodeAudioFormat Raw.SDL_AUDIO_U16SYS = AudioFormat Word16 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Word16
    Unsigned16BitNativeAudio
    decodeAudioFormat Raw.SDL_AUDIO_S32LSB = AudioFormat Int32 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Int32
    Signed32BitLEAudio
    decodeAudioFormat Raw.SDL_AUDIO_S32MSB = AudioFormat Int32 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Int32
    Signed32BitBEAudio
    decodeAudioFormat Raw.SDL_AUDIO_S32SYS = AudioFormat Int32 -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Int32
    Signed32BitNativeAudio
    decodeAudioFormat Raw.SDL_AUDIO_F32LSB = AudioFormat Float -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Float
    FloatingLEAudio
    decodeAudioFormat Raw.SDL_AUDIO_F32MSB = AudioFormat Float -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Float
    FloatingBEAudio
    decodeAudioFormat Raw.SDL_AUDIO_F32SYS = AudioFormat Float -> AnAudioFormat
    forall sampleType. AudioFormat sampleType -> AnAudioFormat
    AnAudioFormat AudioFormat Float
    FloatingNativeAudio
    decodeAudioFormat x :: Word16
    x = String -> AnAudioFormat
    forall a. HasCallStack => String -> a
    error ("decodeAudioFormat failed: Unknown format " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Word16 -> String
    forall a. Show a => a -> String
    show Word16
    x)

    -- | How many channels audio should be played on
    data Channels
      = Mono -- ^ A single speaker configuration
      | Stereo -- ^ A traditional left/right stereo system
      | Quad
      | FivePointOne -- ^ 5.1 surround sound
      deriving (Channels
    Channels -> Channels -> Bounded Channels
    forall a. a -> a -> Bounded a
    maxBound :: Channels
    $cmaxBound :: Channels
    minBound :: Channels
    $cminBound :: Channels
    Bounded,Typeable Channels
    Constr
    DataType
    Typeable Channels =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> Channels -> c Channels)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c Channels)
    -> (Channels -> Constr)
    -> (Channels -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c Channels))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Channels))
    -> ((forall b. Data b => b -> b) -> Channels -> Channels)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> Channels -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> Channels -> r)
    -> (forall u. (forall d. Data d => d -> u) -> Channels -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> Channels -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> Channels -> m Channels)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Channels -> m Channels)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Channels -> m Channels)
    -> Data Channels
    Channels -> Constr
    Channels -> DataType
    (forall b. Data b => b -> b) -> Channels -> Channels
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Channels -> c Channels
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Channels
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> Channels -> u
    forall u. (forall d. Data d => d -> u) -> Channels -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Channels -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Channels -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Channels -> m Channels
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Channels -> m Channels
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Channels
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Channels -> c Channels
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Channels)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Channels)
    $cFivePointOne :: Constr
    $cQuad :: Constr
    $cStereo :: Constr
    $cMono :: Constr
    $tChannels :: DataType
    gmapMo :: (forall d. Data d => d -> m d) -> Channels -> m Channels
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Channels -> m Channels
    gmapMp :: (forall d. Data d => d -> m d) -> Channels -> m Channels
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Channels -> m Channels
    gmapM :: (forall d. Data d => d -> m d) -> Channels -> m Channels
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Channels -> m Channels
    gmapQi :: Int -> (forall d. Data d => d -> u) -> Channels -> u
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Channels -> u
    gmapQ :: (forall d. Data d => d -> u) -> Channels -> [u]
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> Channels -> [u]
    gmapQr :: (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Channels -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Channels -> r
    gmapQl :: (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Channels -> r
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Channels -> r
    gmapT :: (forall b. Data b => b -> b) -> Channels -> Channels
    $cgmapT :: (forall b. Data b => b -> b) -> Channels -> Channels
    dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Channels)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Channels)
    dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Channels)
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Channels)
    dataTypeOf :: Channels -> DataType
    $cdataTypeOf :: Channels -> DataType
    toConstr :: Channels -> Constr
    $ctoConstr :: Channels -> Constr
    gunfold :: (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Channels
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Channels
    gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Channels -> c Channels
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Channels -> c Channels
    $cp1Data :: Typeable Channels
    Data,Int -> Channels
    Channels -> Int
    Channels -> [Channels]
    Channels -> Channels
    Channels -> Channels -> [Channels]
    Channels -> Channels -> Channels -> [Channels]
    (Channels -> Channels)
    -> (Channels -> Channels)
    -> (Int -> Channels)
    -> (Channels -> Int)
    -> (Channels -> [Channels])
    -> (Channels -> Channels -> [Channels])
    -> (Channels -> Channels -> [Channels])
    -> (Channels -> Channels -> Channels -> [Channels])
    -> Enum Channels
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    enumFromThenTo :: Channels -> Channels -> Channels -> [Channels]
    $cenumFromThenTo :: Channels -> Channels -> Channels -> [Channels]
    enumFromTo :: Channels -> Channels -> [Channels]
    $cenumFromTo :: Channels -> Channels -> [Channels]
    enumFromThen :: Channels -> Channels -> [Channels]
    $cenumFromThen :: Channels -> Channels -> [Channels]
    enumFrom :: Channels -> [Channels]
    $cenumFrom :: Channels -> [Channels]
    fromEnum :: Channels -> Int
    $cfromEnum :: Channels -> Int
    toEnum :: Int -> Channels
    $ctoEnum :: Int -> Channels
    pred :: Channels -> Channels
    $cpred :: Channels -> Channels
    succ :: Channels -> Channels
    $csucc :: Channels -> Channels
    Enum,Channels -> Channels -> Bool
    (Channels -> Channels -> Bool)
    -> (Channels -> Channels -> Bool) -> Eq Channels
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: Channels -> Channels -> Bool
    $c/= :: Channels -> Channels -> Bool
    == :: Channels -> Channels -> Bool
    $c== :: Channels -> Channels -> Bool
    Eq,(forall x. Channels -> Rep Channels x)
    -> (forall x. Rep Channels x -> Channels) -> Generic Channels
    forall x. Rep Channels x -> Channels
    forall x. Channels -> Rep Channels x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cto :: forall x. Rep Channels x -> Channels
    $cfrom :: forall x. Channels -> Rep Channels x
    Generic,Eq Channels
    Eq Channels =>
    (Channels -> Channels -> Ordering)
    -> (Channels -> Channels -> Bool)
    -> (Channels -> Channels -> Bool)
    -> (Channels -> Channels -> Bool)
    -> (Channels -> Channels -> Bool)
    -> (Channels -> Channels -> Channels)
    -> (Channels -> Channels -> Channels)
    -> Ord Channels
    Channels -> Channels -> Bool
    Channels -> Channels -> Ordering
    Channels -> Channels -> Channels
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    min :: Channels -> Channels -> Channels
    $cmin :: Channels -> Channels -> Channels
    max :: Channels -> Channels -> Channels
    $cmax :: Channels -> Channels -> Channels
    >= :: Channels -> Channels -> Bool
    $c>= :: Channels -> Channels -> Bool
    > :: Channels -> Channels -> Bool
    $c> :: Channels -> Channels -> Bool
    <= :: Channels -> Channels -> Bool
    $c<= :: Channels -> Channels -> Bool
    < :: Channels -> Channels -> Bool
    $c< :: Channels -> Channels -> Bool
    compare :: Channels -> Channels -> Ordering
    $ccompare :: Channels -> Channels -> Ordering
    $cp1Ord :: Eq Channels
    Ord,ReadPrec [Channels]
    ReadPrec Channels
    Int -> ReadS Channels
    ReadS [Channels]
    (Int -> ReadS Channels)
    -> ReadS [Channels]
    -> ReadPrec Channels
    -> ReadPrec [Channels]
    -> Read Channels
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    readListPrec :: ReadPrec [Channels]
    $creadListPrec :: ReadPrec [Channels]
    readPrec :: ReadPrec Channels
    $creadPrec :: ReadPrec Channels
    readList :: ReadS [Channels]
    $creadList :: ReadS [Channels]
    readsPrec :: Int -> ReadS Channels
    $creadsPrec :: Int -> ReadS Channels
    Read,Int -> Channels -> ShowS
    [Channels] -> ShowS
    Channels -> String
    (Int -> Channels -> ShowS)
    -> (Channels -> String) -> ([Channels] -> ShowS) -> Show Channels
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [Channels] -> ShowS
    $cshowList :: [Channels] -> ShowS
    show :: Channels -> String
    $cshow :: Channels -> String
    showsPrec :: Int -> Channels -> ShowS
    $cshowsPrec :: Int -> Channels -> ShowS
    Show,Typeable)

    -- | 'AudioSpec' is the concrete specification of how an 'AudioDevice' was
    -- sucessfully opened. Unlike 'OpenDeviceSpec', which specifies what you
    -- /want/, 'AudioSpec' specifies what you /have/.
    data AudioSpec = forall sampleType. AudioSpec
      { AudioSpec -> CInt
    audioSpecFreq :: !CInt
        -- ^ DSP frequency (samples per second)
      , ()
    audioSpecFormat :: !(AudioFormat sampleType)
        -- ^ Audio data format
      , AudioSpec -> Channels
    audioSpecChannels :: !Channels
        -- ^ Number of separate sound channels
      , AudioSpec -> Word8
    audioSpecSilence :: !Word8
        -- ^ Calculated udio buffer silence value
      , AudioSpec -> Word16
    audioSpecSamples :: !Word16
        -- ^ Audio buffer size in samples (power of 2)
      , AudioSpec -> AudioDeviceID
    audioSpecSize :: !Word32
        -- ^ Calculated audio buffer size in bytes
      , ()
    audioSpecCallback :: AudioFormat sampleType -> MV.IOVector sampleType -> IO ()
        -- ^ The function to call when the audio device needs more data
      }
      deriving (Typeable)

    -- | How you intend to use an 'AudioDevice'
    data AudioDeviceUsage
      = ForPlayback -- ^ The device will be used for sample playback.
      | ForCapture -- ^ The device will be used for sample capture.
      deriving (AudioDeviceUsage
    AudioDeviceUsage -> AudioDeviceUsage -> Bounded AudioDeviceUsage
    forall a. a -> a -> Bounded a
    maxBound :: AudioDeviceUsage
    $cmaxBound :: AudioDeviceUsage
    minBound :: AudioDeviceUsage
    $cminBound :: AudioDeviceUsage
    Bounded, Typeable AudioDeviceUsage
    Constr
    DataType
    Typeable AudioDeviceUsage =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> AudioDeviceUsage -> c AudioDeviceUsage)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c AudioDeviceUsage)
    -> (AudioDeviceUsage -> Constr)
    -> (AudioDeviceUsage -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c AudioDeviceUsage))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c AudioDeviceUsage))
    -> ((forall b. Data b => b -> b)
        -> AudioDeviceUsage -> AudioDeviceUsage)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> AudioDeviceUsage -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> AudioDeviceUsage -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> AudioDeviceUsage -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> AudioDeviceUsage -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> AudioDeviceUsage -> m AudioDeviceUsage)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> AudioDeviceUsage -> m AudioDeviceUsage)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> AudioDeviceUsage -> m AudioDeviceUsage)
    -> Data AudioDeviceUsage
    AudioDeviceUsage -> Constr
    AudioDeviceUsage -> DataType
    (forall b. Data b => b -> b)
    -> AudioDeviceUsage -> AudioDeviceUsage
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AudioDeviceUsage -> c AudioDeviceUsage
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AudioDeviceUsage
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u.
    Int -> (forall d. Data d => d -> u) -> AudioDeviceUsage -> u
    forall u. (forall d. Data d => d -> u) -> AudioDeviceUsage -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceUsage -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceUsage -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceUsage -> m AudioDeviceUsage
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceUsage -> m AudioDeviceUsage
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AudioDeviceUsage
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AudioDeviceUsage -> c AudioDeviceUsage
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AudioDeviceUsage)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c AudioDeviceUsage)
    $cForCapture :: Constr
    $cForPlayback :: Constr
    $tAudioDeviceUsage :: DataType
    gmapMo :: (forall d. Data d => d -> m d)
    -> AudioDeviceUsage -> m AudioDeviceUsage
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceUsage -> m AudioDeviceUsage
    gmapMp :: (forall d. Data d => d -> m d)
    -> AudioDeviceUsage -> m AudioDeviceUsage
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceUsage -> m AudioDeviceUsage
    gmapM :: (forall d. Data d => d -> m d)
    -> AudioDeviceUsage -> m AudioDeviceUsage
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceUsage -> m AudioDeviceUsage
    gmapQi :: Int -> (forall d. Data d => d -> u) -> AudioDeviceUsage -> u
    $cgmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> AudioDeviceUsage -> u
    gmapQ :: (forall d. Data d => d -> u) -> AudioDeviceUsage -> [u]
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> AudioDeviceUsage -> [u]
    gmapQr :: (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceUsage -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceUsage -> r
    gmapQl :: (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceUsage -> r
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceUsage -> r
    gmapT :: (forall b. Data b => b -> b)
    -> AudioDeviceUsage -> AudioDeviceUsage
    $cgmapT :: (forall b. Data b => b -> b)
    -> AudioDeviceUsage -> AudioDeviceUsage
    dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c AudioDeviceUsage)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c AudioDeviceUsage)
    dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c AudioDeviceUsage)
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AudioDeviceUsage)
    dataTypeOf :: AudioDeviceUsage -> DataType
    $cdataTypeOf :: AudioDeviceUsage -> DataType
    toConstr :: AudioDeviceUsage -> Constr
    $ctoConstr :: AudioDeviceUsage -> Constr
    gunfold :: (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AudioDeviceUsage
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AudioDeviceUsage
    gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AudioDeviceUsage -> c AudioDeviceUsage
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AudioDeviceUsage -> c AudioDeviceUsage
    $cp1Data :: Typeable AudioDeviceUsage
    Data, Int -> AudioDeviceUsage
    AudioDeviceUsage -> Int
    AudioDeviceUsage -> [AudioDeviceUsage]
    AudioDeviceUsage -> AudioDeviceUsage
    AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage]
    AudioDeviceUsage
    -> AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage]
    (AudioDeviceUsage -> AudioDeviceUsage)
    -> (AudioDeviceUsage -> AudioDeviceUsage)
    -> (Int -> AudioDeviceUsage)
    -> (AudioDeviceUsage -> Int)
    -> (AudioDeviceUsage -> [AudioDeviceUsage])
    -> (AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage])
    -> (AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage])
    -> (AudioDeviceUsage
        -> AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage])
    -> Enum AudioDeviceUsage
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    enumFromThenTo :: AudioDeviceUsage
    -> AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage]
    $cenumFromThenTo :: AudioDeviceUsage
    -> AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage]
    enumFromTo :: AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage]
    $cenumFromTo :: AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage]
    enumFromThen :: AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage]
    $cenumFromThen :: AudioDeviceUsage -> AudioDeviceUsage -> [AudioDeviceUsage]
    enumFrom :: AudioDeviceUsage -> [AudioDeviceUsage]
    $cenumFrom :: AudioDeviceUsage -> [AudioDeviceUsage]
    fromEnum :: AudioDeviceUsage -> Int
    $cfromEnum :: AudioDeviceUsage -> Int
    toEnum :: Int -> AudioDeviceUsage
    $ctoEnum :: Int -> AudioDeviceUsage
    pred :: AudioDeviceUsage -> AudioDeviceUsage
    $cpred :: AudioDeviceUsage -> AudioDeviceUsage
    succ :: AudioDeviceUsage -> AudioDeviceUsage
    $csucc :: AudioDeviceUsage -> AudioDeviceUsage
    Enum, AudioDeviceUsage -> AudioDeviceUsage -> Bool
    (AudioDeviceUsage -> AudioDeviceUsage -> Bool)
    -> (AudioDeviceUsage -> AudioDeviceUsage -> Bool)
    -> Eq AudioDeviceUsage
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    $c/= :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    == :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    $c== :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    Eq, (forall x. AudioDeviceUsage -> Rep AudioDeviceUsage x)
    -> (forall x. Rep AudioDeviceUsage x -> AudioDeviceUsage)
    -> Generic AudioDeviceUsage
    forall x. Rep AudioDeviceUsage x -> AudioDeviceUsage
    forall x. AudioDeviceUsage -> Rep AudioDeviceUsage x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cto :: forall x. Rep AudioDeviceUsage x -> AudioDeviceUsage
    $cfrom :: forall x. AudioDeviceUsage -> Rep AudioDeviceUsage x
    Generic, Eq AudioDeviceUsage
    Eq AudioDeviceUsage =>
    (AudioDeviceUsage -> AudioDeviceUsage -> Ordering)
    -> (AudioDeviceUsage -> AudioDeviceUsage -> Bool)
    -> (AudioDeviceUsage -> AudioDeviceUsage -> Bool)
    -> (AudioDeviceUsage -> AudioDeviceUsage -> Bool)
    -> (AudioDeviceUsage -> AudioDeviceUsage -> Bool)
    -> (AudioDeviceUsage -> AudioDeviceUsage -> AudioDeviceUsage)
    -> (AudioDeviceUsage -> AudioDeviceUsage -> AudioDeviceUsage)
    -> Ord AudioDeviceUsage
    AudioDeviceUsage -> AudioDeviceUsage -> Bool
    AudioDeviceUsage -> AudioDeviceUsage -> Ordering
    AudioDeviceUsage -> AudioDeviceUsage -> AudioDeviceUsage
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    min :: AudioDeviceUsage -> AudioDeviceUsage -> AudioDeviceUsage
    $cmin :: AudioDeviceUsage -> AudioDeviceUsage -> AudioDeviceUsage
    max :: AudioDeviceUsage -> AudioDeviceUsage -> AudioDeviceUsage
    $cmax :: AudioDeviceUsage -> AudioDeviceUsage -> AudioDeviceUsage
    >= :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    $c>= :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    > :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    $c> :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    <= :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    $c<= :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    < :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    $c< :: AudioDeviceUsage -> AudioDeviceUsage -> Bool
    compare :: AudioDeviceUsage -> AudioDeviceUsage -> Ordering
    $ccompare :: AudioDeviceUsage -> AudioDeviceUsage -> Ordering
    $cp1Ord :: Eq AudioDeviceUsage
    Ord, ReadPrec [AudioDeviceUsage]
    ReadPrec AudioDeviceUsage
    Int -> ReadS AudioDeviceUsage
    ReadS [AudioDeviceUsage]
    (Int -> ReadS AudioDeviceUsage)
    -> ReadS [AudioDeviceUsage]
    -> ReadPrec AudioDeviceUsage
    -> ReadPrec [AudioDeviceUsage]
    -> Read AudioDeviceUsage
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    readListPrec :: ReadPrec [AudioDeviceUsage]
    $creadListPrec :: ReadPrec [AudioDeviceUsage]
    readPrec :: ReadPrec AudioDeviceUsage
    $creadPrec :: ReadPrec AudioDeviceUsage
    readList :: ReadS [AudioDeviceUsage]
    $creadList :: ReadS [AudioDeviceUsage]
    readsPrec :: Int -> ReadS AudioDeviceUsage
    $creadsPrec :: Int -> ReadS AudioDeviceUsage
    Read, Int -> AudioDeviceUsage -> ShowS
    [AudioDeviceUsage] -> ShowS
    AudioDeviceUsage -> String
    (Int -> AudioDeviceUsage -> ShowS)
    -> (AudioDeviceUsage -> String)
    -> ([AudioDeviceUsage] -> ShowS)
    -> Show AudioDeviceUsage
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [AudioDeviceUsage] -> ShowS
    $cshowList :: [AudioDeviceUsage] -> ShowS
    show :: AudioDeviceUsage -> String
    $cshow :: AudioDeviceUsage -> String
    showsPrec :: Int -> AudioDeviceUsage -> ShowS
    $cshowsPrec :: Int -> AudioDeviceUsage -> ShowS
    Show, Typeable)

    encodeUsage :: Num a => AudioDeviceUsage -> a
    encodeUsage :: AudioDeviceUsage -> a
    encodeUsage usage :: AudioDeviceUsage
    usage =
      case AudioDeviceUsage
    usage of
        ForPlayback -> 0
        ForCapture -> 1

    -- | Used to indicate to SDL whether it is allowed to open other audio devices (if a property is marked as a 'Desire') or if it should fail if the device is unavailable ('Mandate').
    data Changeable a
      = Mandate !a
        -- ^ 'Mandate' this exact property value, and fail if a matching audio device cannot be found.
      | Desire !a
        -- ^ 'Desire' this property value, but allow other audio devices to be opened.
      deriving (Typeable (Changeable a)
    Constr
    DataType
    Typeable (Changeable a) =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> Changeable a -> c (Changeable a))
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c (Changeable a))
    -> (Changeable a -> Constr)
    -> (Changeable a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c (Changeable a)))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c (Changeable a)))
    -> ((forall b. Data b => b -> b) -> Changeable a -> Changeable a)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> Changeable a -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> Changeable a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> Changeable a -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> Changeable a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a))
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a))
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a))
    -> Data (Changeable a)
    Changeable a -> Constr
    Changeable a -> DataType
    (forall d. Data d => c (t d)) -> Maybe (c (Changeable a))
    (forall b. Data b => b -> b) -> Changeable a -> Changeable a
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Changeable a -> c (Changeable a)
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Changeable a)
    forall a. Data a => Typeable (Changeable a)
    forall a. Data a => Changeable a -> Constr
    forall a. Data a => Changeable a -> DataType
    forall a.
    Data a =>
    (forall b. Data b => b -> b) -> Changeable a -> Changeable a
    forall a u.
    Data a =>
    Int -> (forall d. Data d => d -> u) -> Changeable a -> u
    forall a u.
    Data a =>
    (forall d. Data d => d -> u) -> Changeable a -> [u]
    forall a r r'.
    Data a =>
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Changeable a -> r
    forall a r r'.
    Data a =>
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Changeable a -> r
    forall a (m :: * -> *).
    (Data a, Monad m) =>
    (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    forall a (m :: * -> *).
    (Data a, MonadPlus m) =>
    (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    forall a (c :: * -> *).
    Data a =>
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Changeable a)
    forall a (c :: * -> *).
    Data a =>
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Changeable a -> c (Changeable a)
    forall a (t :: * -> *) (c :: * -> *).
    (Data a, Typeable t) =>
    (forall d. Data d => c (t d)) -> Maybe (c (Changeable a))
    forall a (t :: * -> * -> *) (c :: * -> *).
    (Data a, Typeable t) =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Changeable a))
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> Changeable a -> u
    forall u. (forall d. Data d => d -> u) -> Changeable a -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Changeable a -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Changeable a -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Changeable a)
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Changeable a -> c (Changeable a)
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Changeable a))
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Changeable a))
    $cDesire :: Constr
    $cMandate :: Constr
    $tChangeable :: DataType
    gmapMo :: (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    $cgmapMo :: forall a (m :: * -> *).
    (Data a, MonadPlus m) =>
    (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    gmapMp :: (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    $cgmapMp :: forall a (m :: * -> *).
    (Data a, MonadPlus m) =>
    (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    gmapM :: (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    $cgmapM :: forall a (m :: * -> *).
    (Data a, Monad m) =>
    (forall d. Data d => d -> m d) -> Changeable a -> m (Changeable a)
    gmapQi :: Int -> (forall d. Data d => d -> u) -> Changeable a -> u
    $cgmapQi :: forall a u.
    Data a =>
    Int -> (forall d. Data d => d -> u) -> Changeable a -> u
    gmapQ :: (forall d. Data d => d -> u) -> Changeable a -> [u]
    $cgmapQ :: forall a u.
    Data a =>
    (forall d. Data d => d -> u) -> Changeable a -> [u]
    gmapQr :: (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Changeable a -> r
    $cgmapQr :: forall a r r'.
    Data a =>
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Changeable a -> r
    gmapQl :: (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Changeable a -> r
    $cgmapQl :: forall a r r'.
    Data a =>
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Changeable a -> r
    gmapT :: (forall b. Data b => b -> b) -> Changeable a -> Changeable a
    $cgmapT :: forall a.
    Data a =>
    (forall b. Data b => b -> b) -> Changeable a -> Changeable a
    dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Changeable a))
    $cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
    (Data a, Typeable t) =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Changeable a))
    dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Changeable a))
    $cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
    (Data a, Typeable t) =>
    (forall d. Data d => c (t d)) -> Maybe (c (Changeable a))
    dataTypeOf :: Changeable a -> DataType
    $cdataTypeOf :: forall a. Data a => Changeable a -> DataType
    toConstr :: Changeable a -> Constr
    $ctoConstr :: forall a. Data a => Changeable a -> Constr
    gunfold :: (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Changeable a)
    $cgunfold :: forall a (c :: * -> *).
    Data a =>
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Changeable a)
    gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Changeable a -> c (Changeable a)
    $cgfoldl :: forall a (c :: * -> *).
    Data a =>
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Changeable a -> c (Changeable a)
    $cp1Data :: forall a. Data a => Typeable (Changeable a)
    Data, Changeable a -> Bool
    (a -> m) -> Changeable a -> m
    (a -> b -> b) -> b -> Changeable a -> b
    (forall m. Monoid m => Changeable m -> m)
    -> (forall m a. Monoid m => (a -> m) -> Changeable a -> m)
    -> (forall m a. Monoid m => (a -> m) -> Changeable a -> m)
    -> (forall a b. (a -> b -> b) -> b -> Changeable a -> b)
    -> (forall a b. (a -> b -> b) -> b -> Changeable a -> b)
    -> (forall b a. (b -> a -> b) -> b -> Changeable a -> b)
    -> (forall b a. (b -> a -> b) -> b -> Changeable a -> b)
    -> (forall a. (a -> a -> a) -> Changeable a -> a)
    -> (forall a. (a -> a -> a) -> Changeable a -> a)
    -> (forall a. Changeable a -> [a])
    -> (forall a. Changeable a -> Bool)
    -> (forall a. Changeable a -> Int)
    -> (forall a. Eq a => a -> Changeable a -> Bool)
    -> (forall a. Ord a => Changeable a -> a)
    -> (forall a. Ord a => Changeable a -> a)
    -> (forall a. Num a => Changeable a -> a)
    -> (forall a. Num a => Changeable a -> a)
    -> Foldable Changeable
    forall a. Eq a => a -> Changeable a -> Bool
    forall a. Num a => Changeable a -> a
    forall a. Ord a => Changeable a -> a
    forall m. Monoid m => Changeable m -> m
    forall a. Changeable a -> Bool
    forall a. Changeable a -> Int
    forall a. Changeable a -> [a]
    forall a. (a -> a -> a) -> Changeable a -> a
    forall m a. Monoid m => (a -> m) -> Changeable a -> m
    forall b a. (b -> a -> b) -> b -> Changeable a -> b
    forall a b. (a -> b -> b) -> b -> Changeable a -> b
    forall (t :: * -> *).
    (forall m. Monoid m => t m -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall m a. Monoid m => (a -> m) -> t a -> m)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall a b. (a -> b -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall b a. (b -> a -> b) -> b -> t a -> b)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. (a -> a -> a) -> t a -> a)
    -> (forall a. t a -> [a])
    -> (forall a. t a -> Bool)
    -> (forall a. t a -> Int)
    -> (forall a. Eq a => a -> t a -> Bool)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Ord a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> (forall a. Num a => t a -> a)
    -> Foldable t
    product :: Changeable a -> a
    $cproduct :: forall a. Num a => Changeable a -> a
    sum :: Changeable a -> a
    $csum :: forall a. Num a => Changeable a -> a
    minimum :: Changeable a -> a
    $cminimum :: forall a. Ord a => Changeable a -> a
    maximum :: Changeable a -> a
    $cmaximum :: forall a. Ord a => Changeable a -> a
    elem :: a -> Changeable a -> Bool
    $celem :: forall a. Eq a => a -> Changeable a -> Bool
    length :: Changeable a -> Int
    $clength :: forall a. Changeable a -> Int
    null :: Changeable a -> Bool
    $cnull :: forall a. Changeable a -> Bool
    toList :: Changeable a -> [a]
    $ctoList :: forall a. Changeable a -> [a]
    foldl1 :: (a -> a -> a) -> Changeable a -> a
    $cfoldl1 :: forall a. (a -> a -> a) -> Changeable a -> a
    foldr1 :: (a -> a -> a) -> Changeable a -> a
    $cfoldr1 :: forall a. (a -> a -> a) -> Changeable a -> a
    foldl' :: (b -> a -> b) -> b -> Changeable a -> b
    $cfoldl' :: forall b a. (b -> a -> b) -> b -> Changeable a -> b
    foldl :: (b -> a -> b) -> b -> Changeable a -> b
    $cfoldl :: forall b a. (b -> a -> b) -> b -> Changeable a -> b
    foldr' :: (a -> b -> b) -> b -> Changeable a -> b
    $cfoldr' :: forall a b. (a -> b -> b) -> b -> Changeable a -> b
    foldr :: (a -> b -> b) -> b -> Changeable a -> b
    $cfoldr :: forall a b. (a -> b -> b) -> b -> Changeable a -> b
    foldMap' :: (a -> m) -> Changeable a -> m
    $cfoldMap' :: forall m a. Monoid m => (a -> m) -> Changeable a -> m
    foldMap :: (a -> m) -> Changeable a -> m
    $cfoldMap :: forall m a. Monoid m => (a -> m) -> Changeable a -> m
    fold :: Changeable m -> m
    $cfold :: forall m. Monoid m => Changeable m -> m
    Foldable, a -> Changeable b -> Changeable a
    (a -> b) -> Changeable a -> Changeable b
    (forall a b. (a -> b) -> Changeable a -> Changeable b)
    -> (forall a b. a -> Changeable b -> Changeable a)
    -> Functor Changeable
    forall a b. a -> Changeable b -> Changeable a
    forall a b. (a -> b) -> Changeable a -> Changeable b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    <$ :: a -> Changeable b -> Changeable a
    $c<$ :: forall a b. a -> Changeable b -> Changeable a
    fmap :: (a -> b) -> Changeable a -> Changeable b
    $cfmap :: forall a b. (a -> b) -> Changeable a -> Changeable b
    Functor, Changeable a -> Changeable a -> Bool
    (Changeable a -> Changeable a -> Bool)
    -> (Changeable a -> Changeable a -> Bool) -> Eq (Changeable a)
    forall a. Eq a => Changeable a -> Changeable a -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: Changeable a -> Changeable a -> Bool
    $c/= :: forall a. Eq a => Changeable a -> Changeable a -> Bool
    == :: Changeable a -> Changeable a -> Bool
    $c== :: forall a. Eq a => Changeable a -> Changeable a -> Bool
    Eq, (forall x. Changeable a -> Rep (Changeable a) x)
    -> (forall x. Rep (Changeable a) x -> Changeable a)
    -> Generic (Changeable a)
    forall x. Rep (Changeable a) x -> Changeable a
    forall x. Changeable a -> Rep (Changeable a) x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    forall a x. Rep (Changeable a) x -> Changeable a
    forall a x. Changeable a -> Rep (Changeable a) x
    $cto :: forall a x. Rep (Changeable a) x -> Changeable a
    $cfrom :: forall a x. Changeable a -> Rep (Changeable a) x
    Generic, ReadPrec [Changeable a]
    ReadPrec (Changeable a)
    Int -> ReadS (Changeable a)
    ReadS [Changeable a]
    (Int -> ReadS (Changeable a))
    -> ReadS [Changeable a]
    -> ReadPrec (Changeable a)
    -> ReadPrec [Changeable a]
    -> Read (Changeable a)
    forall a. Read a => ReadPrec [Changeable a]
    forall a. Read a => ReadPrec (Changeable a)
    forall a. Read a => Int -> ReadS (Changeable a)
    forall a. Read a => ReadS [Changeable a]
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    readListPrec :: ReadPrec [Changeable a]
    $creadListPrec :: forall a. Read a => ReadPrec [Changeable a]
    readPrec :: ReadPrec (Changeable a)
    $creadPrec :: forall a. Read a => ReadPrec (Changeable a)
    readList :: ReadS [Changeable a]
    $creadList :: forall a. Read a => ReadS [Changeable a]
    readsPrec :: Int -> ReadS (Changeable a)
    $creadsPrec :: forall a. Read a => Int -> ReadS (Changeable a)
    Read, Int -> Changeable a -> ShowS
    [Changeable a] -> ShowS
    Changeable a -> String
    (Int -> Changeable a -> ShowS)
    -> (Changeable a -> String)
    -> ([Changeable a] -> ShowS)
    -> Show (Changeable a)
    forall a. Show a => Int -> Changeable a -> ShowS
    forall a. Show a => [Changeable a] -> ShowS
    forall a. Show a => Changeable a -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [Changeable a] -> ShowS
    $cshowList :: forall a. Show a => [Changeable a] -> ShowS
    show :: Changeable a -> String
    $cshow :: forall a. Show a => Changeable a -> String
    showsPrec :: Int -> Changeable a -> ShowS
    $cshowsPrec :: forall a. Show a => Int -> Changeable a -> ShowS
    Show, Functor Changeable
    Foldable Changeable
    (Functor Changeable, Foldable Changeable) =>
    (forall (f :: * -> *) a b.
     Applicative f =>
     (a -> f b) -> Changeable a -> f (Changeable b))
    -> (forall (f :: * -> *) a.
        Applicative f =>
        Changeable (f a) -> f (Changeable a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> Changeable a -> m (Changeable b))
    -> (forall (m :: * -> *) a.
        Monad m =>
        Changeable (m a) -> m (Changeable a))
    -> Traversable Changeable
    (a -> f b) -> Changeable a -> f (Changeable b)
    forall (t :: * -> *).
    (Functor t, Foldable t) =>
    (forall (f :: * -> *) a b.
     Applicative f =>
     (a -> f b) -> t a -> f (t b))
    -> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
    -> (forall (m :: * -> *) a b.
        Monad m =>
        (a -> m b) -> t a -> m (t b))
    -> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
    -> Traversable t
    forall (m :: * -> *) a.
    Monad m =>
    Changeable (m a) -> m (Changeable a)
    forall (f :: * -> *) a.
    Applicative f =>
    Changeable (f a) -> f (Changeable a)
    forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Changeable a -> m (Changeable b)
    forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Changeable a -> f (Changeable b)
    sequence :: Changeable (m a) -> m (Changeable a)
    $csequence :: forall (m :: * -> *) a.
    Monad m =>
    Changeable (m a) -> m (Changeable a)
    mapM :: (a -> m b) -> Changeable a -> m (Changeable b)
    $cmapM :: forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Changeable a -> m (Changeable b)
    sequenceA :: Changeable (f a) -> f (Changeable a)
    $csequenceA :: forall (f :: * -> *) a.
    Applicative f =>
    Changeable (f a) -> f (Changeable a)
    traverse :: (a -> f b) -> Changeable a -> f (Changeable b)
    $ctraverse :: forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Changeable a -> f (Changeable b)
    $cp2Traversable :: Foldable Changeable
    $cp1Traversable :: Functor Changeable
    Traversable, Typeable)

    foldChangeable :: (a -> b) -> (a -> b) -> Changeable a -> b
    foldChangeable :: (a -> b) -> (a -> b) -> Changeable a -> b
    foldChangeable f :: a -> b
    f _ (Mandate a :: a
    a) = a -> b
    f a
    a
    foldChangeable _ g :: a -> b
    g (Desire a :: a
    a) = a -> b
    g a
    a

    unpackChangeable :: Changeable a -> a
    unpackChangeable :: Changeable a -> a
    unpackChangeable = (a -> a) -> (a -> a) -> Changeable a -> a
    forall a b. (a -> b) -> (a -> b) -> Changeable a -> b
    foldChangeable a -> a
    forall a. a -> a
    id a -> a
    forall a. a -> a
    id

    -- | Whether a device should be locked or unlocked.
    data LockState
      = Locked  -- ^ Lock the device, preventing the callback from producing data.
      | Unlocked -- ^ Unlock the device, resuming calls to the callback.
      deriving (LockState
    LockState -> LockState -> Bounded LockState
    forall a. a -> a -> Bounded a
    maxBound :: LockState
    $cmaxBound :: LockState
    minBound :: LockState
    $cminBound :: LockState
    Bounded, Typeable LockState
    Constr
    DataType
    Typeable LockState =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> LockState -> c LockState)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c LockState)
    -> (LockState -> Constr)
    -> (LockState -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c LockState))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LockState))
    -> ((forall b. Data b => b -> b) -> LockState -> LockState)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> LockState -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> LockState -> r)
    -> (forall u. (forall d. Data d => d -> u) -> LockState -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> LockState -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> LockState -> m LockState)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> LockState -> m LockState)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> LockState -> m LockState)
    -> Data LockState
    LockState -> Constr
    LockState -> DataType
    (forall b. Data b => b -> b) -> LockState -> LockState
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LockState -> c LockState
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LockState
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> LockState -> u
    forall u. (forall d. Data d => d -> u) -> LockState -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LockState -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LockState -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> LockState -> m LockState
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LockState -> m LockState
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LockState
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LockState -> c LockState
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LockState)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LockState)
    $cUnlocked :: Constr
    $cLocked :: Constr
    $tLockState :: DataType
    gmapMo :: (forall d. Data d => d -> m d) -> LockState -> m LockState
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LockState -> m LockState
    gmapMp :: (forall d. Data d => d -> m d) -> LockState -> m LockState
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LockState -> m LockState
    gmapM :: (forall d. Data d => d -> m d) -> LockState -> m LockState
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> LockState -> m LockState
    gmapQi :: Int -> (forall d. Data d => d -> u) -> LockState -> u
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LockState -> u
    gmapQ :: (forall d. Data d => d -> u) -> LockState -> [u]
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> LockState -> [u]
    gmapQr :: (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LockState -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LockState -> r
    gmapQl :: (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LockState -> r
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LockState -> r
    gmapT :: (forall b. Data b => b -> b) -> LockState -> LockState
    $cgmapT :: (forall b. Data b => b -> b) -> LockState -> LockState
    dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LockState)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LockState)
    dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c LockState)
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LockState)
    dataTypeOf :: LockState -> DataType
    $cdataTypeOf :: LockState -> DataType
    toConstr :: LockState -> Constr
    $ctoConstr :: LockState -> Constr
    gunfold :: (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LockState
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LockState
    gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LockState -> c LockState
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LockState -> c LockState
    $cp1Data :: Typeable LockState
    Data, Int -> LockState
    LockState -> Int
    LockState -> [LockState]
    LockState -> LockState
    LockState -> LockState -> [LockState]
    LockState -> LockState -> LockState -> [LockState]
    (LockState -> LockState)
    -> (LockState -> LockState)
    -> (Int -> LockState)
    -> (LockState -> Int)
    -> (LockState -> [LockState])
    -> (LockState -> LockState -> [LockState])
    -> (LockState -> LockState -> [LockState])
    -> (LockState -> LockState -> LockState -> [LockState])
    -> Enum LockState
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    enumFromThenTo :: LockState -> LockState -> LockState -> [LockState]
    $cenumFromThenTo :: LockState -> LockState -> LockState -> [LockState]
    enumFromTo :: LockState -> LockState -> [LockState]
    $cenumFromTo :: LockState -> LockState -> [LockState]
    enumFromThen :: LockState -> LockState -> [LockState]
    $cenumFromThen :: LockState -> LockState -> [LockState]
    enumFrom :: LockState -> [LockState]
    $cenumFrom :: LockState -> [LockState]
    fromEnum :: LockState -> Int
    $cfromEnum :: LockState -> Int
    toEnum :: Int -> LockState
    $ctoEnum :: Int -> LockState
    pred :: LockState -> LockState
    $cpred :: LockState -> LockState
    succ :: LockState -> LockState
    $csucc :: LockState -> LockState
    Enum, LockState -> LockState -> Bool
    (LockState -> LockState -> Bool)
    -> (LockState -> LockState -> Bool) -> Eq LockState
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: LockState -> LockState -> Bool
    $c/= :: LockState -> LockState -> Bool
    == :: LockState -> LockState -> Bool
    $c== :: LockState -> LockState -> Bool
    Eq, (forall x. LockState -> Rep LockState x)
    -> (forall x. Rep LockState x -> LockState) -> Generic LockState
    forall x. Rep LockState x -> LockState
    forall x. LockState -> Rep LockState x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cto :: forall x. Rep LockState x -> LockState
    $cfrom :: forall x. LockState -> Rep LockState x
    Generic, Eq LockState
    Eq LockState =>
    (LockState -> LockState -> Ordering)
    -> (LockState -> LockState -> Bool)
    -> (LockState -> LockState -> Bool)
    -> (LockState -> LockState -> Bool)
    -> (LockState -> LockState -> Bool)
    -> (LockState -> LockState -> LockState)
    -> (LockState -> LockState -> LockState)
    -> Ord LockState
    LockState -> LockState -> Bool
    LockState -> LockState -> Ordering
    LockState -> LockState -> LockState
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    min :: LockState -> LockState -> LockState
    $cmin :: LockState -> LockState -> LockState
    max :: LockState -> LockState -> LockState
    $cmax :: LockState -> LockState -> LockState
    >= :: LockState -> LockState -> Bool
    $c>= :: LockState -> LockState -> Bool
    > :: LockState -> LockState -> Bool
    $c> :: LockState -> LockState -> Bool
    <= :: LockState -> LockState -> Bool
    $c<= :: LockState -> LockState -> Bool
    < :: LockState -> LockState -> Bool
    $c< :: LockState -> LockState -> Bool
    compare :: LockState -> LockState -> Ordering
    $ccompare :: LockState -> LockState -> Ordering
    $cp1Ord :: Eq LockState
    Ord, ReadPrec [LockState]
    ReadPrec LockState
    Int -> ReadS LockState
    ReadS [LockState]
    (Int -> ReadS LockState)
    -> ReadS [LockState]
    -> ReadPrec LockState
    -> ReadPrec [LockState]
    -> Read LockState
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    readListPrec :: ReadPrec [LockState]
    $creadListPrec :: ReadPrec [LockState]
    readPrec :: ReadPrec LockState
    $creadPrec :: ReadPrec LockState
    readList :: ReadS [LockState]
    $creadList :: ReadS [LockState]
    readsPrec :: Int -> ReadS LockState
    $creadsPrec :: Int -> ReadS LockState
    Read, Int -> LockState -> ShowS
    [LockState] -> ShowS
    LockState -> String
    (Int -> LockState -> ShowS)
    -> (LockState -> String)
    -> ([LockState] -> ShowS)
    -> Show LockState
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [LockState] -> ShowS
    $cshowList :: [LockState] -> ShowS
    show :: LockState -> String
    $cshow :: LockState -> String
    showsPrec :: Int -> LockState -> ShowS
    $cshowsPrec :: Int -> LockState -> ShowS
    Show, Typeable)

    -- | Lock an 'AudioDevice' such that its associated callback will not be called
    -- until the device is unlocked.
    setAudioDeviceLocked :: MonadIO m => AudioDevice -> LockState -> m ()
    setAudioDeviceLocked :: AudioDevice -> LockState -> m ()
    setAudioDeviceLocked (AudioDevice d :: AudioDeviceID
    d) Locked = AudioDeviceID -> m ()
    forall (m :: * -> *). MonadIO m => AudioDeviceID -> m ()
    Raw.lockAudioDevice AudioDeviceID
    d
    setAudioDeviceLocked (AudioDevice d :: AudioDeviceID
    d) Unlocked = AudioDeviceID -> m ()
    forall (m :: * -> *). MonadIO m => AudioDeviceID -> m ()
    Raw.unlockAudioDevice AudioDeviceID
    d

    -- | Whether to allow an 'AudioDevice' to play sound or remain paused.
    data PlaybackState
      = Pause -- ^ Pause the 'AudioDevice', which will stop producing/capturing audio.
      | Play -- ^ Resume the 'AudioDevice'.
      deriving (PlaybackState
    PlaybackState -> PlaybackState -> Bounded PlaybackState
    forall a. a -> a -> Bounded a
    maxBound :: PlaybackState
    $cmaxBound :: PlaybackState
    minBound :: PlaybackState
    $cminBound :: PlaybackState
    Bounded, Int -> PlaybackState
    PlaybackState -> Int
    PlaybackState -> [PlaybackState]
    PlaybackState -> PlaybackState
    PlaybackState -> PlaybackState -> [PlaybackState]
    PlaybackState -> PlaybackState -> PlaybackState -> [PlaybackState]
    (PlaybackState -> PlaybackState)
    -> (PlaybackState -> PlaybackState)
    -> (Int -> PlaybackState)
    -> (PlaybackState -> Int)
    -> (PlaybackState -> [PlaybackState])
    -> (PlaybackState -> PlaybackState -> [PlaybackState])
    -> (PlaybackState -> PlaybackState -> [PlaybackState])
    -> (PlaybackState
        -> PlaybackState -> PlaybackState -> [PlaybackState])
    -> Enum PlaybackState
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    enumFromThenTo :: PlaybackState -> PlaybackState -> PlaybackState -> [PlaybackState]
    $cenumFromThenTo :: PlaybackState -> PlaybackState -> PlaybackState -> [PlaybackState]
    enumFromTo :: PlaybackState -> PlaybackState -> [PlaybackState]
    $cenumFromTo :: PlaybackState -> PlaybackState -> [PlaybackState]
    enumFromThen :: PlaybackState -> PlaybackState -> [PlaybackState]
    $cenumFromThen :: PlaybackState -> PlaybackState -> [PlaybackState]
    enumFrom :: PlaybackState -> [PlaybackState]
    $cenumFrom :: PlaybackState -> [PlaybackState]
    fromEnum :: PlaybackState -> Int
    $cfromEnum :: PlaybackState -> Int
    toEnum :: Int -> PlaybackState
    $ctoEnum :: Int -> PlaybackState
    pred :: PlaybackState -> PlaybackState
    $cpred :: PlaybackState -> PlaybackState
    succ :: PlaybackState -> PlaybackState
    $csucc :: PlaybackState -> PlaybackState
    Enum, PlaybackState -> PlaybackState -> Bool
    (PlaybackState -> PlaybackState -> Bool)
    -> (PlaybackState -> PlaybackState -> Bool) -> Eq PlaybackState
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: PlaybackState -> PlaybackState -> Bool
    $c/= :: PlaybackState -> PlaybackState -> Bool
    == :: PlaybackState -> PlaybackState -> Bool
    $c== :: PlaybackState -> PlaybackState -> Bool
    Eq, Eq PlaybackState
    Eq PlaybackState =>
    (PlaybackState -> PlaybackState -> Ordering)
    -> (PlaybackState -> PlaybackState -> Bool)
    -> (PlaybackState -> PlaybackState -> Bool)
    -> (PlaybackState -> PlaybackState -> Bool)
    -> (PlaybackState -> PlaybackState -> Bool)
    -> (PlaybackState -> PlaybackState -> PlaybackState)
    -> (PlaybackState -> PlaybackState -> PlaybackState)
    -> Ord PlaybackState
    PlaybackState -> PlaybackState -> Bool
    PlaybackState -> PlaybackState -> Ordering
    PlaybackState -> PlaybackState -> PlaybackState
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    min :: PlaybackState -> PlaybackState -> PlaybackState
    $cmin :: PlaybackState -> PlaybackState -> PlaybackState
    max :: PlaybackState -> PlaybackState -> PlaybackState
    $cmax :: PlaybackState -> PlaybackState -> PlaybackState
    >= :: PlaybackState -> PlaybackState -> Bool
    $c>= :: PlaybackState -> PlaybackState -> Bool
    > :: PlaybackState -> PlaybackState -> Bool
    $c> :: PlaybackState -> PlaybackState -> Bool
    <= :: PlaybackState -> PlaybackState -> Bool
    $c<= :: PlaybackState -> PlaybackState -> Bool
    < :: PlaybackState -> PlaybackState -> Bool
    $c< :: PlaybackState -> PlaybackState -> Bool
    compare :: PlaybackState -> PlaybackState -> Ordering
    $ccompare :: PlaybackState -> PlaybackState -> Ordering
    $cp1Ord :: Eq PlaybackState
    Ord, ReadPrec [PlaybackState]
    ReadPrec PlaybackState
    Int -> ReadS PlaybackState
    ReadS [PlaybackState]
    (Int -> ReadS PlaybackState)
    -> ReadS [PlaybackState]
    -> ReadPrec PlaybackState
    -> ReadPrec [PlaybackState]
    -> Read PlaybackState
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    readListPrec :: ReadPrec [PlaybackState]
    $creadListPrec :: ReadPrec [PlaybackState]
    readPrec :: ReadPrec PlaybackState
    $creadPrec :: ReadPrec PlaybackState
    readList :: ReadS [PlaybackState]
    $creadList :: ReadS [PlaybackState]
    readsPrec :: Int -> ReadS PlaybackState
    $creadsPrec :: Int -> ReadS PlaybackState
    Read, Typeable PlaybackState
    Constr
    DataType
    Typeable PlaybackState =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> PlaybackState -> c PlaybackState)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c PlaybackState)
    -> (PlaybackState -> Constr)
    -> (PlaybackState -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c PlaybackState))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c PlaybackState))
    -> ((forall b. Data b => b -> b) -> PlaybackState -> PlaybackState)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> PlaybackState -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> PlaybackState -> r)
    -> (forall u. (forall d. Data d => d -> u) -> PlaybackState -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> PlaybackState -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState)
    -> Data PlaybackState
    PlaybackState -> Constr
    PlaybackState -> DataType
    (forall b. Data b => b -> b) -> PlaybackState -> PlaybackState
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PlaybackState -> c PlaybackState
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PlaybackState
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> PlaybackState -> u
    forall u. (forall d. Data d => d -> u) -> PlaybackState -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PlaybackState -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PlaybackState -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PlaybackState
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PlaybackState -> c PlaybackState
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PlaybackState)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PlaybackState)
    $cPlay :: Constr
    $cPause :: Constr
    $tPlaybackState :: DataType
    gmapMo :: (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState
    gmapMp :: (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState
    gmapM :: (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PlaybackState -> m PlaybackState
    gmapQi :: Int -> (forall d. Data d => d -> u) -> PlaybackState -> u
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PlaybackState -> u
    gmapQ :: (forall d. Data d => d -> u) -> PlaybackState -> [u]
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> PlaybackState -> [u]
    gmapQr :: (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PlaybackState -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PlaybackState -> r
    gmapQl :: (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PlaybackState -> r
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PlaybackState -> r
    gmapT :: (forall b. Data b => b -> b) -> PlaybackState -> PlaybackState
    $cgmapT :: (forall b. Data b => b -> b) -> PlaybackState -> PlaybackState
    dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PlaybackState)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PlaybackState)
    dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c PlaybackState)
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PlaybackState)
    dataTypeOf :: PlaybackState -> DataType
    $cdataTypeOf :: PlaybackState -> DataType
    toConstr :: PlaybackState -> Constr
    $ctoConstr :: PlaybackState -> Constr
    gunfold :: (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PlaybackState
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PlaybackState
    gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PlaybackState -> c PlaybackState
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> PlaybackState -> c PlaybackState
    $cp1Data :: Typeable PlaybackState
    Data, (forall x. PlaybackState -> Rep PlaybackState x)
    -> (forall x. Rep PlaybackState x -> PlaybackState)
    -> Generic PlaybackState
    forall x. Rep PlaybackState x -> PlaybackState
    forall x. PlaybackState -> Rep PlaybackState x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cto :: forall x. Rep PlaybackState x -> PlaybackState
    $cfrom :: forall x. PlaybackState -> Rep PlaybackState x
    Generic, Int -> PlaybackState -> ShowS
    [PlaybackState] -> ShowS
    PlaybackState -> String
    (Int -> PlaybackState -> ShowS)
    -> (PlaybackState -> String)
    -> ([PlaybackState] -> ShowS)
    -> Show PlaybackState
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [PlaybackState] -> ShowS
    $cshowList :: [PlaybackState] -> ShowS
    show :: PlaybackState -> String
    $cshow :: PlaybackState -> String
    showsPrec :: Int -> PlaybackState -> ShowS
    $cshowsPrec :: Int -> PlaybackState -> ShowS
    Show, Typeable)

    -- | Change the playback state of an 'AudioDevice'.
    setAudioDevicePlaybackState :: MonadIO m => AudioDevice -> PlaybackState -> m ()
    setAudioDevicePlaybackState :: AudioDevice -> PlaybackState -> m ()
    setAudioDevicePlaybackState (AudioDevice d :: AudioDeviceID
    d) Pause = AudioDeviceID -> CInt -> m ()
    forall (m :: * -> *). MonadIO m => AudioDeviceID -> CInt -> m ()
    Raw.pauseAudioDevice AudioDeviceID
    d 1
    setAudioDevicePlaybackState (AudioDevice d :: AudioDeviceID
    d) Play = AudioDeviceID -> CInt -> m ()
    forall (m :: * -> *). MonadIO m => AudioDeviceID -> CInt -> m ()
    Raw.pauseAudioDevice AudioDeviceID
    d 0

    -- | Opened devices are always 'Playing' or 'Paused' in normal circumstances. A
    -- failing device may change its status to 'Stopped' at any time, and closing a
    -- device will progress to 'Stopped' too.
    data AudioDeviceStatus
      = Playing -- ^ The 'AudioDevice' is playing.
      | Paused -- ^ The 'AudioDevice' is paused.
      | Stopped -- ^ The 'AudioDevice' is stopped.
      deriving (AudioDeviceStatus
    AudioDeviceStatus -> AudioDeviceStatus -> Bounded AudioDeviceStatus
    forall a. a -> a -> Bounded a
    maxBound :: AudioDeviceStatus
    $cmaxBound :: AudioDeviceStatus
    minBound :: AudioDeviceStatus
    $cminBound :: AudioDeviceStatus
    Bounded, Int -> AudioDeviceStatus
    AudioDeviceStatus -> Int
    AudioDeviceStatus -> [AudioDeviceStatus]
    AudioDeviceStatus -> AudioDeviceStatus
    AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus]
    AudioDeviceStatus
    -> AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus]
    (AudioDeviceStatus -> AudioDeviceStatus)
    -> (AudioDeviceStatus -> AudioDeviceStatus)
    -> (Int -> AudioDeviceStatus)
    -> (AudioDeviceStatus -> Int)
    -> (AudioDeviceStatus -> [AudioDeviceStatus])
    -> (AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus])
    -> (AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus])
    -> (AudioDeviceStatus
        -> AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus])
    -> Enum AudioDeviceStatus
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    enumFromThenTo :: AudioDeviceStatus
    -> AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus]
    $cenumFromThenTo :: AudioDeviceStatus
    -> AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus]
    enumFromTo :: AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus]
    $cenumFromTo :: AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus]
    enumFromThen :: AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus]
    $cenumFromThen :: AudioDeviceStatus -> AudioDeviceStatus -> [AudioDeviceStatus]
    enumFrom :: AudioDeviceStatus -> [AudioDeviceStatus]
    $cenumFrom :: AudioDeviceStatus -> [AudioDeviceStatus]
    fromEnum :: AudioDeviceStatus -> Int
    $cfromEnum :: AudioDeviceStatus -> Int
    toEnum :: Int -> AudioDeviceStatus
    $ctoEnum :: Int -> AudioDeviceStatus
    pred :: AudioDeviceStatus -> AudioDeviceStatus
    $cpred :: AudioDeviceStatus -> AudioDeviceStatus
    succ :: AudioDeviceStatus -> AudioDeviceStatus
    $csucc :: AudioDeviceStatus -> AudioDeviceStatus
    Enum, AudioDeviceStatus -> AudioDeviceStatus -> Bool
    (AudioDeviceStatus -> AudioDeviceStatus -> Bool)
    -> (AudioDeviceStatus -> AudioDeviceStatus -> Bool)
    -> Eq AudioDeviceStatus
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    $c/= :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    == :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    $c== :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    Eq, Eq AudioDeviceStatus
    Eq AudioDeviceStatus =>
    (AudioDeviceStatus -> AudioDeviceStatus -> Ordering)
    -> (AudioDeviceStatus -> AudioDeviceStatus -> Bool)
    -> (AudioDeviceStatus -> AudioDeviceStatus -> Bool)
    -> (AudioDeviceStatus -> AudioDeviceStatus -> Bool)
    -> (AudioDeviceStatus -> AudioDeviceStatus -> Bool)
    -> (AudioDeviceStatus -> AudioDeviceStatus -> AudioDeviceStatus)
    -> (AudioDeviceStatus -> AudioDeviceStatus -> AudioDeviceStatus)
    -> Ord AudioDeviceStatus
    AudioDeviceStatus -> AudioDeviceStatus -> Bool
    AudioDeviceStatus -> AudioDeviceStatus -> Ordering
    AudioDeviceStatus -> AudioDeviceStatus -> AudioDeviceStatus
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    min :: AudioDeviceStatus -> AudioDeviceStatus -> AudioDeviceStatus
    $cmin :: AudioDeviceStatus -> AudioDeviceStatus -> AudioDeviceStatus
    max :: AudioDeviceStatus -> AudioDeviceStatus -> AudioDeviceStatus
    $cmax :: AudioDeviceStatus -> AudioDeviceStatus -> AudioDeviceStatus
    >= :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    $c>= :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    > :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    $c> :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    <= :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    $c<= :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    < :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    $c< :: AudioDeviceStatus -> AudioDeviceStatus -> Bool
    compare :: AudioDeviceStatus -> AudioDeviceStatus -> Ordering
    $ccompare :: AudioDeviceStatus -> AudioDeviceStatus -> Ordering
    $cp1Ord :: Eq AudioDeviceStatus
    Ord, ReadPrec [AudioDeviceStatus]
    ReadPrec AudioDeviceStatus
    Int -> ReadS AudioDeviceStatus
    ReadS [AudioDeviceStatus]
    (Int -> ReadS AudioDeviceStatus)
    -> ReadS [AudioDeviceStatus]
    -> ReadPrec AudioDeviceStatus
    -> ReadPrec [AudioDeviceStatus]
    -> Read AudioDeviceStatus
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    readListPrec :: ReadPrec [AudioDeviceStatus]
    $creadListPrec :: ReadPrec [AudioDeviceStatus]
    readPrec :: ReadPrec AudioDeviceStatus
    $creadPrec :: ReadPrec AudioDeviceStatus
    readList :: ReadS [AudioDeviceStatus]
    $creadList :: ReadS [AudioDeviceStatus]
    readsPrec :: Int -> ReadS AudioDeviceStatus
    $creadsPrec :: Int -> ReadS AudioDeviceStatus
    Read, Typeable AudioDeviceStatus
    Constr
    DataType
    Typeable AudioDeviceStatus =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g)
     -> AudioDeviceStatus
     -> c AudioDeviceStatus)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c AudioDeviceStatus)
    -> (AudioDeviceStatus -> Constr)
    -> (AudioDeviceStatus -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c AudioDeviceStatus))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c AudioDeviceStatus))
    -> ((forall b. Data b => b -> b)
        -> AudioDeviceStatus -> AudioDeviceStatus)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> AudioDeviceStatus -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> AudioDeviceStatus -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> AudioDeviceStatus -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> AudioDeviceStatus -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> AudioDeviceStatus -> m AudioDeviceStatus)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> AudioDeviceStatus -> m AudioDeviceStatus)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> AudioDeviceStatus -> m AudioDeviceStatus)
    -> Data AudioDeviceStatus
    AudioDeviceStatus -> Constr
    AudioDeviceStatus -> DataType
    (forall b. Data b => b -> b)
    -> AudioDeviceStatus -> AudioDeviceStatus
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AudioDeviceStatus -> c AudioDeviceStatus
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AudioDeviceStatus
    forall a.
    Typeable a =>
    (forall (c :: * -> *).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: * -> *).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: * -> *) (c :: * -> *).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: * -> * -> *) (c :: * -> *).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: * -> *).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: * -> *).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u.
    Int -> (forall d. Data d => d -> u) -> AudioDeviceStatus -> u
    forall u. (forall d. Data d => d -> u) -> AudioDeviceStatus -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceStatus -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceStatus -> r
    forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceStatus -> m AudioDeviceStatus
    forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceStatus -> m AudioDeviceStatus
    forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AudioDeviceStatus
    forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AudioDeviceStatus -> c AudioDeviceStatus
    forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AudioDeviceStatus)
    forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c AudioDeviceStatus)
    $cStopped :: Constr
    $cPaused :: Constr
    $cPlaying :: Constr
    $tAudioDeviceStatus :: DataType
    gmapMo :: (forall d. Data d => d -> m d)
    -> AudioDeviceStatus -> m AudioDeviceStatus
    $cgmapMo :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceStatus -> m AudioDeviceStatus
    gmapMp :: (forall d. Data d => d -> m d)
    -> AudioDeviceStatus -> m AudioDeviceStatus
    $cgmapMp :: forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceStatus -> m AudioDeviceStatus
    gmapM :: (forall d. Data d => d -> m d)
    -> AudioDeviceStatus -> m AudioDeviceStatus
    $cgmapM :: forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> AudioDeviceStatus -> m AudioDeviceStatus
    gmapQi :: Int -> (forall d. Data d => d -> u) -> AudioDeviceStatus -> u
    $cgmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> AudioDeviceStatus -> u
    gmapQ :: (forall d. Data d => d -> u) -> AudioDeviceStatus -> [u]
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> AudioDeviceStatus -> [u]
    gmapQr :: (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceStatus -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceStatus -> r
    gmapQl :: (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceStatus -> r
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> AudioDeviceStatus -> r
    gmapT :: (forall b. Data b => b -> b)
    -> AudioDeviceStatus -> AudioDeviceStatus
    $cgmapT :: (forall b. Data b => b -> b)
    -> AudioDeviceStatus -> AudioDeviceStatus
    dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c AudioDeviceStatus)
    $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c AudioDeviceStatus)
    dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c AudioDeviceStatus)
    $cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c AudioDeviceStatus)
    dataTypeOf :: AudioDeviceStatus -> DataType
    $cdataTypeOf :: AudioDeviceStatus -> DataType
    toConstr :: AudioDeviceStatus -> Constr
    $ctoConstr :: AudioDeviceStatus -> Constr
    gunfold :: (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AudioDeviceStatus
    $cgunfold :: forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c AudioDeviceStatus
    gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AudioDeviceStatus -> c AudioDeviceStatus
    $cgfoldl :: forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> AudioDeviceStatus -> c AudioDeviceStatus
    $cp1Data :: Typeable AudioDeviceStatus
    Data, (forall x. AudioDeviceStatus -> Rep AudioDeviceStatus x)
    -> (forall x. Rep AudioDeviceStatus x -> AudioDeviceStatus)
    -> Generic AudioDeviceStatus
    forall x. Rep AudioDeviceStatus x -> AudioDeviceStatus
    forall x. AudioDeviceStatus -> Rep AudioDeviceStatus x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cto :: forall x. Rep AudioDeviceStatus x -> AudioDeviceStatus
    $cfrom :: forall x. AudioDeviceStatus -> Rep AudioDeviceStatus x
    Generic, Int -> AudioDeviceStatus -> ShowS
    [AudioDeviceStatus] -> ShowS
    AudioDeviceStatus -> String
    (Int -> AudioDeviceStatus -> ShowS)
    -> (AudioDeviceStatus -> String)
    -> ([AudioDeviceStatus] -> ShowS)
    -> Show AudioDeviceStatus
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [AudioDeviceStatus] -> ShowS
    $cshowList :: [AudioDeviceStatus] -> ShowS
    show :: AudioDeviceStatus -> String
    $cshow :: AudioDeviceStatus -> String
    showsPrec :: Int -> AudioDeviceStatus -> ShowS
    $cshowsPrec :: Int -> AudioDeviceStatus -> ShowS
    Show, Typeable)

    -- | Query the state of an 'AudioDevice'.
    audioDeviceStatus :: MonadIO m => AudioDevice -> m AudioDeviceStatus
    audioDeviceStatus :: AudioDevice -> m AudioDeviceStatus
    audioDeviceStatus (AudioDevice d :: AudioDeviceID
    d) = IO AudioDeviceStatus -> m AudioDeviceStatus
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO AudioDeviceStatus -> m AudioDeviceStatus)
    -> IO AudioDeviceStatus -> m AudioDeviceStatus
    forall a b. (a -> b) -> a -> b
    $
      Text
    -> Text
    -> (AudioDeviceID -> Maybe AudioDeviceStatus)
    -> AudioDeviceID
    -> AudioDeviceStatus
    forall a b. Show a => Text -> Text -> (a -> Maybe b) -> a -> b
    fromC "SDL.Audio.audioDeviceStatus" "SDL_AudioStatus" AudioDeviceID -> Maybe AudioDeviceStatus
    readStatus (AudioDeviceID -> AudioDeviceStatus)
    -> IO AudioDeviceID -> IO AudioDeviceStatus
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> AudioDeviceID -> IO AudioDeviceID
    forall (m :: * -> *). MonadIO m => AudioDeviceID -> m AudioDeviceID
    Raw.getAudioDeviceStatus AudioDeviceID
    d
      where
      readStatus :: AudioDeviceID -> Maybe AudioDeviceStatus
    readStatus n :: AudioDeviceID
    n = case AudioDeviceID
    n of
        Raw.SDL_AUDIO_PLAYING -> AudioDeviceStatus -> Maybe AudioDeviceStatus
    forall a. a -> Maybe a
    Just AudioDeviceStatus
    Playing
        Raw.SDL_AUDIO_STOPPED -> AudioDeviceStatus -> Maybe AudioDeviceStatus
    forall a. a -> Maybe a
    Just AudioDeviceStatus
    Stopped
        Raw.SDL_AUDIO_PAUSED -> AudioDeviceStatus -> Maybe AudioDeviceStatus
    forall a. a -> Maybe a
    Just AudioDeviceStatus
    Paused
        _ -> Maybe AudioDeviceStatus
    forall a. Maybe a
    Nothing

    -- clearQueuedAudio :: AudioDevice -> IO ()
    -- clearQueuedAudio (AudioDevice d) = Raw.clearQueuedAudio d

    -- | An abstract description of an audio driver on the host machine.
    newtype AudioDriver = AudioDriver Text
      deriving (AudioDriver -> AudioDriver -> Bool
    (AudioDriver -> AudioDriver -> Bool)
    -> (AudioDriver -> AudioDriver -> Bool) -> Eq AudioDriver
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: AudioDriver -> AudioDriver -> Bool
    $c/= :: AudioDriver -> AudioDriver -> Bool
    == :: AudioDriver -> AudioDriver -> Bool
    $c== :: AudioDriver -> AudioDriver -> Bool
    Eq, Int -> AudioDriver -> ShowS
    [AudioDriver] -> ShowS
    AudioDriver -> String
    (Int -> AudioDriver -> ShowS)
    -> (AudioDriver -> String)
    -> ([AudioDriver] -> ShowS)
    -> Show AudioDriver
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    showList :: [AudioDriver] -> ShowS
    $cshowList :: [AudioDriver] -> ShowS
    show :: AudioDriver -> String
    $cshow :: AudioDriver -> String
    showsPrec :: Int -> AudioDriver -> ShowS
    $cshowsPrec :: Int -> AudioDriver -> ShowS
    Show, Typeable)

    -- | Get the human readable name of an 'AudioDriver'
    audioDriverName :: AudioDriver -> Text
    audioDriverName :: AudioDriver -> Text
    audioDriverName (AudioDriver t :: Text
    t) = Text
    t

    -- | Obtain a list of all possible audio drivers for this system. These drivers
    -- can be used to specificially initialize the audio system.
    getAudioDrivers :: MonadIO m => m (V.Vector AudioDriver)
    getAudioDrivers :: m (Vector AudioDriver)
    getAudioDrivers = IO (Vector AudioDriver) -> m (Vector AudioDriver)
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Vector AudioDriver) -> m (Vector AudioDriver))
    -> IO (Vector AudioDriver) -> m (Vector AudioDriver)
    forall a b. (a -> b) -> a -> b
    $ do
      CInt
    n <- IO CInt
    forall (m :: * -> *). MonadIO m => m CInt
    Raw.getNumAudioDrivers
      ([AudioDriver] -> Vector AudioDriver)
    -> IO [AudioDriver] -> IO (Vector AudioDriver)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [AudioDriver] -> Vector AudioDriver
    forall a. [a] -> Vector a
    V.fromList (IO [AudioDriver] -> IO (Vector AudioDriver))
    -> IO [AudioDriver] -> IO (Vector AudioDriver)
    forall a b. (a -> b) -> a -> b
    $
        [CInt] -> (CInt -> IO AudioDriver) -> IO [AudioDriver]
    forall (t :: * -> *) (f :: * -> *) a b.
    (Traversable t, Applicative f) =>
    t a -> (a -> f b) -> f (t b)
    for [0 .. (CInt
    n CInt -> CInt -> CInt
    forall a. Num a => a -> a -> a
    - 1)] ((CInt -> IO AudioDriver) -> IO [AudioDriver])
    -> (CInt -> IO AudioDriver) -> IO [AudioDriver]
    forall a b. (a -> b) -> a -> b
    $ \i :: CInt
    i -> do
          -- TODO This could return null if i is invalid, but it's not an SDL_Error.
          Ptr CChar
    cstr <- CInt -> IO (Ptr CChar)
    forall (m :: * -> *). MonadIO m => CInt -> m (Ptr CChar)
    Raw.getAudioDriver CInt
    i
          Text -> AudioDriver
    AudioDriver (Text -> AudioDriver)
    -> (ByteString -> Text) -> ByteString -> AudioDriver
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> Text
    Text.decodeUtf8 (ByteString -> AudioDriver) -> IO ByteString -> IO AudioDriver
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Ptr CChar -> IO ByteString
    BS.packCString Ptr CChar
    cstr

    -- | Explicitly initialize the audio system against a specific
    -- 'AudioDriver'. Note that most users will not need to do this, as the normal
    -- initialization routines will already take care of this for you.
    audioInit :: MonadIO m => AudioDriver -> m ()
    audioInit :: AudioDriver -> m ()
    audioInit (AudioDriver n :: Text
    n) = IO () -> m ()
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ ByteString -> (Ptr CChar -> IO ()) -> IO ()
    forall a. ByteString -> (Ptr CChar -> IO a) -> IO a
    BS.useAsCString (Text -> ByteString
    Text.encodeUtf8 Text
    n) ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $
      Text -> Text -> IO CInt -> IO ()
    forall (m :: * -> *) a.
    (MonadIO m, Num a, Ord a) =>
    Text -> Text -> m a -> m ()
    throwIfNeg_ "SDL.Audio.audioInit" "SDL_AudioInit" (IO CInt -> IO ()) -> (Ptr CChar -> IO CInt) -> Ptr CChar -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Ptr CChar -> IO CInt
    forall (m :: * -> *). MonadIO m => Ptr CChar -> m CInt
    Raw.audioInit

    -- | Query SDL for the name of the currently initialized audio driver, if
    -- possible. This will return 'Nothing' if no driver has been initialized.
    currentAudioDriver :: MonadIO m => m (Maybe Text)
    currentAudioDriver :: m (Maybe Text)
    currentAudioDriver =
      IO (Maybe Text) -> m (Maybe Text)
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Maybe Text) -> m (Maybe Text))
    -> IO (Maybe Text) -> m (Maybe Text)
    forall a b. (a -> b) -> a -> b
    $ (Ptr CChar -> IO Text) -> Ptr CChar -> IO (Maybe Text)
    forall a b. (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
    maybePeek ((ByteString -> Text) -> IO ByteString -> IO Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ByteString -> Text
    Text.decodeUtf8 (IO ByteString -> IO Text)
    -> (Ptr CChar -> IO ByteString) -> Ptr CChar -> IO Text
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Ptr CChar -> IO ByteString
    BS.packCString) (Ptr CChar -> IO (Maybe Text)) -> IO (Ptr CChar) -> IO (Maybe Text)
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< IO (Ptr CChar)
    forall (m :: * -> *). MonadIO m => m (Ptr CChar)
    Raw.getCurrentAudioDriver