In cima a Via dell'Antica Posta si arriva sotto la console dell'underground (il marciapiede di destra, fino in fondo); sotto una console le altre calano fino al loro filo, così lì si sente la sola musica di quella (Andrea)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiECd9RWGMKV7n3K1mdy8T
This commit is contained in:
2026-10-31 15:09:45 +01:00
co-authored by Claude Opus 5.5
parent 04f9a5cb12
commit 23aa9c4788
3 changed files with 27 additions and 7 deletions
+13
View File
@@ -6,6 +6,7 @@ import { newIncanto, updateIncanto, drawIncanto, whiteness, T } from '../src/eng
import { Game, check, POSTER_READY } from '../src/engine/game.js';
import { story } from '../src/story/story.js';
import { settle } from './helpers.mjs';
import { inside as inPolygon, findPath } from '../src/engine/geometry.js';
import { render } from '../src/engine/render.js';
const ZONE = story.zones.find(z => z.flag === 'ingorgo');
@@ -36,6 +37,18 @@ test('la miscela delle console: vicino a una si sente quella, fra due tutte e du
assert.deepEqual(on.map(t => t.src), ['a.mp3', 'b.mp3']);
});
test('sotto una console si sente la sola musica di quella: in cima a Via dell\'Antica Posta, il marciapiede sotto l\'underground', () => {
const sc = story.scenes.antica_posta_alta, ok = cond => cond === 'ingorgo';
const spot = [620, 350];
assert.ok(inPolygon(sc.walk, spot) && findPath(sc.walk, sc.entry, spot), 'ci si arriva a piedi');
const under = trackFor(story, { screen: 'game', scene: 'antica_posta_alta', at: spot, ok });
assert.equal(under[0].src, 'assets/audio/ingorgo-underground.mp3'); assert.equal(under[0].gain, 1);
for (const t of under.slice(1)) assert.ok(t.gain <= 0.1, `${t.src} solo un filo: ${t.gain.toFixed(2)}`);
// A metà della strada, invece, la miscela resta.
const mid = trackFor(story, { screen: 'game', scene: 'antica_posta_alta', at: [240, 300], ok });
assert.ok(mid.filter(t => t.gain > 0.15).length >= 2);
});
test('la musica suona più brani insieme e li fa sfumare quando si cambia piazza', () => {
globalThis.Audio = class { constructor(src) { this.src = src; this.volume = 0; this.paused = true; } play() { this.paused = false; return Promise.resolve(); } pause() { this.paused = true; } };
const m = new Music({ volume: 0.5 });