js : decode now returns typed array and cannot be null

If no data is decoded, then the returned array is empty.
This commit is contained in:
Georgi Gerganov
2022-05-02 19:07:06 +03:00
parent 9a26793ecf
commit d135fbbef4
3 changed files with 6 additions and 8 deletions

View File

@@ -118,7 +118,7 @@
navigator.mediaDevices.getUserMedia(constraints).then(function (e) {
mediaStream = context.createMediaStreamSource(e);
var bufferSize = 16*1024;
var bufferSize = 1024;
var numberOfInputChannels = 1;
var numberOfOutputChannels = 1;
@@ -137,7 +137,7 @@
recorder.onaudioprocess = function (e) {
var source = e.inputBuffer;
var res = ggwave.decode(instance, convertTypedArray(new Float32Array(source.getChannelData(0)), Int8Array));
if (res) {
if (res && res.length > 0) {
rxData.value = res;
}