Skip to content

Commit

Permalink
fetching latest p5.js code from npm (#501)
Browse files Browse the repository at this point in the history
* fetching latest p5.js code from npm
  • Loading branch information
endurance21 authored Jul 16, 2020
1 parent d32113c commit d30c43d
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 38 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"dependencies": {
"audioworklet-polyfill": "^1.1.2",
"p5": "1.0.0",
"startaudiocontext": "^1.2.1",
"tone": "0.10.0"
},
Expand All @@ -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"
}
}
2 changes: 1 addition & 1 deletion src/audioWorklet/index.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/effect.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,6 @@ p5.Effect.prototype.dispose = function () {
this.ac = undefined;
};

const Effect = p5.Effect;
const Effect = p5.Effect;

export default Effect
export default Effect;
2 changes: 1 addition & 1 deletion src/oscillator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions src/pulse.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import p5sound from './master'
import './oscillator'
import p5sound from './master';
import './oscillator';

/**
* Creates a Pulse object, an oscillator that implements
Expand Down
59 changes: 28 additions & 31 deletions test/tests/p5.Master.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
});
});

0 comments on commit d30c43d

Please sign in to comment.