Skip to content

Commit

Permalink
fix: remove underscore on wasm functions
Browse files Browse the repository at this point in the history
  • Loading branch information
eshaz committed Mar 24, 2023
1 parent 7385422 commit 8ca3deb
Show file tree
Hide file tree
Showing 55 changed files with 254 additions and 234 deletions.
22 changes: 11 additions & 11 deletions demo/flac-decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
};

this.allocateTypedArray = (len, TypedArray, setPointer = true) => {
const ptr = this._wasm["_malloc"](TypedArray.BYTES_PER_ELEMENT * len);
const ptr = this._wasm.malloc(TypedArray.BYTES_PER_ELEMENT * len);
if (setPointer) this._pointers.add(ptr);

return {
Expand All @@ -228,7 +228,7 @@

this.free = () => {
this._pointers.forEach((ptr) => {
this._wasm["_free"](ptr);
this._wasm.free(ptr);
});
this._pointers.clear();
};
Expand Down Expand Up @@ -3710,11 +3710,11 @@ z”­-w9lþkbö>së®QSU,â~ANÃuã^™X1]ܯA‡p%9µ±àÂÄï±ÍãõÄԊ
ready = resolve;
}).then(() => {
this.HEAP = buffer;
this._malloc = _malloc;
this._free = _free;
this._create_decoder = _create_decoder;
this._destroy_decoder = _destroy_decoder;
this._decode_frame = _decode_frame;
this.malloc = _malloc;
this.free = _free;
this.create_decoder = _create_decoder;
this.destroy_decoder = _destroy_decoder;
this.decode_frame = _decode_frame;
});
return this;
};}
Expand Down Expand Up @@ -3742,7 +3742,7 @@ z”­-w9lþkbö>së®QSU,â~ANÃuã^™X1]ܯA‡p%9µ±àÂÄï±ÍãõÄԊ
this._errorStringPtr = this._common.allocateTypedArray(1, Uint32Array);
this._stateStringPtr = this._common.allocateTypedArray(1, Uint32Array);

this._decoder = this._common.wasm["_create_decoder"](
this._decoder = this._common.wasm.create_decoder(
this._channels.ptr,
this._sampleRate.ptr,
this._bitsPerSample.ptr,
Expand All @@ -3767,7 +3767,7 @@ z”­-w9lþkbö>së®QSU,â~ANÃuã^™X1]ܯA‡p%9µ±àÂÄï±ÍãõÄԊ
};

this.free = () => {
this._common.wasm["_destroy_decoder"](this._decoder);
this._common.wasm.destroy_decoder(this._decoder);

this._common.free();
};
Expand All @@ -3785,7 +3785,7 @@ z”­-w9lþkbö>së®QSU,â~ANÃuã^™X1]ܯA‡p%9µ±àÂÄï±ÍãõÄԊ
);
input.buf.set(data);

this._common.wasm["_decode_frame"](this._decoder, input.ptr, input.len);
this._common.wasm.decode_frame(this._decoder, input.ptr, input.len);

let errorMessage = [],
error;
Expand Down Expand Up @@ -3822,7 +3822,7 @@ z”­-w9lþkbö>së®QSU,â~ANÃuã^™X1]ܯA‡p%9µ±àÂÄï±ÍãõÄԊ
samplesDecoded: this._samplesDecoded.buf[0],
};

this._common.wasm["_free"](this._outputBufferPtr.buf[0]);
this._common.wasm.free(this._outputBufferPtr.buf[0]);
this._outputBufferLen.buf[0] = 0;
this._samplesDecoded.buf[0] = 0;

Expand Down
4 changes: 2 additions & 2 deletions demo/flac-decoder.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/flac-decoder.min.js.map

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions demo/mpg123-decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
};

this.allocateTypedArray = (len, TypedArray, setPointer = true) => {
const ptr = this._wasm["_malloc"](TypedArray.BYTES_PER_ELEMENT * len);
const ptr = this._wasm.malloc(TypedArray.BYTES_PER_ELEMENT * len);
if (setPointer) this._pointers.add(ptr);

return {
Expand All @@ -228,7 +228,7 @@

this.free = () => {
this._pointers.forEach((ptr) => {
this._wasm["_free"](ptr);
this._wasm.free(ptr);
});
this._pointers.clear();
};
Expand Down Expand Up @@ -757,11 +757,11 @@ D¹6 î/†üƒ ¯ê»{«x»¹ôÞ£ÀÔ@Úïz¨~…wØéý諤1Õ"PãH
ready = resolve;
}).then(() => {
this.HEAP = buffer;
this._malloc = _malloc;
this._free = _free;
this._mpeg_frame_decoder_create = _mpeg_frame_decoder_create;
this._mpeg_decode_interleaved = _mpeg_decode_interleaved;
this._mpeg_frame_decoder_destroy = _mpeg_frame_decoder_destroy;
this.malloc = _malloc;
this.free = _free;
this.mpeg_frame_decoder_create = _mpeg_frame_decoder_create;
this.mpeg_decode_interleaved = _mpeg_decode_interleaved;
this.mpeg_frame_decoder_destroy = _mpeg_frame_decoder_destroy;
});
return this;
};}
Expand Down Expand Up @@ -796,7 +796,7 @@ D¹6 î/†üƒ ¯ê»{«x»¹ôÞ£ÀÔ@Úïz¨~…wØéý諤1Õ"PãH
this._sampleRateBytes = this._common.allocateTypedArray(1, Uint32Array);
this._errorStringPtr = this._common.allocateTypedArray(1, Uint32Array);

this._decoder = this._common.wasm["_mpeg_frame_decoder_create"]();
this._decoder = this._common.wasm.mpeg_frame_decoder_create();
});
};

Expand All @@ -812,8 +812,8 @@ D¹6 î/†üƒ ¯ê»{«x»¹ôÞ£ÀÔ@Úïz¨~…wØéý諤1Õ"PãH
};

this.free = () => {
this._common.wasm["_mpeg_frame_decoder_destroy"](this._decoder);
this._common.wasm["_free"](this._decoder);
this._common.wasm.mpeg_frame_decoder_destroy(this._decoder);
this._common.wasm.free(this._decoder);

this._common.free();
};
Expand All @@ -828,7 +828,7 @@ D¹6 î/†üƒ ¯ê»{«x»¹ôÞ£ÀÔ@Úïz¨~…wØéý諤1Õ"PãH
this._inputPosition.buf[0] = 0;
this._samplesDecoded.buf[0] = 0;

const error = this._common.wasm["_mpeg_decode_interleaved"](
const error = this._common.wasm.mpeg_decode_interleaved(
this._decoder,
this._input.ptr,
data.length,
Expand Down
Binary file modified demo/mpg123-decoder.min.js
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/mpg123-decoder.min.js.map

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions demo/ogg-opus-decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
};

this.allocateTypedArray = (len, TypedArray, setPointer = true) => {
const ptr = this._wasm["_malloc"](TypedArray.BYTES_PER_ELEMENT * len);
const ptr = this._wasm.malloc(TypedArray.BYTES_PER_ELEMENT * len);
if (setPointer) this._pointers.add(ptr);

return {
Expand All @@ -228,7 +228,7 @@

this.free = () => {
this._pointers.forEach((ptr) => {
this._wasm["_free"](ptr);
this._wasm.free(ptr);
});
this._pointers.clear();
};
Expand Down Expand Up @@ -705,11 +705,11 @@ P¯Ã“é\º¼â=}Ãi×zØ}}}7³O±eZ̘á®øK—øaÔý—ùŸúÉ\íu
ready = resolve;
}).then(() => {
this.HEAP = buffer;
this._malloc = _malloc;
this._free = _free;
this._opus_frame_decoder_create = _opus_frame_decoder_create;
this._opus_frame_decode_float_deinterleaved = _opus_frame_decode_float_deinterleaved;
this._opus_frame_decoder_destroy = _opus_frame_decoder_destroy;
this.malloc = _malloc;
this.free = _free;
this.opus_frame_decoder_create = _opus_frame_decoder_create;
this.opus_frame_decode_float_deinterleaved = _opus_frame_decode_float_deinterleaved;
this.opus_frame_decoder_destroy = _opus_frame_decoder_destroy;
});
return this;
};}
Expand Down Expand Up @@ -762,7 +762,7 @@ P¯Ã“é\º¼â=}Ãi×zØ}}}7³O±eZ̘á®øK—øaÔý—ùŸúÉ\íu

mapping.buf.set(this._channelMappingTable);

this._decoder = this._common.wasm["_opus_frame_decoder_create"](
this._decoder = this._common.wasm.opus_frame_decoder_create(
this._channels,
this._streamCount,
this._coupledStreamCount,
Expand All @@ -785,8 +785,8 @@ P¯Ã“é\º¼â=}Ãi×zØ}}}7³O±eZ̘á®øK—øaÔý—ùŸúÉ\íu

this.free = () => {
this._common.free();
this._common.wasm["_opus_frame_decoder_destroy"](this._decoder);
this._common.wasm["_free"](this._decoder);
this._common.wasm.opus_frame_decoder_destroy(this._decoder);
this._common.wasm.free(this._decoder);
};

this._decode = (opusFrame) => {
Expand All @@ -797,9 +797,13 @@ P¯Ã“é\º¼â=}Ãi×zØ}}}7³O±eZ̘á®øK—øaÔý—ùŸúÉ\íu

this._input.buf.set(opusFrame);

let samplesDecoded = this._common.wasm[
"_opus_frame_decode_float_deinterleaved"
](this._decoder, this._input.ptr, opusFrame.length, this._output.ptr);
let samplesDecoded =
this._common.wasm.opus_frame_decode_float_deinterleaved(
this._decoder,
this._input.ptr,
opusFrame.length,
this._output.ptr
);

let error;

Expand Down
Binary file modified demo/ogg-opus-decoder.min.js
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/ogg-opus-decoder.min.js.map

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions demo/ogg-vorbis-decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
};

this.allocateTypedArray = (len, TypedArray, setPointer = true) => {
const ptr = this._wasm["_malloc"](TypedArray.BYTES_PER_ELEMENT * len);
const ptr = this._wasm.malloc(TypedArray.BYTES_PER_ELEMENT * len);
if (setPointer) this._pointers.add(ptr);

return {
Expand All @@ -228,7 +228,7 @@

this.free = () => {
this._pointers.forEach((ptr) => {
this._wasm["_free"](ptr);
this._wasm.free(ptr);
});
this._pointers.clear();
};
Expand Down Expand Up @@ -3774,13 +3774,13 @@ cAë¢þÍÍ­ý×ß'$|ð÷= È8a7ç^ˆoÚ~Ò;hTиԣ|¸Øÿ£2±õR
ready = resolve;
}).then(() => {
this.HEAP = buffer;
this._malloc = _malloc;
this._free = _free;
this._create_decoder = _create_decoder;
this._send_setup = _send_setup;
this._init_dsp = _init_dsp;
this._decode_packets = _decode_packets;
this._destroy_decoder = _destroy_decoder;
this.malloc = _malloc;
this.free = _free;
this.create_decoder = _create_decoder;
this.send_setup = _send_setup;
this.init_dsp = _init_dsp;
this.decode_packets = _decode_packets;
this.destroy_decoder = _destroy_decoder;
});
return this;
};}
Expand Down Expand Up @@ -3815,7 +3815,7 @@ cAë¢þÍÍ­ý×ß'$|ð÷= È8a7ç^ˆoÚ~Ò;hTиԣ|¸Øÿ£2±õR
this._inputBytes = 0;
this._outputSamples = 0;

this._decoder = this._common.wasm["_create_decoder"](
this._decoder = this._common.wasm.create_decoder(
this._input.ptr,
this._inputLen.ptr,
this._outputBufferPtr.ptr,
Expand All @@ -3841,20 +3841,20 @@ cAë¢þÍÍ­ý×ß'$|ð÷= È8a7ç^ˆoÚ~Ò;hTиԣ|¸Øÿ£2±õR
};

this.free = () => {
this._common.wasm["_destroy_decoder"](this._decoder);
this._common.wasm.destroy_decoder(this._decoder);
this._common.free();
};

this.sendSetupHeader = (data) => {
this._input.buf.set(data);
this._inputLen.buf[0] = data.length;

this._common.wasm["_send_setup"](this._decoder, this._firstPage);
this._common.wasm.send_setup(this._decoder, this._firstPage);
this._firstPage = false;
};

this.initDsp = () => {
this._common.wasm["_init_dsp"](this._decoder);
this._common.wasm.init_dsp(this._decoder);
};

this.decodePackets = (packets) => {
Expand All @@ -3867,7 +3867,7 @@ cAë¢þÍÍ­ý×ß'$|ð÷= È8a7ç^ˆoÚ~Ò;hTиԣ|¸Øÿ£2±õR
this._input.buf.set(packet);
this._inputLen.buf[0] = packet.length;

this._common.wasm["_decode_packets"](this._decoder);
this._common.wasm.decode_packets(this._decoder);

const samplesDecoded = this._samplesDecoded.buf[0];
const channels = [];
Expand Down
4 changes: 2 additions & 2 deletions demo/ogg-vorbis-decoder.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/ogg-vorbis-decoder.min.js.map

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions demo/opus-decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
};

this.allocateTypedArray = (len, TypedArray, setPointer = true) => {
const ptr = this._wasm["_malloc"](TypedArray.BYTES_PER_ELEMENT * len);
const ptr = this._wasm.malloc(TypedArray.BYTES_PER_ELEMENT * len);
if (setPointer) this._pointers.add(ptr);

return {
Expand All @@ -228,7 +228,7 @@

this.free = () => {
this._pointers.forEach((ptr) => {
this._wasm["_free"](ptr);
this._wasm.free(ptr);
});
this._pointers.clear();
};
Expand Down Expand Up @@ -705,11 +705,11 @@ P¯Ã“é\º¼â=}Ãi×zØ}}}7³O±eZ̘á®øK—øaÔý—ùŸúÉ\íu
ready = resolve;
}).then(() => {
this.HEAP = buffer;
this._malloc = _malloc;
this._free = _free;
this._opus_frame_decoder_create = _opus_frame_decoder_create;
this._opus_frame_decode_float_deinterleaved = _opus_frame_decode_float_deinterleaved;
this._opus_frame_decoder_destroy = _opus_frame_decoder_destroy;
this.malloc = _malloc;
this.free = _free;
this.opus_frame_decoder_create = _opus_frame_decoder_create;
this.opus_frame_decode_float_deinterleaved = _opus_frame_decode_float_deinterleaved;
this.opus_frame_decoder_destroy = _opus_frame_decoder_destroy;
});
return this;
};}
Expand Down Expand Up @@ -762,7 +762,7 @@ P¯Ã“é\º¼â=}Ãi×zØ}}}7³O±eZ̘á®øK—øaÔý—ùŸúÉ\íu

mapping.buf.set(this._channelMappingTable);

this._decoder = this._common.wasm["_opus_frame_decoder_create"](
this._decoder = this._common.wasm.opus_frame_decoder_create(
this._channels,
this._streamCount,
this._coupledStreamCount,
Expand All @@ -785,8 +785,8 @@ P¯Ã“é\º¼â=}Ãi×zØ}}}7³O±eZ̘á®øK—øaÔý—ùŸúÉ\íu

this.free = () => {
this._common.free();
this._common.wasm["_opus_frame_decoder_destroy"](this._decoder);
this._common.wasm["_free"](this._decoder);
this._common.wasm.opus_frame_decoder_destroy(this._decoder);
this._common.wasm.free(this._decoder);
};

this._decode = (opusFrame) => {
Expand All @@ -797,9 +797,13 @@ P¯Ã“é\º¼â=}Ãi×zØ}}}7³O±eZ̘á®øK—øaÔý—ùŸúÉ\íu

this._input.buf.set(opusFrame);

let samplesDecoded = this._common.wasm[
"_opus_frame_decode_float_deinterleaved"
](this._decoder, this._input.ptr, opusFrame.length, this._output.ptr);
let samplesDecoded =
this._common.wasm.opus_frame_decode_float_deinterleaved(
this._decoder,
this._input.ptr,
opusFrame.length,
this._output.ptr
);

let error;

Expand Down
Binary file modified demo/opus-decoder.min.js
Binary file not shown.
Loading

0 comments on commit 8ca3deb

Please sign in to comment.