Skip to content

Commit b841715

Browse files
committed
Removed unused code
1 parent 874e42b commit b841715

File tree

2 files changed

+6
-31
lines changed

2 files changed

+6
-31
lines changed

src/components/FFT.tsx

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const FFT = forwardRef(
3434
const [fftData, setFftData] = useState<number[][]>(Array.from({ length: 16 }, () => []));
3535
const fftSize = Math.pow(2, Math.round(Math.log2(currentSamplingRate / 2)));
3636
const sampleupdateref = useRef<number>(50);
37-
sampleupdateref.current=currentSamplingRate/10;
37+
sampleupdateref.current = currentSamplingRate / 10;
3838
const canvasRef = useRef<HTMLCanvasElement>(null);
3939
const containerRef = useRef<HTMLDivElement>(null);
4040
const { theme } = useTheme();
@@ -161,7 +161,7 @@ const FFT = forwardRef(
161161
);
162162
}
163163
};
164-
const filter = new SmoothingFilter((currentSamplingRate/ sampleupdateref.current)*2,1);
164+
const filter = new SmoothingFilter((currentSamplingRate / sampleupdateref.current) * 2, 1);
165165

166166
useImperativeHandle(
167167
ref,
@@ -178,7 +178,7 @@ const FFT = forwardRef(
178178
samplesReceived++;
179179

180180
// Trigger FFT computation more frequently
181-
if (samplesReceived % sampleupdateref.current === 0) { // Changed from 25 to 5
181+
if (samplesReceived % sampleupdateref.current === 0) { // Changed from 25 to 5
182182
const processedBuffer = fftBufferRef.current[i].slice(0, fftSize);
183183
const floatInput = new Float32Array(processedBuffer);
184184
const fftMags = fftProcessor.computeMagnitudes(floatInput);
@@ -256,11 +256,7 @@ const FFT = forwardRef(
256256
}
257257
}
258258
}
259-
260-
261259
const fftProcessor = new FFT(fftSize);
262-
263-
///
264260
const createCanvasElement = () => {
265261
const container = canvasContainerRef.current;
266262
if (!container) return;
@@ -399,7 +395,7 @@ const FFT = forwardRef(
399395
const x = leftMargin + i * xScale;
400396
const y = height - bottomMargin - channelData[i] * yScale;
401397

402-
ctx.lineTo(x, y);
398+
ctx.lineTo(x, y);
403399
}
404400
ctx.stroke();
405401
});
@@ -433,7 +429,7 @@ const FFT = forwardRef(
433429
ctx.fillText("Magnitude", -height / 2, 15);
434430
ctx.restore();
435431
}, [fftData, theme, maxFreq, currentSamplingRate, fftSize, channelColors]);
436-
432+
437433
useEffect(() => {
438434
if (fftData.some((channel) => channel.length > 0)) {
439435
plotData();
@@ -458,15 +454,10 @@ const FFT = forwardRef(
458454
<main
459455
ref={canvasContainerRef}
460456
className="flex-1 bg-highlight rounded-2xl m-2 overflow-hidden min-h-0 "
461-
>
462-
{/* WebGL canvas will be inserted here */}
457+
>
463458
</main>
464-
465-
{/* Data display area with responsive layout */}
466459
<div className="flex-1 m-2 flex flex-col md:flex-row justify-center overflow-hidden min-h-0 "
467460
>
468-
469-
{/* Frequency graph container with overflow protection */}
470461
<div
471462
ref={containerRef}
472463
className="flex-1 overflow-hidden min-h-0 min-w-0 rounded-2xl bg-highlight "
@@ -476,10 +467,7 @@ const FFT = forwardRef(
476467
className="w-full h-full"
477468
/>
478469
</div>
479-
480-
{/* Band power view container */}
481470
<div className="flex-1 flex flex-col overflow-hidden min-h-0 min-w-0 ml-4 bg-highlight rounded-2xl">
482-
{/* Button Group */}
483471
<div className="flex justify-center space-x-2 pt-2 rounded-t-xl">
484472
<button onClick={() => setActiveBandPowerView('bandpower')} className={buttonStyles('bandpower')}>
485473
Band Power
@@ -488,8 +476,6 @@ const FFT = forwardRef(
488476
Beta Candle
489477
</button>
490478
</div>
491-
492-
{/* View container with minimum height */}
493479
{renderBandPowerView()}
494480
</div>
495481
</div>

src/components/fft-js.d.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)