musicw 0.3.5.2 → 0.3.6
raw patch · 2 files changed
+23/−2 lines, 2 files
Files
- musicw.cabal +2/−2
- src/Sound/MusicW/Worklets.hs +21/−0
musicw.cabal view
@@ -1,7 +1,7 @@ name: musicw-version: 0.3.5.2+version: 0.3.6 synopsis: Sound synthesis library, to be used with GHCJS and Web Audio API-description: A library for sound synthesis, currently targeting GHCJS and the Web Audio API. Used in the Inner Ear and Estuary projects.+description: A library for sound synthesis, currently targeting GHCJS and the Web Audio API. Used by Inner Ear, Estuary, Punctual and possibly other projects. homepage: https://github.com/dktr0/musicw/blob/master/README.md license: BSD3 license-file: LICENSE
src/Sound/MusicW/Worklets.hs view
@@ -62,6 +62,9 @@ floorWorklet :: AudioIO m => NodeRef -> SynthDef m NodeRef floorWorklet x = audioWorklet "floor-processor" [x] +ceilWorklet :: AudioIO m => NodeRef -> SynthDef m NodeRef+ceilWorklet x = audioWorklet "ceil-processor" [x]+ fractWorklet :: AudioIO m => NodeRef -> SynthDef m NodeRef fractWorklet x = audioWorklet "fract-processor" [x] @@ -446,6 +449,24 @@ \ }\ \ }\ \ registerProcessor('floor-processor',FloorProcessor);\+\ \+\ class CeilProcessor extends AudioWorkletProcessor {\+\ constructor() { super(); this.notStarted = true; }\+\ process(inputs,outputs,parameters) {\+\ const input = inputs[0];\+\ const output = outputs[0];\+\ const blockSize = 128;\+\ const hasInput = !(input[0] === undefined);\+\ if(hasInput){\+\ this.notStarted = false;\+\ for(let n=0; n<blockSize;n++){\+\ output[0][n] = Math.ceil(input[0][n]);\+\ }\+\ }\+\ return (this.notStarted || hasInput);\+\ }\+\ }\+\ registerProcessor('ceil-processor',CeilProcessor);\ \ \ \ class FractProcessor extends AudioWorkletProcessor {\ \ constructor() { super(); this.notStarted = true; }\