From 5d2ecf30797740a52f8bc17c54e2cbf5bba0a7fd Mon Sep 17 00:00:00 2001 From: tremblap Date: Mon, 14 Aug 2023 12:12:35 +0100 Subject: [PATCH] Bug fix upsampling - fixes #26 (#27) * update git-ignore for vscode and macos * proposed fix for when sampling lines - fixes bug #26 --- .gitignore | 2 ++ src/api-max.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b1b5b6a..1468c08 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ node_modules fluid.waveform.tar.gz /**/fav-max.js pnpm-lock.yaml +.vscode +.DS_Store diff --git a/src/api-max.js b/src/api-max.js index 127a894..bbbe9bb 100644 --- a/src/api-max.js +++ b/src/api-max.js @@ -41,7 +41,7 @@ Signal.prototype['sample'] = function(step, method = "mean"){ if(bucketStart > this.data.length - 1 ) bucketStart = this.data.length -1; if(bucketEnd > this.data.length -1 ) bucketEnd = this.data.length -1; if(bucketStart === bucketEnd) { - newData[i] = i > 0 ? newData[i-1] : this.data[i]; //<------- diff + newData[i] = this.data[bucketStart]; } else newData[i] = stats[method](this.data.slice(bucketStart, bucketEnd)); }