Module

WAGS.Control.Functions

Package
purescript-wags
Repository
mikesol/purescript-wags

#start Source

start :: forall audio engine res. Monoid res => AudioInterpret audio engine => InitialWAG audio engine res Unit

The initial Frame that is needed to begin any Scene.

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

#istart Source

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

#modifyRes Source

modifyRes :: forall audio engine proof res i a. AudioInterpret audio engine => (res -> res) -> WAG audio engine proof res i a -> WAG audio engine proof res i res

Modifies the residual for a frame and returns the result. If a frame never modifies its residual, the value of mempty for res is returned to the scene.

#imodifyRes Source

imodifyRes :: forall audio engine proof res i. AudioInterpret audio engine => (res -> res) -> IxWAG audio engine proof res i i res

Modifies the residual for a frame and returns the result. If a frame never modifies its residual, the value of mempty for res is returned to the scene.

#makeScene Source

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

Make a scene. The infix operator for this operation is @>.

It accepts as arguments:

  • a frame to render
  • a function that accepts a frame from the next moment in time (proofB) and returns a scene.

From these arguments, it produces a Scene.


#makeSceneFlipped Source

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

#makeSceneR Source

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

Similar to makeScene, but without the possibility to branch to a new scene. Aliased as @|>.

#makeSceneRFlipped Source

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

#makeSceneR' Source

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

Similar to makeSceneR', but without the possibility to consult an env. Aliased as @||>.

#makeSceneR'Flipped Source

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

#loop Source

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

Loops audio.

The first argument is the loop and the second argument is the incoming graph that gets rendered before the loop. This means that all changes applied in the loop must be separately applied to the incoming frame if they are relevant.


#iloop Source

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

#branch Source

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

Accepts a "branch" frame for making a scene, where Left is a new scene and Right is the current scene looped.

#ibranch Source

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

#icont Source

icont :: forall env audio engine proof res graphi grapho a b. Monoid res => AudioInterpret audio engine => (WAG audio engine proof res (Record grapho) b -> Scene env audio engine proof res) -> IxWAG audio engine proof res (Record graphi) (Record grapho) b -> WAG audio engine proof res (Record graphi) a -> Scene env audio engine proof res

#freeze Source

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

Freezes the current audio frame.

#(@>) Source

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

#(@!>) Source

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

#(@|>) Source

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

#(@||>) Source

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

#(<@) Source

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

#(<|@) Source

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

#(<||@) Source

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