Module

WAGS.Rebase

Package
purescript-wags
Repository
mikesol/purescript-wags

#Rebase' Source

class Rebase' plA plB rbp pA ptrA graphA pB ptrB graphB  where

Members

Instances

#RebaseCheck' Source

class RebaseCheck' plA plB rbp pA ptrA graphA pB ptrB graphB  where

Members

Instances

#RebaseCont' Source

class RebaseCont' foundA foundB xpA xpB plA plB rbp pA ptrA graphA pB ptrB graphB  where

Members

Instances

#rebase Source

rebase :: forall env audio engine proof m res changeBit skolems edgeA idxA graphA edgeB idxB graphB. BinToInt idxA => BinToInt idxB => Monad m => AudioInterpret audio engine => TerminalIdentityEdge graphA edgeA => TerminalIdentityEdge graphB edgeB => Rebase' PtrListNil PtrListNil RebaseProof edgeA idxA graphA edgeB idxB graphB => Proxy idxA -> Proxy graphA -> Proxy idxB -> Proxy graphB -> FrameT env audio engine proof m res (UniverseC idxA graphA changeBit skolems) (UniverseC idxB graphB changeBit skolems) Unit

Rebase an Universe from iA to iB.

Rebasing is used when you have an audio graph that goes through a series of mutations and winds up in the same state as before but with different pointers to audio nodes. For example, if you remove a node and add a node back in the same place with the same content, the universe will be semantically equivalent to the previous one but the type will be different because the pointers are different. Rebasing takes the type from the output and "resets" it to the input.

As an example, imagine that you have a function that mutates an audio graph through the following stages:

  • TSpeaker D0 (TSinOsc D1 /\ TSinOsc D2 /\ Unit)
  • TSpeaker D0 (TSinOsc D2 /\ Unit)
  • TSpeaker D0 (TSinOsc D3 /\ TSinOsc D2 /\ Unit)

In this case, the output graph is topologically similar to the input graph, but a function that accepts the input type of TSpeaker D0 (TSinOsc D1 /\ TSinOsc D2 /\ Unit) would not accept the input type of TSpeaker D0 (TSinOsc D3 /\ TSinOsc D2 /\ Unit) because D3 is not the same type as D1. In this instance, rebase will reset the output type back to the input type. If the rebase operation is attempted on graphs that are not topologically equivalent, a compile-time error will occur.

Rebasing is useful if you want to call a function recursively. In that case, the input type needs to be the same each time the function is called, and rebase brings an audio graph back to the original type when possible.

Rebasing only makes sense for functions that need to accommodate different loops. In the case of simpler loops, a similar effect can be achieved by making pointers polymorphic, ie forall ptr. TSpeaker D0 (TSinOsc ptr /\ TSinOsc D2 /\ Unit).

#reset Source

reset :: forall i1 g1. Proxy i1 -> Proxy g1 -> ResetSig i1 g1

Rebase the current audio graph to index i1 and graph g1.

#ResetSig Source

type ResetSig i1 g1 = forall env audio engine proof m res cb e0 i0 g0 e1. BinToInt i0 => BinToInt i1 => Monad m => AudioInterpret audio engine => TerminalIdentityEdge g0 e0 => TerminalIdentityEdge g1 e1 => Rebase' PtrListNil PtrListNil RebaseProof e0 i0 g0 e1 i1 g1 => FrameT env audio engine proof m res (UniverseC i0 g0 cb SkolemListNil) (UniverseC i1 g1 cb SkolemListNil) Unit

Signature for the reset operation for index i1 and graph g1.

#RebaseProof Source

data RebaseProof

Instances