From de4dd28ff3a8fa7a2cebde3018566e8437d7028b Mon Sep 17 00:00:00 2001 From: Jordan Danford Date: Thu, 26 Jan 2023 11:31:38 -0700 Subject: [PATCH] Update standardized-audio-context, fix little lint errors --- .eslintrc.cjs | 2 +- Tone/component/analysis/Meter.ts | 2 +- Tone/core/clock/TickSource.ts | 4 +- Tone/core/clock/Ticker.ts | 2 +- Tone/core/context/ToneAudioBuffer.ts | 10 ++-- Tone/core/type/Frequency.ts | 3 +- Tone/effect/Chorus.test.ts | 4 +- Tone/fromContext.ts | 2 +- Tone/source/buffer/Player.test.ts | 26 ++++---- package-lock.json | 88 ++++++++++++++-------------- package.json | 2 +- 11 files changed, 73 insertions(+), 72 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 7f9ff7887..ecff3d69a 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -5,7 +5,7 @@ module.exports = { rules: { "prefer-rest-params": "off", "@typescript-eslint/ban-ts-ignore": "off", - "@typescript-eslint/ban-ts-comment" : "off", + "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/no-empty-function": "off", "jsdoc/check-alignment": 1, "jsdoc/check-param-names": ["error"], diff --git a/Tone/component/analysis/Meter.ts b/Tone/component/analysis/Meter.ts index d87b0ac4c..2709c0744 100644 --- a/Tone/component/analysis/Meter.ts +++ b/Tone/component/analysis/Meter.ts @@ -103,7 +103,7 @@ export class Meter extends MeterBase { const rms = Math.sqrt(totalSquared / values.length); // the rms can only fall at the rate of the smoothing // but can jump up instantly - this._rms[index] = Math.max(rms, this._rms[index] * this.smoothing); + this._rms[index] = Math.max(rms, this._rms[index] * this.smoothing); return this.normalRange ? this._rms[index] : gainToDb(this._rms[index]); }); if (this.channels === 1) { diff --git a/Tone/core/clock/TickSource.ts b/Tone/core/clock/TickSource.ts index bd9506604..223f5e839 100644 --- a/Tone/core/clock/TickSource.ts +++ b/Tone/core/clock/TickSource.ts @@ -200,7 +200,7 @@ export class TickSource extends ToneWithContex if (lastState.state === "started" && e.state !== "started") { elapsedTicks += this.frequency.getTicksAtTime(e.time) - this.frequency.getTicksAtTime(periodStartTime); // do not memoize the temporary event - if (e.time != tmpEvent.time) { + if (e.time !== tmpEvent.time) { eventToMemoize = { state: e.state, time: e.time, ticks: elapsedTicks }; } } @@ -275,7 +275,7 @@ export class TickSource extends ToneWithContex if (lastState.state === "started" && e.state !== "started") { elapsedSeconds += e.time - periodStartTime; // do not memoize the temporary event - if (e.time != tmpEvent.time) { + if (e.time !== tmpEvent.time) { eventToMemoize = { state: e.state, time: e.time, seconds: elapsedSeconds }; } } diff --git a/Tone/core/clock/Ticker.ts b/Tone/core/clock/Ticker.ts index 108abd52c..51b97410b 100644 --- a/Tone/core/clock/Ticker.ts +++ b/Tone/core/clock/Ticker.ts @@ -42,7 +42,7 @@ export class Ticker { this._callback = callback; this._type = type; - this._minimumUpdateInterval = Math.max( 128/(contextSampleRate || 44100), .001 ); + this._minimumUpdateInterval = Math.max(128/(contextSampleRate || 44100), .001); this.updateInterval = updateInterval; // create the clock source for the first time diff --git a/Tone/core/context/ToneAudioBuffer.ts b/Tone/core/context/ToneAudioBuffer.ts index b2914a9ac..a471167cb 100644 --- a/Tone/core/context/ToneAudioBuffer.ts +++ b/Tone/core/context/ToneAudioBuffer.ts @@ -397,9 +397,9 @@ export class ToneAudioBuffer extends Tone { const location = document.createElement("a"); location.href = baseUrl + url; location.pathname = (location.pathname + location.hash) - .split("/") - .map(encodeURIComponent) - .join("/"); + .split("/") + .map(encodeURIComponent) + .join("/"); const response = await fetch(location.href); if (!response.ok) { @@ -425,8 +425,8 @@ export class ToneAudioBuffer extends Tone { const extensions = url.split("."); const extension = extensions[extensions.length - 1]; const response = document - .createElement("audio") - .canPlayType("audio/" + extension); + .createElement("audio") + .canPlayType("audio/" + extension); return response !== ""; } diff --git a/Tone/core/type/Frequency.ts b/Tone/core/type/Frequency.ts index 9d28af3e3..8d0fd85e3 100644 --- a/Tone/core/type/Frequency.ts +++ b/Tone/core/type/Frequency.ts @@ -1,3 +1,4 @@ +/* eslint-disable key-spacing */ import { getContext } from "../Global"; import { intervalToFrequencyRatio, mtof } from "./Conversions"; import { ftom, getA4, setA4 } from "./Conversions"; @@ -215,7 +216,7 @@ export class FrequencyClass extends TimeClass { () => { const chorus = new Chorus().toDestination().start(); const osc = new Oscillator(220, "sawtooth") - .connect(chorus) - .start(); + .connect(chorus) + .start(); }, "chorus.wav", 0.25 diff --git a/Tone/fromContext.ts b/Tone/fromContext.ts index ce9dcdb4d..df72a91e8 100644 --- a/Tone/fromContext.ts +++ b/Tone/fromContext.ts @@ -32,7 +32,7 @@ type ToneObject = { * Bind the TimeBaseClass to the context */ function bindTypeClass(context: Context, type) { - return (...args: any[]) => new type(context, ...args); + return (...args: unknown[]) => new type(context, ...args); } /** diff --git a/Tone/source/buffer/Player.test.ts b/Tone/source/buffer/Player.test.ts index a69ed8f74..d23a8c8a1 100644 --- a/Tone/source/buffer/Player.test.ts +++ b/Tone/source/buffer/Player.test.ts @@ -502,9 +502,9 @@ describe("Player", () => { const player = new Player(buffer); player.toDestination(); player - .start(0, 0, 0.05) - .start(0.1, 0, 0.05) - .start(0.2, 0, 0.05); + .start(0, 0, 0.05) + .start(0.1, 0, 0.05) + .start(0.2, 0, 0.05); player.stop(0.1); }, 0.3).then((buff) => { expect(buff.getTimeOfLastSound()).to.be.closeTo(0.1, 0.02); @@ -559,9 +559,9 @@ describe("Player", () => { it("plays synced to the Transport", () => { return Offline(({ transport }) => { const player = new Player(buffer) - .sync() - .start(0) - .toDestination(); + .sync() + .start(0) + .toDestination(); transport.start(0); }, 0.05).then((buff) => { expect(buff.isSilent()).to.be.false; @@ -587,13 +587,13 @@ describe("Player", () => { it("offsets correctly when started by the Transport", () => { const testSample = buffer.toArray(0)[ - Math.floor(0.13125 * getContext().sampleRate) + Math.floor(0.13125 * getContext().sampleRate) ]; return Offline(({ transport }) => { const player = new Player(buffer) - .sync() - .start(0, 0.1) - .toDestination(); + .sync() + .start(0, 0.1) + .toDestination(); transport.start(0, 0.03125); }, 0.05).then((buff) => { expect(buff.toArray()[0][0]).to.equal(testSample); @@ -709,12 +709,12 @@ describe("Player", () => { setTimeout(() => { player.restart(undefined, undefined, 1); const checkStopTimes = new Set(); - player["_activeSources"].forEach(source => { - checkStopTimes.add(source["_stopTime"]); + player._activeSources.forEach(source => { + checkStopTimes.add(source._stopTime); }); getContext().lookAhead = originalLookAhead; // ensure each source has a different stopTime - expect(checkStopTimes.size).to.equal(player["_activeSources"].size); + expect(checkStopTimes.size).to.equal(player._activeSources.size); done(); }, 250); }, diff --git a/package-lock.json b/package-lock.json index 61a897a4b..7b99789da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "14.8.0", "license": "MIT", "dependencies": { - "standardized-audio-context": "^25.3.29", + "standardized-audio-context": "^25.3.37", "tslib": "^2.3.1" }, "devDependencies": { @@ -417,20 +417,20 @@ } }, "node_modules/@babel/runtime": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.9.tgz", - "integrity": "sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw==", + "version": "7.20.13", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz", + "integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==", "dependencies": { - "regenerator-runtime": "^0.13.4" + "regenerator-runtime": "^0.13.11" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/runtime/node_modules/regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" }, "node_modules/@babel/template": { "version": "7.18.10", @@ -1544,15 +1544,15 @@ "dev": true }, "node_modules/automation-events": { - "version": "4.0.20", - "resolved": "https://registry.npmjs.org/automation-events/-/automation-events-4.0.20.tgz", - "integrity": "sha512-ALTOLrB4vTyXOsLPia8OKM1qZKtlsGC+3VDe3jcCGUpvgKTbqlzvaJU3HqDhU6jlVEMMBqT01XZv3K/3Z5g29w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/automation-events/-/automation-events-5.0.0.tgz", + "integrity": "sha512-SkYa2YBwgRUJNsR5v6GxeJwP5IGnYtOMW37coplTOWMUpDYYrk5j8gGOhYa765rchRln/HssFzMAck/2P6zTFw==", "dependencies": { - "@babel/runtime": "^7.18.9", - "tslib": "^2.4.0" + "@babel/runtime": "^7.20.7", + "tslib": "^2.4.1" }, "engines": { - "node": ">=12.20.1" + "node": ">=14.15.4" } }, "node_modules/available-typed-arrays": { @@ -8780,13 +8780,13 @@ "dev": true }, "node_modules/standardized-audio-context": { - "version": "25.3.29", - "resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.29.tgz", - "integrity": "sha512-5RqrvuaphiR3W2t8nd8PRBhQKXTTf0gHu8I0BukH3A11C9ZHQQmeE9WywBe68TcYBj9DCm42db8OWTw1PluLUA==", + "version": "25.3.37", + "resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.37.tgz", + "integrity": "sha512-lr0+RH/IJXYMts95oYKIJ+orTmstOZN3GXWVGmlkbMj8OLahREkRh7DhNGLYgBGDkBkhhc4ev5pYGSFN3gltHw==", "dependencies": { - "@babel/runtime": "^7.18.9", - "automation-events": "^4.0.20", - "tslib": "^2.4.0" + "@babel/runtime": "^7.20.7", + "automation-events": "^5.0.0", + "tslib": "^2.4.1" } }, "node_modules/statuses": { @@ -9427,9 +9427,9 @@ } }, "node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, "node_modules/tsutils": { "version": "3.21.0", @@ -10650,17 +10650,17 @@ "dev": true }, "@babel/runtime": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.9.tgz", - "integrity": "sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw==", + "version": "7.20.13", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz", + "integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==", "requires": { - "regenerator-runtime": "^0.13.4" + "regenerator-runtime": "^0.13.11" }, "dependencies": { "regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" } } }, @@ -11552,12 +11552,12 @@ "dev": true }, "automation-events": { - "version": "4.0.20", - "resolved": "https://registry.npmjs.org/automation-events/-/automation-events-4.0.20.tgz", - "integrity": "sha512-ALTOLrB4vTyXOsLPia8OKM1qZKtlsGC+3VDe3jcCGUpvgKTbqlzvaJU3HqDhU6jlVEMMBqT01XZv3K/3Z5g29w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/automation-events/-/automation-events-5.0.0.tgz", + "integrity": "sha512-SkYa2YBwgRUJNsR5v6GxeJwP5IGnYtOMW37coplTOWMUpDYYrk5j8gGOhYa765rchRln/HssFzMAck/2P6zTFw==", "requires": { - "@babel/runtime": "^7.18.9", - "tslib": "^2.4.0" + "@babel/runtime": "^7.20.7", + "tslib": "^2.4.1" } }, "available-typed-arrays": { @@ -17292,13 +17292,13 @@ "dev": true }, "standardized-audio-context": { - "version": "25.3.29", - "resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.29.tgz", - "integrity": "sha512-5RqrvuaphiR3W2t8nd8PRBhQKXTTf0gHu8I0BukH3A11C9ZHQQmeE9WywBe68TcYBj9DCm42db8OWTw1PluLUA==", + "version": "25.3.37", + "resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.37.tgz", + "integrity": "sha512-lr0+RH/IJXYMts95oYKIJ+orTmstOZN3GXWVGmlkbMj8OLahREkRh7DhNGLYgBGDkBkhhc4ev5pYGSFN3gltHw==", "requires": { - "@babel/runtime": "^7.18.9", - "automation-events": "^4.0.20", - "tslib": "^2.4.0" + "@babel/runtime": "^7.20.7", + "automation-events": "^5.0.0", + "tslib": "^2.4.1" } }, "statuses": { @@ -17781,9 +17781,9 @@ } }, "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, "tsutils": { "version": "3.21.0", diff --git a/package.json b/package.json index 9e312d4ec..7596e1908 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "yargs": "^17.3.0" }, "dependencies": { - "standardized-audio-context": "^25.3.29", + "standardized-audio-context": "^25.3.37", "tslib": "^2.3.1" }, "prettier": {