Skip to content

Commit

Permalink
Bumps version
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Solomon committed Jul 8, 2021
1 parent 9240a4a commit e36cb5b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.9] - 2021-08-07

### Added

- `startUsingWithHint` allows the quick bootstrapping of audio graphs at the beginning of a scene for instances where a fully-determined graph type is not present but a term or function producing that graph is.

## [0.3.8] - 2021-08-07

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "purescript-wags",
"version": "0.3.8",
"version": "0.3.9",
"description": "Web Audio Graphs as a Stream",
"scripts": {
"build": "spago build",
Expand Down
32 changes: 29 additions & 3 deletions src/WAGS/Control/Functions.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module WAGS.Control.Functions
( start
, istart
, startUsing
, startUsingWithHint
, modifyRes
, imodifyRes
, makeScene
Expand All @@ -23,14 +24,15 @@ module WAGS.Control.Functions
, (<@)
, (<|@)
, (<||@)
, class GraphHint
) where

import Prelude

import Control.Comonad (extract)
import Data.Either (Either(..))
import WAGS.Control.Indexed (IxWAG(..), IxFrame)
import WAGS.Control.Types (AudioState', EFrame, Frame, Frame0, InitialWAG, Scene(..), Scene', WAG, oneFrame, unsafeUnWAG, unsafeWAG)
import WAGS.CreateT (class CreateT)
import WAGS.Interpret (class AudioInterpret)
import WAGS.Patch (class Patch, ipatch)

Expand Down Expand Up @@ -133,11 +135,35 @@ startUsing ::
AudioInterpret audio engine =>
Patch () graph =>
control ->
(forall proofA. WAG audio engine proofA res { | graph } control ->
Scene env audio engine proofA res) ->
( forall proofA.
WAG audio engine proofA res { | graph } control ->
Scene env audio engine proofA res
) ->
Scene env audio engine Frame0 res
startUsing control next = const (ipatch $> control) @!> next

class GraphHint (i :: Type) (o :: Row Type) | i -> o

instance graphHintRec :: GraphHint { | o } o

instance graphHintF :: GraphHint x o => GraphHint (y -> x) o

startUsingWithHint ::
forall env audio engine res hintable hint graph control.
Monoid res =>
AudioInterpret audio engine =>
GraphHint hintable hint =>
CreateT hint () graph =>
Patch () graph =>
hintable ->
control ->
( forall proofA.
WAG audio engine proofA res { | graph } control ->
Scene env audio engine proofA res
) ->
Scene env audio engine Frame0 res
startUsingWithHint hint control next = const (ipatch $> control) @!> next

-- | Loops audio.
-- |
-- | The first argument is the loop and the second argument is the incoming graph that gets rendered before the loop.
Expand Down
20 changes: 20 additions & 0 deletions src/WAGS/Control/Functions/Validated.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module WAGS.Control.Functions.Validated
, makeSceneR'
, makeSceneR'Flipped
, startUsing
, startUsingWithHint
, loop
, iloop
, branch
Expand All @@ -25,9 +26,11 @@ module WAGS.Control.Functions.Validated
import Prelude

import Data.Either (Either)
import WAGS.Control.Functions (class GraphHint)
import WAGS.Control.Functions as Functions
import WAGS.Control.Indexed (IxWAG, IxFrame)
import WAGS.Control.Types (EFrame, Frame, Frame0, Scene, WAG)
import WAGS.CreateT (class CreateT)
import WAGS.Interpret (class AudioInterpret)
import WAGS.Patch (class Patch)
import WAGS.Validation (class GraphIsRenderable)
Expand Down Expand Up @@ -161,6 +164,23 @@ startUsing ::
Scene env audio engine Frame0 res
startUsing = Functions.startUsing

startUsingWithHint ::
forall env audio engine res hintable hint graph control.
Monoid res =>
AudioInterpret audio engine =>
GraphIsRenderable graph =>
GraphHint hintable hint =>
CreateT hint () graph =>
Patch () graph =>
hintable ->
control ->
( forall proofA.
WAG audio engine proofA res { | graph } control ->
Scene env audio engine proofA res
) ->
Scene env audio engine Frame0 res
startUsingWithHint = Functions.startUsingWithHint

freeze ::
forall env audio engine proof res graph x.
Monoid res =>
Expand Down

0 comments on commit e36cb5b

Please sign in to comment.