scratch-audio
Advanced tools
Comparing version 0.1.0-prerelease.20181023202904 to 0.1.0-prerelease.20190108181031
{ | ||
"name": "scratch-audio", | ||
"version": "0.1.0-prerelease.20181023202904", | ||
"version": "0.1.0-prerelease.20190108181031", | ||
"description": "audio engine for scratch 3.0", | ||
@@ -5,0 +5,0 @@ "main": "dist.js", |
@@ -153,3 +153,12 @@ class ArrayBufferStream { | ||
readInt32 () { | ||
const val = new Int32Array(this.arrayBuffer, this._position, 1)[0]; | ||
let val; | ||
if (this._position % 4 === 0) { | ||
val = new Int32Array(this.arrayBuffer, this._position, 1)[0]; | ||
} else { | ||
// Cannot read Int32 directly out because offset is not multiple of 4 | ||
// Need to slice out the values first | ||
val = new Int32Array( | ||
this.arrayBuffer.slice(this._position, this._position + 4) | ||
)[0]; | ||
} | ||
this._position += 4; // one 32 bit int is 4 bytes | ||
@@ -156,0 +165,0 @@ return val; |
@@ -157,2 +157,7 @@ const StartAudioContext = require('./StartAudioContext'); | ||
.catch(() => { | ||
// If the file is empty, create an empty sound | ||
if (sound.data.length === 0) { | ||
return Promise.resolve(this.audioContext.createBuffer(1, 1, this.audioContext.sampleRate)); | ||
} | ||
// The audio context failed to parse the sound data | ||
@@ -159,0 +164,0 @@ // we gave it, so try to decode as 'adpcm' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
589318
4578