module JSDOM.Generated.AudioBuffer
(getChannelData, getChannelData_, getLength, getDuration,
getSampleRate, setGain, getGain, getNumberOfChannels,
AudioBuffer(..), gTypeAudioBuffer)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName)
import JSDOM.Enums
getChannelData ::
(MonadDOM m) => AudioBuffer -> Word -> m Float32Array
getChannelData self channelIndex
= liftDOM
((self ^. jsf "getChannelData" [toJSVal channelIndex]) >>=
fromJSValUnchecked)
getChannelData_ :: (MonadDOM m) => AudioBuffer -> Word -> m ()
getChannelData_ self channelIndex
= liftDOM
(void (self ^. jsf "getChannelData" [toJSVal channelIndex]))
getLength :: (MonadDOM m) => AudioBuffer -> m Int
getLength self
= liftDOM (round <$> ((self ^. js "length") >>= valToNumber))
getDuration :: (MonadDOM m) => AudioBuffer -> m Float
getDuration self
= liftDOM
(realToFrac <$> ((self ^. js "duration") >>= valToNumber))
getSampleRate :: (MonadDOM m) => AudioBuffer -> m Float
getSampleRate self
= liftDOM
(realToFrac <$> ((self ^. js "sampleRate") >>= valToNumber))
setGain :: (MonadDOM m) => AudioBuffer -> Float -> m ()
setGain self val = liftDOM (self ^. jss "gain" (toJSVal val))
getGain :: (MonadDOM m) => AudioBuffer -> m Float
getGain self
= liftDOM (realToFrac <$> ((self ^. js "gain") >>= valToNumber))
getNumberOfChannels :: (MonadDOM m) => AudioBuffer -> m Word
getNumberOfChannels self
= liftDOM
(round <$> ((self ^. js "numberOfChannels") >>= valToNumber))