summaryrefslogtreecommitdiff
path: root/src/emu8910.ts
diff options
context:
space:
mode:
authorLunar Journal <md.node.0@gmail.com>2024-07-28 21:00:38 +0200
committerGitHub <noreply@github.com>2024-07-28 21:00:38 +0200
commit35b4b0b6e94a0f175b9be07bcc6486b0618e891b (patch)
tree79cd8d370e9d63adca97001378386944648c7315 /src/emu8910.ts
parent7348b3378a90489f4915ec08b33bc47be40b0fa2 (diff)
downloademu8910-35b4b0b6e94a0f175b9be07bcc6486b0618e891b.tar.gz
emu8910-35b4b0b6e94a0f175b9be07bcc6486b0618e891b.zip
FIR update
Diffstat (limited to 'src/emu8910.ts')
-rw-r--r--src/emu8910.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/emu8910.ts b/src/emu8910.ts
index fc39745..aabfcbe 100644
--- a/src/emu8910.ts
+++ b/src/emu8910.ts
@@ -209,17 +209,20 @@ class FirFilter {
this.offset = length - (index * m);
let sub = buffer.slice(this.offset);
- this.index = (index + 1) % (length / m - 1);
- for( i = m -1; i >=0; i--){
- buffer[this.offset + i] = samples[i];
+
+ for( i = 0; i < m; i++){
+ buffer[this.offset + i - 1] = samples[i];
}
+
for( i = 0; i < h.length; i++){
y += h[i] * (sub[i] + sub[h.length - i - 1]);
}
+
for( i = 0; i < m; i++){
buffer[this.offset + length - m + i] = buffer[this.offset + i];
}
-
+
+ this.index = (index + 1) % (length / m - 1);
return y;