From d30c43d9c688f147a5c2ca678da5fd4f1fe24817 Mon Sep 17 00:00:00 2001 From: DIVYANSHU RAJ <43696525+endurance21@users.noreply.github.com> Date: Thu, 16 Jul 2020 13:17:37 +0530 Subject: [PATCH] fetching latest p5.js code from npm (#501) * fetching latest p5.js code from npm --- package-lock.json | 5 ++++ package.json | 3 +- src/audioWorklet/index.js | 2 +- src/effect.js | 4 +-- src/oscillator.js | 2 +- src/pulse.js | 4 +-- test/tests/p5.Master.js | 59 +++++++++++++++++++-------------------- 7 files changed, 41 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index bf8d9408..2e0c459d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5900,6 +5900,11 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "p5": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p5/-/p5-1.0.0.tgz", + "integrity": "sha512-SYYc6NSHA/mMoF00SdI39FmhifMWl0B74/Bg3T793v+KOAWgXsBfr7snv9cjHFqpcmjtJMuZSOoA55qAETCu1w==" + }, "package": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/package/-/package-1.0.1.tgz", diff --git a/package.json b/package.json index d0a79582..0aecb8f0 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ }, "dependencies": { "audioworklet-polyfill": "^1.1.2", + "p5": "1.0.0", "startaudiocontext": "^1.2.1", "tone": "0.10.0" }, @@ -42,6 +43,6 @@ "test": "grunt run-tests", "lint": "grunt lint", "dev": "grunt dev", - "postinstall": "grunt githooks" + "postinstall": "cp ./node_modules/p5/lib/p5.js ./node_modules/p5/lib/p5.min.js ./lib && grunt githooks" } } diff --git a/src/audioWorklet/index.js b/src/audioWorklet/index.js index f5b8df4f..4704dbaa 100644 --- a/src/audioWorklet/index.js +++ b/src/audioWorklet/index.js @@ -1,4 +1,4 @@ -import p5sound from '../master.js' +import p5sound from '../master.js'; const moduleSources = [ require('raw-loader!./recorderProcessor').default, require('raw-loader!./soundFileProcessor').default, diff --git a/src/effect.js b/src/effect.js index 1a2ac9f4..2c17b16d 100644 --- a/src/effect.js +++ b/src/effect.js @@ -159,6 +159,6 @@ p5.Effect.prototype.dispose = function () { this.ac = undefined; }; -const Effect = p5.Effect; +const Effect = p5.Effect; -export default Effect \ No newline at end of file +export default Effect; diff --git a/src/oscillator.js b/src/oscillator.js index 3e4108ce..577390cb 100644 --- a/src/oscillator.js +++ b/src/oscillator.js @@ -626,4 +626,4 @@ p5.SqrOsc = function (freq) { p5.SqrOsc.prototype = Object.create(p5.Oscillator.prototype); -export const Oscillator = p5.Oscillator; +export const Oscillator = p5.Oscillator; diff --git a/src/pulse.js b/src/pulse.js index 9a59e057..b83aff49 100644 --- a/src/pulse.js +++ b/src/pulse.js @@ -1,5 +1,5 @@ -import p5sound from './master' -import './oscillator' +import p5sound from './master'; +import './oscillator'; /** * Creates a Pulse object, an oscillator that implements diff --git a/test/tests/p5.Master.js b/test/tests/p5.Master.js index 30e24fb6..c4de3ca0 100644 --- a/test/tests/p5.Master.js +++ b/test/tests/p5.Master.js @@ -1,37 +1,34 @@ -'use strict' +'use strict'; -define(['chai'], function(chai){ - const expect = chai.expect; - describe('P5.master',function(){ +define(['chai'], function (chai) { + const expect = chai.expect; + describe('P5.master', function () { + it('can set and return master volume', function (done) { + p5.prototype.masterVolume(0.6); - it('can set and return master volume',function(done){ - p5.prototype.masterVolume(.6); + setTimeout(function () { + expect(p5.prototype.getMasterVolume()).to.be.closeTo(0.6, 0.05); + done(); + }, 100); + }); + it('can set master volume after t seconds in future', function (done) { + let t = 1; + p5.prototype.masterVolume(0.9, 0, t); - setTimeout(function() { - expect(p5.prototype.getMasterVolume()).to.be.closeTo(0.6,0.05); - done(); - }, 100); - }); - it('can set master volume after t seconds in future',function(done){ - let t = 1; - p5.prototype.masterVolume(0.9,0,t ); - - setTimeout(function() { - expect(p5.prototype.getMasterVolume()).to.be.closeTo(0.9,0.05); - done(); - }, 1100); - }); + setTimeout(function () { + expect(p5.prototype.getMasterVolume()).to.be.closeTo(0.9, 0.05); + done(); + }, 1100); + }); - it('can create a linear fade effect in master volume ',function(done){ + it('can create a linear fade effect in master volume ', function (done) { + let t = 1; + p5.prototype.masterVolume(1, t, 0); - let t = 1; - p5.prototype.masterVolume(1,t,0 ); - - setTimeout(function() { - expect(p5.prototype.getMasterVolume()).to.be.closeTo(.50, 0.5); - done(); - }, 500); - - }); + setTimeout(function () { + expect(p5.prototype.getMasterVolume()).to.be.closeTo(0.5, 0.5); + done(); + }, 500); }); -}); \ No newline at end of file + }); +});