Skip to content

Commit

Permalink
Changes definition of isOn to on and offOn (#40)
Browse files Browse the repository at this point in the history
* Changes definition of isOn to on and offOn

* Fixes oo
  • Loading branch information
Mike Solomon authored Jan 3, 2022
1 parent 6be7f70 commit d60dbb2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 20 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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.6.6",
"version": "0.6.7",
"description": "Web Audio Graphs as a Stream",
"scripts": {
"build": "spago build",
Expand Down
41 changes: 22 additions & 19 deletions src/WAGS/Interpret.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
};
};
};
Expand Down Expand Up @@ -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);
};
};
};
Expand Down Expand Up @@ -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);
};
};
};
Expand Down Expand Up @@ -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);
};
};
};
Expand Down Expand Up @@ -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);
};
};
};
Expand Down Expand Up @@ -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);
};
};
};
Expand Down Expand Up @@ -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);
};
};
};
Expand Down Expand Up @@ -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);
};
};
};
Expand Down Expand Up @@ -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);
};
};
};
Expand Down

0 comments on commit d60dbb2

Please sign in to comment.