style: auto-fix linting issues
This commit is contained in:
parent
ae853636ce
commit
8731ddb502
4 changed files with 11 additions and 13 deletions
|
|
@ -312,12 +312,12 @@ class AudioContextManager {
|
|||
|
||||
try {
|
||||
const AudioContext = window.AudioContext || window.webkitAudioContext;
|
||||
|
||||
|
||||
// "playback" latency hint maximizes buffer size to prevent audio glitches (stuttering),
|
||||
// which is critical for high-fidelity music listening.
|
||||
// We also attempt to request 192kHz sample rate for high-res audio support.
|
||||
const highResOptions = { sampleRate: 192000, latencyHint: 'playback' };
|
||||
|
||||
|
||||
try {
|
||||
this.audioContext = new AudioContext(highResOptions);
|
||||
console.log(`[AudioContext] Created with high-res settings: ${this.audioContext.sampleRate}Hz`);
|
||||
|
|
|
|||
|
|
@ -192,22 +192,22 @@ export class Visualizer {
|
|||
|
||||
// Bass (dynamic bins based on sample rate)
|
||||
const volume = 10 * Math.max(this.audio.volume, 0.1);
|
||||
|
||||
|
||||
// Robust bass detection: sum bins up to ~250Hz
|
||||
const binSize = this.audioContext.sampleRate / this.analyser.fftSize;
|
||||
const startBin = 1; // Skip DC offset
|
||||
// Calculate how many bins cover the bass range (up to 250Hz)
|
||||
let numBins = Math.floor(250 / binSize);
|
||||
if (numBins < 1) numBins = 1; // Ensure at least one bin is checked
|
||||
|
||||
|
||||
let maxVal = 0;
|
||||
for (let i = 0; i < numBins && (startBin + i) < this.dataArray.length; i++) {
|
||||
for (let i = 0; i < numBins && startBin + i < this.dataArray.length; i++) {
|
||||
const val = this.dataArray[startBin + i];
|
||||
if (val > maxVal) maxVal = val;
|
||||
}
|
||||
|
||||
|
||||
// Normalize: (Max / 255) / Volume
|
||||
let bass = (maxVal) / 255 / volume;
|
||||
let bass = maxVal / 255 / volume;
|
||||
|
||||
const intensity = bass * bass * 10;
|
||||
const stats = this.stats;
|
||||
|
|
|
|||
|
|
@ -288,14 +288,14 @@ export class LCDPreset {
|
|||
// Sample rate and bin size
|
||||
const sampleRate = analyser?.context?.sampleRate || 48000;
|
||||
const binSize = sampleRate / (totalBins * 2);
|
||||
|
||||
|
||||
// Define frequency range to map
|
||||
const minFreq = 40; // Start at 40Hz
|
||||
const maxFreq = 22000; // End at 22kHz
|
||||
|
||||
for (let i = 0; i < center; i++) {
|
||||
const p = i / (center - 1);
|
||||
|
||||
|
||||
// Logarithmic frequency mapping: F = min * (max/min)^p
|
||||
const targetStartFreq = minFreq * Math.pow(maxFreq / minFreq, p);
|
||||
// Calculate next frequency to determine bandwidth of this bar
|
||||
|
|
@ -308,14 +308,14 @@ export class LCDPreset {
|
|||
|
||||
let sum = 0,
|
||||
count = 0;
|
||||
|
||||
|
||||
// Sum bins for this column
|
||||
for (let k = startBin; k < endBin && k < totalBins; k++) {
|
||||
sum += dataArray[k];
|
||||
count++;
|
||||
}
|
||||
let val = count > 0 ? sum / count : 0;
|
||||
|
||||
|
||||
// Fallback: if range was too narrow (startBin >= endBin or count=0), sample the startBin directly
|
||||
if (count === 0 && startBin < totalBins) {
|
||||
val = dataArray[startBin];
|
||||
|
|
|
|||
|
|
@ -615,8 +615,6 @@ export class UnknownPleasuresWebGL {
|
|||
gl.drawArrays(gl.TRIANGLES, 0, vertices.length / 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// MUST DISABLE BLEND for post-processing passes so we strictly overwrite FBO contents!
|
||||
gl.disable(gl.BLEND);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue