Module

WAGS.Control.Functions.Validated

Package
purescript-wags
Repository
mikesol/purescript-wags

These functions uses the GraphIsRenderable typeclass to assert that an audio graph is renderable by the web audio engine. This means, amongst other things, that it has a unique output device (ie speaker), that it does not have any dangling units not connected to a loudspeaker, etc.

#makeScene Source

makeScene :: forall env audio engine proofA res graph a. Monoid res => AudioInterpret audio engine => GraphIsRenderable graph => EFrame env audio engine proofA res (Record graph) a -> (forall proofB. WAG audio engine proofB res (Record graph) a -> Scene env audio engine proofB res) -> Scene env audio engine proofA res

#makeSceneFlipped Source

makeSceneFlipped :: forall env audio engine proofA res graph a. Monoid res => AudioInterpret audio engine => GraphIsRenderable graph => (forall proofB. WAG audio engine proofB res (Record graph) a -> Scene env audio engine proofB res) -> EFrame env audio engine proofA res (Record graph) a -> Scene env audio engine proofA res

#makeSceneR Source

makeSceneR :: forall env audio engine proofA res graph a. Monoid res => GraphIsRenderable graph => AudioInterpret audio engine => Frame env audio engine proofA res (Record graph) a -> (forall proofB. WAG audio engine proofB res (Record graph) a -> Scene env audio engine proofB res) -> Scene env audio engine proofA res

#makeSceneRFlipped Source

makeSceneRFlipped :: forall env audio engine proofA res graph a. Monoid res => GraphIsRenderable graph => AudioInterpret audio engine => (forall proofB. WAG audio engine proofB res (Record graph) a -> Scene env audio engine proofB res) -> Frame env audio engine proofA res (Record graph) a -> Scene env audio engine proofA res

#makeSceneR' Source

makeSceneR' :: forall env audio engine proofA res graph a. Monoid res => GraphIsRenderable graph => AudioInterpret audio engine => WAG audio engine proofA res (Record graph) a -> (forall proofB. WAG audio engine proofB res (Record graph) a -> Scene env audio engine proofB res) -> Scene env audio engine proofA res

#makeSceneR'Flipped Source

makeSceneR'Flipped :: forall env audio engine proofA res graph a. Monoid res => GraphIsRenderable graph => AudioInterpret audio engine => (forall proofB. WAG audio engine proofB res (Record graph) a -> Scene env audio engine proofB res) -> WAG audio engine proofA res (Record graph) a -> Scene env audio engine proofA res

#loop Source

loop :: forall env audio engine proofA res graph a. Monoid res => GraphIsRenderable graph => AudioInterpret audio engine => (forall proofB. WAG audio engine proofB res (Record graph) a -> Frame env audio engine proofB res (Record graph) a) -> WAG audio engine proofA res (Record graph) a -> Scene env audio engine proofA res

Loops audio.

In WAGS, a "loop" is a universe whose changeBit increments by 1. That means that the structure of the graph is similar (no units added, none taken away) while some or none of its internal content (ie frequencies, gains, etc) has changed. This is accomplished using the change family of functions in WAGS.Change.

piece :: Scene (SceneI Unit Unit) FFIAudio (Effect Unit) Frame0
piece =
  WAGS.do
    start -- initial frame
    { time } <- env
    create (scene time) $> Right unit
    @> loop -- we loop by changing the scene based on `time` in the `env`
        ( const
            $ WAGS.do
                { time } <- env
                ivoid $ change (scene time)
        )

#iloop Source

iloop :: forall env audio engine proofA res graph a. Monoid res => GraphIsRenderable graph => AudioInterpret audio engine => (forall proofB. env -> a -> IxWAG audio engine proofB res (Record graph) (Record graph) a) -> WAG audio engine proofA res (Record graph) a -> Scene env audio engine proofA res

#branch Source

branch :: forall env audio engine proofA res graph a. Monoid res => GraphIsRenderable graph => AudioInterpret audio engine => (forall proofB. WAG audio engine proofB res (Record graph) a -> EFrame env audio engine proofB res (Record graph) a) -> WAG audio engine proofA res (Record graph) a -> Scene env audio engine proofA res

#ibranch Source

ibranch :: forall env audio engine proofA res graph a. Monoid res => GraphIsRenderable graph => AudioInterpret audio engine => (forall proofB. env -> a -> Either (WAG audio engine proofB res (Record graph) a -> Scene env audio engine proofB res) (IxWAG audio engine proofB res (Record graph) (Record graph) a)) -> WAG audio engine proofA res (Record graph) a -> Scene env audio engine proofA res

#istart Source

istart :: forall env audio engine res graph a. GraphIsRenderable graph => Monoid res => AudioInterpret audio engine => IxFrame env audio engine Frame0 res (Record ()) (Record graph) a -> (forall proofB. WAG audio engine proofB res (Record graph) a -> Scene env audio engine proofB res) -> Scene env audio engine Frame0 res

#freeze Source

freeze :: forall env audio engine proof res graph x. Monoid res => GraphIsRenderable graph => AudioInterpret audio engine => WAG audio engine proof res (Record graph) x -> Scene env audio engine proof res

#(@>) Source

Operator alias for WAGS.Control.Functions.Validated.makeScene (right-associative / precedence 6)

#(@!>) Source

Operator alias for WAGS.Control.Functions.Validated.istart (right-associative / precedence 6)

#(@|>) Source

Operator alias for WAGS.Control.Functions.Validated.makeSceneR (right-associative / precedence 6)

#(@||>) Source

Operator alias for WAGS.Control.Functions.Validated.makeSceneR' (right-associative / precedence 6)

#(<@) Source

Operator alias for WAGS.Control.Functions.Validated.makeSceneFlipped (right-associative / precedence 6)

#(<|@) Source

Operator alias for WAGS.Control.Functions.Validated.makeSceneRFlipped (right-associative / precedence 6)

#(<||@) Source

Operator alias for WAGS.Control.Functions.Validated.makeSceneR'Flipped (right-associative / precedence 6)