Transporte: al cargar un track el loop arranca desde cero
Some checks are pending
Build and Deploy to warm (strudel.cc) / build (push) Waiting to run
Strudel tests / build (20) (push) Waiting to run

Cargar un proyecto (pestaña Projects o anterior/siguiente de la barra) deja
pendiente un reinicio que se aplica en la siguiente evaluacion: el tema nuevo
empieza en el ciclo 0 aunque el reloj del scheduler siga corriendo. Editar y
actualizar en vivo no reinicia nada. Funciona con Cyclist y NeoCyclist (ambos
tienen setCycle).

README-HACKLAB mas breve y con enlaces: upstream, TidalCycles, algorave,
librerias de samples y video introductorio.
This commit is contained in:
hacklab 2026-07-17 02:00:08 +02:00
parent b6dbe97a62
commit 921647020c
4 changed files with 53 additions and 42 deletions

View file

@ -35,6 +35,7 @@ import { audioEngineTargets } from '../settings.mjs';
import { useStore } from '@nanostores/react';
import { prebake } from './prebake.mjs';
import { getRandomTune, initCode, loadModules, shareCode } from './util.mjs';
import { $resetPending } from './components/panel/ProjectsTab.jsx';
import './Repl.css';
import { setInterval, clearInterval } from 'worker-timers';
import { getMetadata } from '../metadata_parser';
@ -104,6 +105,11 @@ export function useReplContext() {
beforeEval: () => audioReady,
afterEval: (all) => {
const { code } = all;
// track recien cargado desde Projects: el loop arranca desde cero
if ($resetPending.get()) {
$resetPending.set(false);
editorRef.current?.repl?.scheduler?.setCycle?.(0);
}
//post to iframe parent (like Udels) if it exists...
window.parent?.postMessage(code);