fix: loudness navigation shows rank position, not time-order index
When stepping the clip queue by loudness (U/I, or "highlights only"
auto-advance), the position count showed the section's time-order index
(e.g. "30 / 426") instead of its place in the loudest-first ranking, so
walking highlights produced a count that jumped around. playClip now
takes a byScore flag: the displayed position is the rank in scoreOrder()
when navigating highlights ("1 / 426" = loudest), the time-order index
otherwise. The in-player U/I path already announced the rank.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+7
-3
@@ -352,7 +352,10 @@ function seekToSection(idx, filename, startSec, endSec, sectionIdx) {
|
||||
let clipQueue = [];
|
||||
let clipCursor = -1;
|
||||
|
||||
function playClip(i) {
|
||||
// byScore: this play is part of a loudness walk (U/I or "highlights only"
|
||||
// auto-advance), so the position shown is the rank in the loudest-first
|
||||
// ranking ("3rd loudest of 426"), not the time-order index.
|
||||
function playClip(i, byScore) {
|
||||
if (i < 0 || i >= clipQueue.length) return;
|
||||
clipCursor = i;
|
||||
const c = clipQueue[i];
|
||||
@@ -370,7 +373,8 @@ function playClip(i) {
|
||||
? `${fmtClock(c.absStart)} to ${fmtClock(c.absStart + (c.end - c.start))}`
|
||||
: `${fmtDur(c.start)} to ${fmtDur(c.end)}`;
|
||||
const score = c.score != null ? ` · +${Math.round(c.score)} dB` : '';
|
||||
const text = `${when}${score} (${i + 1} / ${clipQueue.length})`;
|
||||
const pos = byScore ? scoreOrder(clipQueue).indexOf(i) : i;
|
||||
const text = `${when}${score} (${pos + 1} / ${clipQueue.length})`;
|
||||
const label = document.getElementById('clip-label');
|
||||
label.textContent = text;
|
||||
label.title = `${c.filename} @ ${fmtDur(c.start)}–${fmtDur(c.end)}`;
|
||||
@@ -422,7 +426,7 @@ function stepClip(dir, byScore, jump) {
|
||||
const pos = order.indexOf(clipCursor); // -1: nothing played yet
|
||||
const next = jump ? (dir > 0 ? order.length - 1 : 0)
|
||||
: pos === -1 ? (dir > 0 ? 0 : -1) : pos + dir;
|
||||
if (next >= 0 && next < order.length) playClip(order[next]);
|
||||
if (next >= 0 && next < order.length) playClip(order[next], true);
|
||||
else announce(dir < 0 ? 'Loudest highlight reached' : 'End of highlights');
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user