jsaddle-dom-0.10.0.0: src/JSDOM/Generated/AudioDataCopyToOptions.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webcodecs (webref). Do not edit.
module JSDOM.Generated.AudioDataCopyToOptions
(newAudioDataCopyToOptions, setPlaneIndex, getPlaneIndex, setFrameOffset, getFrameOffset, getFrameOffsetUnsafe, getFrameOffsetUnchecked, setFrameCount, getFrameCount, getFrameCountUnsafe, getFrameCountUnchecked, setFormat, getFormat, getFormatUnsafe, getFormatUnchecked, AudioDataCopyToOptions(..), gTypeAudioDataCopyToOptions)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums
-- | <https://w3c.github.io/webcodecs/#dictdef-audiodatacopytooptions AudioDataCopyToOptions specification>
newAudioDataCopyToOptions :: (MonadDOM m) => Word -> m AudioDataCopyToOptions
newAudioDataCopyToOptions planeIndex = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "planeIndex" (toJSVal planeIndex)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-planeindex AudioDataCopyToOptions.planeIndex specification>
setPlaneIndex :: (MonadDOM m) => AudioDataCopyToOptions -> Word -> m ()
setPlaneIndex self val = liftDOM (void (self ^. jss "planeIndex" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-planeindex AudioDataCopyToOptions.planeIndex specification>
getPlaneIndex :: (MonadDOM m) => AudioDataCopyToOptions -> m Word
getPlaneIndex self = liftDOM ((P.round <$> ((self ^. js "planeIndex") >>= valToNumber)))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-frameoffset AudioDataCopyToOptions.frameOffset specification>
setFrameOffset :: (MonadDOM m) => AudioDataCopyToOptions -> Word -> m ()
setFrameOffset self val = liftDOM (void (self ^. jss "frameOffset" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-frameoffset AudioDataCopyToOptions.frameOffset specification>
getFrameOffset :: (MonadDOM m) => AudioDataCopyToOptions -> m (Maybe Word)
getFrameOffset self = liftDOM (((self ^. js "frameOffset") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-frameoffset AudioDataCopyToOptions.frameOffset specification>
getFrameOffsetUnsafe :: (MonadDOM m, HasCallStack) => AudioDataCopyToOptions -> m Word
getFrameOffsetUnsafe self = liftDOM ((((self ^. js "frameOffset") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-frameoffset AudioDataCopyToOptions.frameOffset specification>
getFrameOffsetUnchecked :: (MonadDOM m) => AudioDataCopyToOptions -> m Word
getFrameOffsetUnchecked self = liftDOM ((P.round <$> ((self ^. js "frameOffset") >>= valToNumber)))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-framecount AudioDataCopyToOptions.frameCount specification>
setFrameCount :: (MonadDOM m) => AudioDataCopyToOptions -> Word -> m ()
setFrameCount self val = liftDOM (void (self ^. jss "frameCount" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-framecount AudioDataCopyToOptions.frameCount specification>
getFrameCount :: (MonadDOM m) => AudioDataCopyToOptions -> m (Maybe Word)
getFrameCount self = liftDOM (((self ^. js "frameCount") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-framecount AudioDataCopyToOptions.frameCount specification>
getFrameCountUnsafe :: (MonadDOM m, HasCallStack) => AudioDataCopyToOptions -> m Word
getFrameCountUnsafe self = liftDOM ((((self ^. js "frameCount") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-framecount AudioDataCopyToOptions.frameCount specification>
getFrameCountUnchecked :: (MonadDOM m) => AudioDataCopyToOptions -> m Word
getFrameCountUnchecked self = liftDOM ((P.round <$> ((self ^. js "frameCount") >>= valToNumber)))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-format AudioDataCopyToOptions.format specification>
setFormat :: (MonadDOM m) => AudioDataCopyToOptions -> AudioSampleFormat -> m ()
setFormat self val = liftDOM (void (self ^. jss "format" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-format AudioDataCopyToOptions.format specification>
getFormat :: (MonadDOM m) => AudioDataCopyToOptions -> m (Maybe AudioSampleFormat)
getFormat self = liftDOM (((self ^. js "format") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-format AudioDataCopyToOptions.format specification>
getFormatUnsafe :: (MonadDOM m, HasCallStack) => AudioDataCopyToOptions -> m AudioSampleFormat
getFormatUnsafe self = liftDOM ((((self ^. js "format") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webcodecs/#dom-audiodatacopytooptions-format AudioDataCopyToOptions.format specification>
getFormatUnchecked :: (MonadDOM m) => AudioDataCopyToOptions -> m AudioSampleFormat
getFormatUnchecked self = liftDOM (((self ^. js "format") >>= fromJSValUnchecked))