Fix AudioAnalyzer

This commit is contained in:
Ralty
2025-07-13 23:41:41 +07:00
parent a3ae8a70d4
commit 17ffdcd6ef
3 changed files with 16 additions and 16 deletions
+2 -2
View File
@@ -48,7 +48,7 @@ class AudioAnalyzer {
if (useSeperate) {
while (c < outSeperate.length) outSeperate[c++] *= __bitSize;
while (c++ < buffer.channels) outSeperate.push(0);
c = 0;
c = Math.floor((pos % (__wordSize * buffer.channels)) / __wordSize);
}
if (__wordSize == 1) { // 8-bit audio data is unsigned (0 is 128, 128 is 256, -128 is 0)
while (pos < end) {
@@ -113,7 +113,7 @@ class AudioAnalyzer {
if (useSeperate) {
while (c < outSeperate.length) outSeperate[c++] *= __bitSize;
while (c++ < buffer.channels) outSeperate.push(0);
c = 0;
c = Math.floor((pos % (__wordSize * buffer.channels)) / __wordSize);
}
while (n > 0) {
n -= (result = __vorbis.read(__buffer, 0, n < bufferSize ? n : bufferSize, isBigEndian, __wordSize, true));