@wasm-audio-decoders/common
Advanced tools
Comparing version 5.0.2 to 5.1.0
{ | ||
"name": "@wasm-audio-decoders/common", | ||
"version": "5.0.2", | ||
"version": "5.1.0", | ||
"description": "Web Assembly Audio Decoders Common", | ||
@@ -5,0 +5,0 @@ "module": "index.js", |
@@ -57,6 +57,7 @@ export default function WASMAudioDecoderCommon(caller) { | ||
getDecodedAudio: { | ||
value: (channelData, samplesDecoded, sampleRate) => ({ | ||
value: (channelData, samplesDecoded, sampleRate, bitDepth) => ({ | ||
channelData, | ||
samplesDecoded, | ||
sampleRate, | ||
bitDepth | ||
}), | ||
@@ -66,3 +67,3 @@ }, | ||
getDecodedAudioMultiChannel: { | ||
value(input, channelsDecoded, samplesDecoded, sampleRate) { | ||
value(input, channelsDecoded, samplesDecoded, sampleRate, bitDepth) { | ||
let channelData = [], | ||
@@ -74,3 +75,3 @@ i, | ||
const channel = []; | ||
for (j = 0; j < input.length; ) channel.push(input[j++][i]); | ||
for (j = 0; j < input.length; ) channel.push(input[j++][i] || []); | ||
channelData.push( | ||
@@ -84,3 +85,4 @@ WASMAudioDecoderCommon.concatFloat32(channel, samplesDecoded) | ||
samplesDecoded, | ||
sampleRate | ||
sampleRate, | ||
bitDepth | ||
); | ||
@@ -205,5 +207,5 @@ }, | ||
this.allocateTypedArray = (len, TypedArray) => { | ||
this.allocateTypedArray = (len, TypedArray, setPointer = true) => { | ||
const ptr = this._wasm._malloc(TypedArray.BYTES_PER_ELEMENT * len); | ||
this._pointers.add(ptr); | ||
if (setPointer) this._pointers.add(ptr); | ||
@@ -217,3 +219,3 @@ return { | ||
this.free = () => { | ||
this.free = (ptr) => { | ||
this._pointers.forEach((ptr) => { | ||
@@ -238,9 +240,11 @@ this._wasm._free(ptr); | ||
return this._wasm.ready.then(() => { | ||
caller._input = this.allocateTypedArray(_inputSize, uint8Array); | ||
if (_inputSize) | ||
caller._input = this.allocateTypedArray(_inputSize, uint8Array); | ||
// output buffer | ||
caller._output = this.allocateTypedArray( | ||
_outputChannels * _outputChannelSize, | ||
float32Array | ||
); | ||
if (_outputChannelSize) | ||
caller._output = this.allocateTypedArray( | ||
_outputChannels * _outputChannelSize, | ||
float32Array | ||
); | ||
@@ -247,0 +251,0 @@ return this; |
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
58557
345