Corregir rutas de Butterchurn en node_modules y aislar el arranque de cada motor
Butterchurn publica sus builds en lib/ (butterchurn.min.js y butterchurnPresets.min.js), no en dist/base.min.js. El instalador ahora busca los ficheros por nombre con find_copy, robusto a cambios de carpeta entre versiones. Ademas el escenario inicia cada motor por separado: si una libreria falta, los demas siguen funcionando (antes un fallo de Butterchurn impedia que Hydra se inicializara, de ahi el error 'src is not defined'). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e3db98b089
commit
c8b51615ba
2 changed files with 36 additions and 17 deletions
|
|
@ -521,6 +521,7 @@ function applyState(next) {
|
|||
if (hydra) hydra.hush();
|
||||
if (shaderEngine) shaderEngine.stop();
|
||||
mixerSig = "";
|
||||
if (!bcViz) { show(null); return; }
|
||||
show(bcCanvas);
|
||||
startButterchurn();
|
||||
const wanted = state.butterchurn.preset;
|
||||
|
|
@ -532,6 +533,7 @@ function applyState(next) {
|
|||
stopButterchurn();
|
||||
if (shaderEngine) shaderEngine.stop();
|
||||
mixerSig = "";
|
||||
if (!hydra) { show(null); return; }
|
||||
show(hydraCanvas);
|
||||
if (state.hydra.code !== hydraCode) runHydraCode(state.hydra.code);
|
||||
|
||||
|
|
@ -539,6 +541,7 @@ function applyState(next) {
|
|||
stopButterchurn();
|
||||
if (hydra) hydra.hush();
|
||||
mixerSig = "";
|
||||
if (!shaderEngine) { show(null); return; }
|
||||
show(shaderCanvas);
|
||||
if (shaderEngine && state.shaders.code !== shaderCode) {
|
||||
if (shaderEngine.load(state.shaders.code)) shaderCode = state.shaders.code;
|
||||
|
|
@ -548,6 +551,7 @@ function applyState(next) {
|
|||
} else if (state.engine === "mixer") {
|
||||
stopButterchurn();
|
||||
if (shaderEngine) shaderEngine.stop();
|
||||
if (!hydra) { show(null); return; }
|
||||
show(hydraCanvas);
|
||||
applyMixer(state.mixer);
|
||||
}
|
||||
|
|
@ -579,24 +583,30 @@ window.addEventListener("resize", () => {
|
|||
// Arranque
|
||||
// ==========================================================================
|
||||
async function boot() {
|
||||
// El audio es la base de todo: si falla, no se puede continuar.
|
||||
try {
|
||||
if (typeof Hydra === "undefined" || typeof butterchurn === "undefined") {
|
||||
report("error", "Faltan librerias de visuales. Ejecuta install.sh "
|
||||
+ "de nuevo en la Raspberry.");
|
||||
msgEl.textContent = "ERROR: faltan librerias";
|
||||
return;
|
||||
}
|
||||
await initAudio();
|
||||
initButterchurn();
|
||||
initHydra();
|
||||
shaderEngine = new ShaderEngine(shaderCanvas, analyser);
|
||||
beatLoop();
|
||||
msgEl.textContent = "FOSFENO listo";
|
||||
} catch (err) {
|
||||
report("error", "Fallo al arrancar el escenario: " + err.message
|
||||
+ ". Si menciona el microfono, comprueba que esta conectado.");
|
||||
msgEl.textContent = "ERROR: " + err.message;
|
||||
report("error", "No se pudo iniciar el audio: " + err.message
|
||||
+ ". Comprueba el microfono y recarga la pagina.");
|
||||
msgEl.textContent = "ERROR: audio (" + err.message + ")";
|
||||
return;
|
||||
}
|
||||
// Cada motor se inicia por separado: si una libreria falta o falla, los
|
||||
// demas motores siguen funcionando igual.
|
||||
try {
|
||||
if (typeof butterchurn !== "undefined") initButterchurn();
|
||||
else report("warn", "Butterchurn no esta disponible (libreria no copiada).");
|
||||
} catch (e) { report("error", "Butterchurn fallo al iniciar: " + e.message); }
|
||||
try {
|
||||
if (typeof Hydra !== "undefined") initHydra();
|
||||
else report("error", "Hydra no esta disponible (libreria no copiada).");
|
||||
} catch (e) { report("error", "Hydra fallo al iniciar: " + e.message); }
|
||||
try {
|
||||
shaderEngine = new ShaderEngine(shaderCanvas, analyser);
|
||||
} catch (e) { report("error", "El motor de shaders fallo: " + e.message); }
|
||||
msgEl.textContent = "FOSFENO listo";
|
||||
}
|
||||
|
||||
boot();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue