<?phpnamespace Tests;use App\Scene\FilmScene;use JumPHP\Testing\GameTestCase;/** TEMP: the voices each scene plays (tools/warm-notes). */final class WarmGenTest extends GameTestCase{ public function testGen(): void { if (!is_file(getcwd() . '/tests/.warmgen')) { self::markTestSkipped('gen'); } $all = []; foreach (FilmScene::TEMPLATES as $name => $class) { $names = []; foreach ([3, 11, 27] as $seed) { $this->game->start($class, ['seed' => $seed, 'seconds' => 30]); $scene = $this->game->scene(); $rec = $this->game->peek('recorder'); for ($i = 0; $i < 60 * 30; $i++) { $scene->update(1 / 60); } foreach ($rec->notes() as $n) { if ($n['wave'] === 'pad' || $n['wave'] === 'purr') { continue; // heard in the film only } $names[$n['wave'] . '|' . (int)round($n['freq']) . '|' . (int)round(min(1.0, $n['length']) * 100)] = [$n['wave'], round($n['freq'], 3), min(1.0, $n['length']), $n['volume']]; } } $all[$class] = array_values($names); } file_put_contents(getcwd() . '/var/warm.json', json_encode($all)); self::assertTrue(true); }}