fix(rst wheel): the S9+ ladder, not the S digit
Below 59+20 comes 59+15, then +10, +5, then a plain 59 and down through 58, 57. Stepping the S digit and leaving the suffix where it was turned 59+20 into 58+20, which nobody has ever said on the air. Five decibels at a time above S9 — the same increment sMeterRST rounds an S-meter reading to — and one S-unit below it.
This commit is contained in:
+25
-6
@@ -59,11 +59,30 @@ export function stepRST(value: string, dir: number, mode: string): string {
|
||||
const next = Math.max(-30, Math.min(35, n + dir));
|
||||
return (next < 0 ? '-' : '+') + String(Math.abs(next)).padStart(2, '0');
|
||||
}
|
||||
// RST/RS: the S digit is the one that moves. R and T are judgements about
|
||||
// readability and tone that a wheel has no business changing, and S is the
|
||||
// figure an operator actually adjusts.
|
||||
const m = /^(\d)(\d)(\d?)((?:\+\d+)?)$/.exec(v);
|
||||
// RST/RS, and the S9+ ladder above it. What an operator counts through is
|
||||
//
|
||||
// … 57 58 59 59+5 59+10 59+15 59+20 …
|
||||
//
|
||||
// — one S-unit up to nine, then five decibels at a time, because that is how
|
||||
// a strong signal is reported and how the S-meter is read (see sMeterRST).
|
||||
// Stepping the S digit and leaving the "+20" where it was would have gone
|
||||
// from 59+20 to 58+20, which nobody has ever said on the air.
|
||||
//
|
||||
// R and T do not move: they are judgements about readability and tone, and a
|
||||
// wheel has no business changing them.
|
||||
const m = /^(\d)(\d)(\d?)(?:\+(\d+))?$/.exec(v);
|
||||
if (!m) return v;
|
||||
const s = Math.max(1, Math.min(9, parseInt(m[2], 10) + dir));
|
||||
return m[1] + String(s) + m[3] + m[4];
|
||||
const head = m[1];
|
||||
const tone = m[3];
|
||||
let sUnit = parseInt(m[2], 10);
|
||||
let over = m[4] === undefined ? 0 : parseInt(m[4], 10);
|
||||
if (over > 0) {
|
||||
// Above S9: five at a time, and back down through +5 to a plain 59.
|
||||
over = Math.max(0, Math.min(60, over + dir * 5));
|
||||
} else if (sUnit >= 9 && dir > 0) {
|
||||
over = 5; // 59 → 59+5
|
||||
} else {
|
||||
sUnit = Math.max(1, Math.min(9, sUnit + dir));
|
||||
}
|
||||
return head + String(sUnit) + tone + (over > 0 ? '+' + over : '');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user