Show a Sample node as a device that draws its waveform (#400)
The Sample was the last node of an instrument that still showed rows. It now draws the sound or clip it plays, so the loop and what plays after the note can be seen instead of read off two numbers. - SamplePanel, SampleFace and sampleView: a compact gold plate of 480x280 with the sound picker beside the name, a waveform screen, the four ways of playing it as buttons two by two, the root as a knob that reads as a note, a lever for following the note and the loop's start above its end. - The waveform comes from the library's peaks of the played sound, a clip's own cut included, scaled by the sound's volume. It is loaded on demand as the Reverb's sound is. - Each part has its colour: played once, looped, played after the note, never heard. The loop is held as playback holds it: an end of 0 or past the sound is the end, a start not before it loops all of it. - Idle settings come from the node's own idleParams, so the device greys out what the rows did. - A new instrument places its Output at x 840, past the device. At 460 it lay under the Sample. - Hook __gm.sample.panel and a check in e2e 34 behind the first instrument check. Tests: - Unit sample-view: 11 tests, new. pattern and chip-presets green. - e2e 34 (atx): ALL PASSED, 144 checks (1 new). - Gate (atx): 293 files, 4495 tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a6c00f7b8b
commit
6383cc0d8e
9 files changed
+1116
-8
No files matched your search
@@ -2611,6 +2611,59 @@ export async function sound(t) {
|
||||
insReady.keys.sounding.join() === [60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71].join(),
|
||||
JSON.stringify(insReady),
|
||||
);
|
||||
// #400: the Sample is a device of its own size whose screen draws the waveform of its sound, the
|
||||
// loop lit over all of it, and the Output sits clear of it. A play button and the root knob
|
||||
// are one undo step each, and the screen follows them.
|
||||
const insNodes = await json(
|
||||
`__gm.state.project.assets.find((a) => a.id === ${JSON.stringify(insId)}).graph.nodes`,
|
||||
);
|
||||
const smpId = insNodes.find((n) => n.type === 'InstrumentSample')?.id;
|
||||
const outAt = await json(
|
||||
`__gm.instrument.nodeAt(${JSON.stringify(insNodes.find((n) => n.type === 'InstrumentOutput')?.id)})`,
|
||||
);
|
||||
const smpPanel = () => json(`__gm.sample.panel(${JSON.stringify(smpId)})`);
|
||||
const smpParams = () =>
|
||||
json(
|
||||
`__gm.state.project.assets.find((a) => a.id === ${JSON.stringify(insId)}).graph.nodes.find((n) => n.id === ${JSON.stringify(smpId)}).params`,
|
||||
);
|
||||
const smpShown = await waitFor(smpPanel, (p) => p?.scope.columns > 0);
|
||||
await click(smpShown.plays.oneshot.x, smpShown.plays.oneshot.y);
|
||||
const smpOneShot = { params: await smpParams(), panel: await smpPanel() };
|
||||
const smpDial = smpShown.root.dial;
|
||||
await drag(smpDial.x, smpDial.y, smpDial.x, smpDial.y - 30);
|
||||
const smpRoot = { params: await smpParams(), panel: await smpPanel() };
|
||||
for (let i = 0; i < 2; i++) await press('z', { ctrl: true });
|
||||
const smpUndone = { params: await smpParams(), panel: await smpPanel() };
|
||||
const loopedAll = (p) => p.scope.regions.length === 1 && p.scope.regions[0].kind === 'loop';
|
||||
check(
|
||||
'a Sample node is a device whose screen draws the waveform of its sound; a play button and the root knob are one undo step each',
|
||||
smpShown.size.w === 480 &&
|
||||
smpShown.size.h === 280 &&
|
||||
smpShown.node.x + smpShown.node.w < outAt.x &&
|
||||
Object.values(smpShown.inputs).every((p) => p.x < smpShown.rect.x) &&
|
||||
Object.values(smpShown.outputs).every((p) => p.x > smpShown.rect.x + smpShown.rect.w) &&
|
||||
smpShown.sound.text !== 'No sound' &&
|
||||
smpShown.play === 'loop' &&
|
||||
smpShown.root.number === 'C4' &&
|
||||
smpShown.follow.on &&
|
||||
smpShown.idle.length === 0 &&
|
||||
loopedAll(smpShown) &&
|
||||
smpShown.scope.says.loop === 'LOOP' &&
|
||||
smpShown.scope.tallest > 0.1 &&
|
||||
smpShown.length !== '' &&
|
||||
smpOneShot.params.play === 'oneshot' &&
|
||||
smpOneShot.panel.play === 'oneshot' &&
|
||||
smpOneShot.panel.idle.includes('loopStart') &&
|
||||
smpOneShot.panel.scope.regions.map((r) => r.kind).join() === 'heard' &&
|
||||
smpOneShot.panel.scope.says.play === 'ONCE, ALL THE WAY THROUGH' &&
|
||||
Number(smpRoot.params.root) > 60 &&
|
||||
smpRoot.panel.scope.says.pitch === `AS IT IS AT ${smpRoot.panel.root.number}` &&
|
||||
smpUndone.params.play === 'loop' &&
|
||||
smpUndone.params.root === undefined &&
|
||||
smpUndone.panel.root.number === 'C4' &&
|
||||
loopedAll(smpUndone.panel),
|
||||
JSON.stringify({ smpShown, smpOneShot, smpRoot, smpUndone, outAt }),
|
||||
);
|
||||
await shot('34-instrument');
|
||||
|
||||
await evaluate('__gm.sound.stopAll()');
|
||||
|
||||
Reference in new issue
Block a user