packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/AudioNodeOptions.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webaudio-1.1 (webref). Do not edit.
module JSDOM.Generated.AudioNodeOptions
       (newAudioNodeOptions, setChannelCount, getChannelCount, getChannelCountUnsafe, getChannelCountUnchecked, setChannelCountMode, getChannelCountMode, getChannelCountModeUnsafe, getChannelCountModeUnchecked, setChannelInterpretation, getChannelInterpretation, getChannelInterpretationUnsafe, getChannelInterpretationUnchecked, AudioNodeOptions(..), gTypeAudioNodeOptions, IsAudioNodeOptions, toAudioNodeOptions)
       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://webaudio.github.io/web-audio-api/#AudioNodeOptions AudioNodeOptions specification>
newAudioNodeOptions :: (MonadDOM m) => m AudioNodeOptions
newAudioNodeOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelcount AudioNodeOptions.channelCount specification>
setChannelCount :: (MonadDOM m, IsAudioNodeOptions self) => self -> Word -> m ()
setChannelCount self val = liftDOM (void ((Types.toAudioNodeOptions self) ^. jss "channelCount" (toJSVal val)))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelcount AudioNodeOptions.channelCount specification>
getChannelCount :: (MonadDOM m, IsAudioNodeOptions self) => self -> m (Maybe Word)
getChannelCount self = liftDOM ((((Types.toAudioNodeOptions self) ^. js "channelCount") >>= fromJSValUnchecked))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelcount AudioNodeOptions.channelCount specification>
getChannelCountUnsafe :: (MonadDOM m, IsAudioNodeOptions self, HasCallStack) => self -> m Word
getChannelCountUnsafe self = liftDOM (((((Types.toAudioNodeOptions self) ^. js "channelCount") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelcount AudioNodeOptions.channelCount specification>
getChannelCountUnchecked :: (MonadDOM m, IsAudioNodeOptions self) => self -> m Word
getChannelCountUnchecked self = liftDOM ((P.round <$> (((Types.toAudioNodeOptions self) ^. js "channelCount") >>= valToNumber)))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelcountmode AudioNodeOptions.channelCountMode specification>
setChannelCountMode :: (MonadDOM m, IsAudioNodeOptions self) => self -> ChannelCountMode -> m ()
setChannelCountMode self val = liftDOM (void ((Types.toAudioNodeOptions self) ^. jss "channelCountMode" (toJSVal val)))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelcountmode AudioNodeOptions.channelCountMode specification>
getChannelCountMode :: (MonadDOM m, IsAudioNodeOptions self) => self -> m (Maybe ChannelCountMode)
getChannelCountMode self = liftDOM ((((Types.toAudioNodeOptions self) ^. js "channelCountMode") >>= fromJSValUnchecked))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelcountmode AudioNodeOptions.channelCountMode specification>
getChannelCountModeUnsafe :: (MonadDOM m, IsAudioNodeOptions self, HasCallStack) => self -> m ChannelCountMode
getChannelCountModeUnsafe self = liftDOM (((((Types.toAudioNodeOptions self) ^. js "channelCountMode") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelcountmode AudioNodeOptions.channelCountMode specification>
getChannelCountModeUnchecked :: (MonadDOM m, IsAudioNodeOptions self) => self -> m ChannelCountMode
getChannelCountModeUnchecked self = liftDOM ((((Types.toAudioNodeOptions self) ^. js "channelCountMode") >>= fromJSValUnchecked))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelinterpretation AudioNodeOptions.channelInterpretation specification>
setChannelInterpretation :: (MonadDOM m, IsAudioNodeOptions self) => self -> ChannelInterpretation -> m ()
setChannelInterpretation self val = liftDOM (void ((Types.toAudioNodeOptions self) ^. jss "channelInterpretation" (toJSVal val)))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelinterpretation AudioNodeOptions.channelInterpretation specification>
getChannelInterpretation :: (MonadDOM m, IsAudioNodeOptions self) => self -> m (Maybe ChannelInterpretation)
getChannelInterpretation self = liftDOM ((((Types.toAudioNodeOptions self) ^. js "channelInterpretation") >>= fromJSValUnchecked))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelinterpretation AudioNodeOptions.channelInterpretation specification>
getChannelInterpretationUnsafe :: (MonadDOM m, IsAudioNodeOptions self, HasCallStack) => self -> m ChannelInterpretation
getChannelInterpretationUnsafe self = liftDOM (((((Types.toAudioNodeOptions self) ^. js "channelInterpretation") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://webaudio.github.io/web-audio-api/#dom-audionodeoptions-channelinterpretation AudioNodeOptions.channelInterpretation specification>
getChannelInterpretationUnchecked :: (MonadDOM m, IsAudioNodeOptions self) => self -> m ChannelInterpretation
getChannelInterpretationUnchecked self = liftDOM ((((Types.toAudioNodeOptions self) ^. js "channelInterpretation") >>= fromJSValUnchecked))