scratch-audio
Advanced tools
Comparing version 0.1.0-prerelease.1500997011 to 0.1.0-prerelease.1500997049
{ | ||
"name": "scratch-audio", | ||
"version": "0.1.0-prerelease.1500997011", | ||
"version": "0.1.0-prerelease.1500997049", | ||
"description": "audio engine for scratch 3.0", | ||
@@ -5,0 +5,0 @@ "main": "dist.js", |
@@ -47,16 +47,3 @@ const SoundPlayer = require('./SoundPlayer'); | ||
const audioData = request.response; | ||
// Check for newer promise-based API | ||
let loaderPromise; | ||
if (this.audioContext.decodeAudioData.length === 1) { | ||
loaderPromise = this.audioContext.decodeAudioData(audioData); | ||
} else { | ||
// Fall back to callback API | ||
loaderPromise = new Promise((resolve, reject) => { | ||
this.audioContext.decodeAudioData(audioData, | ||
decodedAudio => resolve(decodedAudio), | ||
error => reject(error) | ||
); | ||
}); | ||
} | ||
loaderPromise.then(buffer => { | ||
this.audioContext.decodeAudioData(audioData).then(buffer => { | ||
this.drumSounds[i].setBuffer(buffer); | ||
@@ -63,0 +50,0 @@ }); |
@@ -207,14 +207,3 @@ const log = require('./log'); | ||
case '': | ||
// Check for newer promise-based API | ||
if (this.audioContext.decodeAudioData.length === 1) { | ||
loaderPromise = this.audioContext.decodeAudioData(bufferCopy); | ||
} else { | ||
// Fall back to callback API | ||
loaderPromise = new Promise((resolve, reject) => { | ||
this.audioContext.decodeAudioData(bufferCopy, | ||
decodedAudio => resolve(decodedAudio), | ||
error => reject(error) | ||
); | ||
}); | ||
} | ||
loaderPromise = this.audioContext.decodeAudioData(bufferCopy); | ||
break; | ||
@@ -221,0 +210,0 @@ case 'adpcm': |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
598394
3842