Zoom the height of a sound's wave over its level scale (#357)

The Sound tab always drew the wave at the full height of the tab. Quiet
stretches were hard to see, and there was no room above a loud wave.

- A level scale in dB stands left of the wave, a mark every 6 dB down
  from 0, as long as a mark lies inside the area and at least 14 px
  from the middle.
- The wheel over the scale zooms the height, from 0.25x to 16x. Over
  the wave it zooms the time as before.
- What is louder than the area stops at its edge. The fade ramps grow
  with the wave.
- Fit puts the height back to 1x. The tab keeps the height with its
  view when another tab is shown.
- The rules live in waveView.ts (zoomLevel, levelMarks), the hooks
  give the height, the scale and the top of a full-scale wave.

Tests:
- Unit wave-view: 10 green (2 new), 2 counter-checks each red
- e2e 34 (melektaus-atx): ALL PASSED, 87 checks (1 new)
- Gate (melektaus-atx): CHECK EXIT 0, 270 files, 4183 tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-10-08 19:21:02 +02:00
1 parent 25c1d02b06
commit c7fa1d15b0
5 files changed
+245 -35

No files matched your search

+36
View File
@@ -1933,6 +1933,42 @@ export async function sound(t) {
tabOpened.info === '0.75 s',
JSON.stringify(tabOpened),
);
// 34h-2a. The wheel over the level scale left of the wave zooms its height (#357): out leaves room
// above a full-scale wave, in takes it past the top of the tab, the seconds stay where they
// are, and Fit brings back the full height.
const levelScale = await json('__gm.soundTab.scale()');
const levelRect = await json('__gm.soundTab.rect()');
const fullTop = await json('__gm.soundTab.fullScaleTop()');
const secondAt = (await json('__gm.soundTab.at(0.5)')).x;
await t.wheel(levelScale.x, levelScale.y, 924);
const zoomedOut = {
level: await json('__gm.soundTab.level()'),
top: await json('__gm.soundTab.fullScaleTop()'),
secondAt: (await json('__gm.soundTab.at(0.5)')).x,
};
await t.wheel(levelScale.x, levelScale.y, -1848);
const zoomedIn = {
level: await json('__gm.soundTab.level()'),
top: await json('__gm.soundTab.fullScaleTop()'),
};
const levelFit = await json('__gm.soundTab.fitButton()');
await click(levelFit.x, levelFit.y);
await sleep(100);
const refitted = {
level: await json('__gm.soundTab.level()'),
top: await json('__gm.soundTab.fullScaleTop()'),
};
check(
'the wheel over the level scale zooms the height alone, and Fit puts it back',
Math.abs(zoomedOut.level - 0.25) < 0.01 &&
Math.abs(zoomedOut.top - levelScale.y - (fullTop - levelScale.y) * 0.25) < 1 &&
zoomedOut.secondAt === secondAt &&
Math.abs(zoomedIn.level - 4) < 0.05 &&
zoomedIn.top < levelRect.y &&
refitted.level === 1 &&
Math.abs(refitted.top - fullTop) < 0.5,
JSON.stringify({ levelScale, levelRect, fullTop, secondAt, zoomedOut, zoomedIn, refitted }),
);
const droneProps = async () => (await assetsOfType('sound')).find((a) => a.id === droneId)?.props;
let dragFrom = await json('__gm.soundTab.at(0.75)');
let dragTo = await json('__gm.soundTab.at(0.5)');