mirror of
https://codeberg.org/armin/tcdweb.git
synced 2026-09-01 05:30:45 +02:00
Add peak hold decay rate selector
Introduce a new dropdown to control how fast the peak-hold line decays on the live spectrum. Options: Off — peaks never decay (manual reset only) Slow — slow fade (0.005/frame) Medium — moderate fade (0.015/frame, matches previous fixed rate) Fast — quick fade (0.03/frame) Previously the decay rate was hardcoded at 0.015/frame.
This commit is contained in:
parent
210b4c2d3d
commit
e159b76e0d
2 changed files with 9 additions and 1 deletions
|
|
@ -32,6 +32,12 @@
|
|||
<button id="resetBtn" class="player-btn" title="Reset Peaks">↺</button>
|
||||
<span id="playTime" class="player-time">0:00.0 / 0:00.0</span>
|
||||
<select id="windowSelect" class="window-select" title="Spectrum window function"><option value="none">None</option><option value="hanning" selected>Hanning</option><option value="hamming">Hamming</option><option value="blackman">Blackman-Harris</option><option value="bartlett">Bartlett</option><option value="gaussian">Gaussian</option><option value="kaiser">Kaiser</option><option value="flatTop">Flat Top</option></select>
|
||||
<select id="peakHoldDecay" class="window-select" title="Peak hold decay rate">
|
||||
<option value="off">Hold: Off</option>
|
||||
<option value="slow">Hold: Slow</option>
|
||||
<option value="medium" selected>Hold: Medium</option>
|
||||
<option value="fast">Hold: Fast</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="chart-container" style="position:relative">
|
||||
<canvas id="waveformChart"></canvas>
|
||||
|
|
|
|||
|
|
@ -616,7 +616,9 @@ const App = {
|
|||
ctx.stroke();
|
||||
|
||||
if (this.holdPeaks) {
|
||||
const decay = 0.015;
|
||||
const decaySel = document.getElementById('peakHoldDecay');
|
||||
const decayMap = { off: 0, slow: 0.005, medium: 0.015, fast: 0.03 };
|
||||
const decay = decaySel ? (decayMap[decaySel.value] ?? 0.015) : 0.015;
|
||||
ctx.beginPath();
|
||||
let started = false;
|
||||
for (let x = 0; x < chartW; x++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue