Skip to content

Commit

Permalink
replacement of es5 functions to es6 class def feat P5.AudioIn and aud…
Browse files Browse the repository at this point in the history
…iocontext
  • Loading branch information
endurance21 committed Aug 8, 2020
1 parent 5675782 commit 8de0b75
Show file tree
Hide file tree
Showing 3 changed files with 327 additions and 317 deletions.
11 changes: 9 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import 'audioworklet-polyfill';
import './shims';
import './audiocontext';

import { getAudioContext, userStartAudio } from './audiocontext';
p5.prototype.getAudioContext = getAudioContext;
p5.prototype.userStartAudio = userStartAudio;

import './master';
import './helpers';
import './errorHandler';
Expand All @@ -19,7 +23,10 @@ import './oscillator';
import './envelope';
import './pulse';
import './noise';
import './audioin';

import AudioIn from './audioin';
p5.AudioIn = AudioIn;

import './filter';
import './eq';
import './panner3d';
Expand Down
8 changes: 4 additions & 4 deletions src/audiocontext.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ Tone.setContext(audiocontext);
*
* </div></code>
*/
p5.prototype.getAudioContext = function () {
export function getAudioContext() {
return audiocontext;
};
}

/**
* <p>It is not only a good practice to give users control over starting
Expand Down Expand Up @@ -102,7 +102,7 @@ p5.prototype.getAudioContext = function () {
* }
* </code></div>
*/
p5.prototype.userStartAudio = function (elements, callback) {
export function userStartAudio(elements, callback) {
var elt = elements;
if (elements instanceof p5.Element) {
elt = elements.elt;
Expand All @@ -112,6 +112,6 @@ p5.prototype.userStartAudio = function (elements, callback) {
});
}
return StartAudioContext(audiocontext, elt, callback);
};
}

export default audiocontext;
Loading

0 comments on commit 8de0b75

Please sign in to comment.