Use audio-context module for shared audiocontext

To prevent creating multiple audio contexts
This commit is contained in:
Eric Rosenbaum 2017-07-21 10:50:15 -04:00
parent bd1820ebf7
commit 643d33e482
2 changed files with 3 additions and 1 deletions

View file

@ -21,6 +21,7 @@
},
"homepage": "https://github.com/LLK/scratch-audio#readme",
"devDependencies": {
"audio-context": "^1.0.1",
"babel-core": "^6.24.1",
"babel-eslint": "^7.2.2",
"babel-loader": "^6.4.1",

View file

@ -1,5 +1,7 @@
const log = require('./log');
const AudioContext = require('audio-context');
const PitchEffect = require('./effects/PitchEffect');
const PanEffect = require('./effects/PanEffect');
@ -149,7 +151,6 @@ class AudioPlayer {
*/
class AudioEngine {
constructor () {
const AudioContext = window.AudioContext || window.webkitAudioContext;
this.audioContext = new AudioContext();
this.input = this.audioContext.createGain();