mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-13 12:28:47 +00:00
Merge pull request #1159 from jdanford/update-standardized-audio-context
Update standardized-audio-context, fix little lint errors
This commit is contained in:
commit
47d464487e
11 changed files with 73 additions and 72 deletions
|
@ -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"],
|
||||
|
|
|
@ -103,7 +103,7 @@ export class Meter extends MeterBase<MeterOptions> {
|
|||
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) {
|
||||
|
|
|
@ -200,7 +200,7 @@ export class TickSource<TypeName extends "bpm" | "hertz"> 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<TypeName extends "bpm" | "hertz"> 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 };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 !== "";
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Type extends number = Hertz> extends TimeClass<Type,
|
|||
//-------------------------------------
|
||||
|
||||
/**
|
||||
* Note to scale index.
|
||||
* Note to scale index.
|
||||
* @hidden
|
||||
*/
|
||||
const noteToScaleIndex = {
|
||||
|
|
|
@ -15,8 +15,8 @@ describe("Chorus", () => {
|
|||
() => {
|
||||
const chorus = new Chorus().toDestination().start();
|
||||
const osc = new Oscillator(220, "sawtooth")
|
||||
.connect(chorus)
|
||||
.start();
|
||||
.connect(chorus)
|
||||
.start();
|
||||
},
|
||||
"chorus.wav",
|
||||
0.25
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
|
88
package-lock.json
generated
88
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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": {
|
||||
|
|
Loading…
Reference in a new issue