jsaddle-dom-0.10.0.0: src/JSDOM/Generated/WaveShaperOptions.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.WaveShaperOptions
(newWaveShaperOptions, setCurve, getCurve, getCurveUnsafe, getCurveUnchecked, setOversample, getOversample, getOversampleUnsafe, getOversampleUnchecked, WaveShaperOptions(..), gTypeWaveShaperOptions)
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/#WaveShaperOptions WaveShaperOptions specification>
newWaveShaperOptions :: (MonadDOM m) => m WaveShaperOptions
newWaveShaperOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-audio-api/#dom-waveshaperoptions-curve WaveShaperOptions.curve specification>
setCurve :: (MonadDOM m) => WaveShaperOptions -> [Float] -> m ()
setCurve self val = liftDOM (void (self ^. jss "curve" (toJSVal val)))
-- | <https://webaudio.github.io/web-audio-api/#dom-waveshaperoptions-curve WaveShaperOptions.curve specification>
getCurve :: (MonadDOM m) => WaveShaperOptions -> m (Maybe [Float])
getCurve self = liftDOM (((self ^. js "curve") >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-audio-api/#dom-waveshaperoptions-curve WaveShaperOptions.curve specification>
getCurveUnsafe :: (MonadDOM m, HasCallStack) => WaveShaperOptions -> m [Float]
getCurveUnsafe self = liftDOM ((((self ^. js "curve") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://webaudio.github.io/web-audio-api/#dom-waveshaperoptions-curve WaveShaperOptions.curve specification>
getCurveUnchecked :: (MonadDOM m) => WaveShaperOptions -> m [Float]
getCurveUnchecked self = liftDOM (((self ^. js "curve") >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-audio-api/#dom-waveshaperoptions-oversample WaveShaperOptions.oversample specification>
setOversample :: (MonadDOM m) => WaveShaperOptions -> OverSampleType -> m ()
setOversample self val = liftDOM (void (self ^. jss "oversample" (toJSVal val)))
-- | <https://webaudio.github.io/web-audio-api/#dom-waveshaperoptions-oversample WaveShaperOptions.oversample specification>
getOversample :: (MonadDOM m) => WaveShaperOptions -> m (Maybe OverSampleType)
getOversample self = liftDOM (((self ^. js "oversample") >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-audio-api/#dom-waveshaperoptions-oversample WaveShaperOptions.oversample specification>
getOversampleUnsafe :: (MonadDOM m, HasCallStack) => WaveShaperOptions -> m OverSampleType
getOversampleUnsafe self = liftDOM ((((self ^. js "oversample") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://webaudio.github.io/web-audio-api/#dom-waveshaperoptions-oversample WaveShaperOptions.oversample specification>
getOversampleUnchecked :: (MonadDOM m) => WaveShaperOptions -> m OverSampleType
getOversampleUnchecked self = liftDOM (((self ^. js "oversample") >>= fromJSValUnchecked))