Skip to content

Commit

Permalink
Bumps version
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Solomon committed Sep 12, 2021
1 parent 0f5ddab commit 489e190
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ jobs:
run: npx spago -x test.dhall build
- name: Spago build examples
run: npx spago -x examples.dhall build
- name: Spago build cheatsheet
run: npx spago -x cheatsheet.dhall build
- name: Spago test
run: npx spago -x test.dhall test
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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.4.6] - 2021-09-12

### Fixed

- All generators are now disconnected only after stopping, avoiding abrupt disconnects and pops.

## [0.4.5] - 2021-09-11

### Fixed
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.4.5",
"version": "0.4.6",
"description": "Web Audio Graphs as a Stream",
"scripts": {
"build": "spago build",
Expand Down
49 changes: 30 additions & 19 deletions src/WAGS/Interpret.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ exports.setAnalyserNodeCb_ = function (ptr) {
return function (a) {
return function (state) {
return function () {
if (state.units[ptr].analyserOrig === a) {return;}
if (state.units[ptr].analyserOrig === a) { return; }
// first, unsubscribe
state.units[ptr].analyser && state.units[ptr].analyser();
state.units[ptr].analyser = a(state.units[ptr].se)();
Expand Down Expand Up @@ -456,8 +456,8 @@ exports.makeLowshelf_ = function (ptr) {
};
};
exports.makeMicrophone_ = function (microphone) {
return function(state) {
return function () {
return function (state) {
return function () {
state.units["microphone"] = {
main: state.context.createMediaStreamSource(microphone),
outgoing: [],
Expand Down Expand Up @@ -676,7 +676,7 @@ exports.setMediaRecorderCb_ = function (ptr) {
return function (a) {
return function (state) {
return function () {
if (state.units[ptr].recorderOrig === a) {return;}
if (state.units[ptr].recorderOrig === a) { return; }
state.units[ptr].recorder && state.units[ptr].recorder.stop();
var mediaRecorderSideEffectFn = a;
state.units[ptr].recorderOrig = a;
Expand Down Expand Up @@ -965,18 +965,29 @@ var setOff_ = function (ptr) {
return;
}
state.units[ptr].onOff = false;
state.units[ptr].main.stop(state.writeHead + onOffInstr.timeOffset);
for (var i = 0; i < state.units[ptr].outgoing.length; i++) {
state.units[ptr].main.disconnect(
state.units[state.units[ptr].outgoing[i]].main
);
if (state.units[state.units[ptr].outgoing[i]].se) {
state.units[ptr].main.disconnect(
state.units[state.units[ptr].outgoing[i]].se
);
var oldMain = state.units[ptr].main;
var oldOutgoing = state.units[ptr].outgoing.slice();
oldMain.stop(state.writeHead + onOffInstr.timeOffset);
// defer disconnection until stop has happened
setTimeout(() => {
for (var i = 0; i < oldOutgoing.length; i++) {
try {
oldMain.disconnect(
state.units[oldOutgoing[i]].main
);
if (state.units[oldOutgoing[i]].se) {
oldMain.disconnect(
state.units[oldOutgoing[i]].se
);
}
} catch (e) {
console.log(e);
// fail silently, as it means the unit is no longer available, but
// as we are disconnecting it doesn't matter
continue;
}
}
}
delete state.units[ptr].main;
}, 1000.0 * (state.writeHead + onOffInstr.timeOffset + 0.2 - state.context.currentTime));
state.units[ptr].main = state.units[ptr].createFunction();
for (var i = 0; i < state.units[ptr].outgoing.length; i++) {
state.units[ptr].main.connect(
Expand Down Expand Up @@ -1404,7 +1415,7 @@ exports.getByteFrequencyData = function (analyserNode) {
return dataArray;
}
}
exports.bufferSampleRate = function(buffer) { return buffer.sampleRate }
exports.bufferLength = function(buffer) { return buffer.length }
exports.bufferDuration = function(buffer) { return buffer.duration }
exports.bufferNumberOfChannels = function(buffer) { return buffer.numberOfChannels }
exports.bufferSampleRate = function (buffer) { return buffer.sampleRate }
exports.bufferLength = function (buffer) { return buffer.length }
exports.bufferDuration = function (buffer) { return buffer.duration }
exports.bufferNumberOfChannels = function (buffer) { return buffer.numberOfChannels }

0 comments on commit 489e190

Please sign in to comment.