diff --git a/CHANGELOG.md b/CHANGELOG.md index 403599bd..11ffd69e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ 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.6.7] - 2022-01-03 + +### Fixed + +- Changes the definition of `isOn` to both `on` and `offOn`, smoothing out the switching on of buffers and oscillators. + +## [0.6.6] - 2022-01-02 + +### Added + +- Simplifies rendering algorithm in `Run.purs`. + ## [0.6.5] - 2022-01-02 ### Added diff --git a/package.json b/package.json index 0d8306cf..de8fcdd6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "purescript-wags", - "version": "0.6.6", + "version": "0.6.7", "description": "Web Audio Graphs as a Stream", "scripts": { "build": "spago build", diff --git a/src/WAGS/Interpret.js b/src/WAGS/Interpret.js index 77cd9e7d..eb2e6711 100644 --- a/src/WAGS/Interpret.js +++ b/src/WAGS/Interpret.js @@ -11,7 +11,10 @@ exports.contextResume = function (audioCtx) { return audioCtx.resume(); }; }; -function makeid(length) { +var isOn = function(param) { + return param === "on" || param === "offOn"; +} +var makeid = function(length) { var result = ""; var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; @@ -328,10 +331,10 @@ exports.makeConstant_ = function (ptr) { main: createFunction(), }; applyResumeClosure(state.units[ptr]); - if (onOff.param === "on") { + if (isOn(onOff.param)) { state.units[ptr].main.start(state.writeHead + onOff.timeOffset); } - state.units[ptr].onOff = onOff.param === "on"; + state.units[ptr].onOff = isOn(onOff.param); }; }; }; @@ -503,14 +506,14 @@ exports.makeLoopBuf_ = function (ptr) { }, main: createFunction(), }; - if (onOff.param === "on") { + if (isOn(onOff.param)) { applyResumeClosure(state.units[ptr]); state.units[ptr].main.start( state.writeHead + onOff.timeOffset, c ); } - state.units[ptr].onOff = onOff.param === "on"; + state.units[ptr].onOff = isOn(onOff.param); }; }; }; @@ -667,10 +670,10 @@ exports.makePeriodicOsc_ = function (ptr) { main: createFunction(), }; applyResumeClosure(state.units[ptr]); - if (onOff.param === "on") { + if (isOn(onOff.param)) { state.units[ptr].main.start(state.writeHead + onOff.timeOffset); } - state.units[ptr].onOff = onOff.param === "on"; + state.units[ptr].onOff = isOn(onOff.param); }; }; }; @@ -704,10 +707,10 @@ exports.makePeriodicOscV_ = function (ptr) { main: createFunction(), }; applyResumeClosure(state.units[ptr]); - if (onOff.param === "on") { + if (isOn(onOff.param)) { state.units[ptr].main.start(state.writeHead + onOff.timeOffset); } - state.units[ptr].onOff = onOff.param === "on"; + state.units[ptr].onOff = isOn(onOff.param); }; }; }; @@ -907,14 +910,14 @@ exports.makePlayBuf_ = function (ptr) { }, main: createFunction(), }; - if (onOff.param === "on") { + if (isOn(onOff.param)) { applyResumeClosure(state.units[ptr]); state.units[ptr].main.start( state.writeHead + onOff.timeOffset, b ); } - state.units[ptr].onOff = onOff.param === "on"; + state.units[ptr].onOff = isOn(onOff.param); }; }; }; @@ -983,10 +986,10 @@ exports.makeSawtoothOsc_ = function (ptr) { main: createFunction(), }; applyResumeClosure(state.units[ptr]); - if (onOff.param === "on") { + if (isOn(onOff.param)) { state.units[ptr].main.start(state.writeHead + onOff.timeOffset); } - state.units[ptr].onOff = onOff.param === "on"; + state.units[ptr].onOff = isOn(onOff.param); }; }; }; @@ -1014,10 +1017,10 @@ exports.makeSinOsc_ = function (ptr) { main: createFunction(), }; applyResumeClosure(state.units[ptr]); - if (onOff.param === "on") { + if (isOn(onOff.param)) { state.units[ptr].main.start(state.writeHead + onOff.timeOffset); } - state.units[ptr].onOff = onOff.param === "on"; + state.units[ptr].onOff = isOn(onOff.param); }; }; }; @@ -1056,10 +1059,10 @@ exports.makeSquareOsc_ = function (ptr) { main: createFunction(), }; applyResumeClosure(state.units[ptr]); - if (onOff.param === "on") { + if (isOn(onOff.param)) { state.units[ptr].main.start(state.writeHead + onOff.timeOffset); } - state.units[ptr].onOff = onOff.param === "on"; + state.units[ptr].onOff = isOn(onOff.param); }; }; }; @@ -1101,10 +1104,10 @@ exports.makeTriangleOsc_ = function (ptr) { main: createFunction(), }; applyResumeClosure(state.units[ptr]); - if (onOff.param === "on") { + if (isOn(onOff.param)) { state.units[ptr].main.start(state.writeHead + onOff.timeOffset); } - state.units[ptr].onOff = onOff.param === "on"; + state.units[ptr].onOff = isOn(onOff.param); }; }; };