From e69e012584c630dfa348b0d5c01334cd026fb46c Mon Sep 17 00:00:00 2001 From: "Lu[ke] Wilson" Date: Sat, 1 Feb 2025 17:19:22 +0000 Subject: [PATCH] rename `useStrudelCanvas` to `initStrudel` --- src/hydra.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/hydra.js b/src/hydra.js index 6d7cc91..db59dc4 100644 --- a/src/hydra.js +++ b/src/hydra.js @@ -1,4 +1,4 @@ -import Hydra from 'hydra-synth'; +import HydraRenderer from 'hydra-synth'; export class HydraSession { constructor({ onError, canvas, onHighlight }) { @@ -23,7 +23,7 @@ export class HydraSession { try { this.canvas.width = window.innerWidth; this.canvas.height = window.innerHeight; - this._hydra = new Hydra({ + this._hydra = new HydraRenderer({ canvas: this.canvas, enableAudio: false, }); @@ -57,13 +57,19 @@ export class HydraSession { // initialized a streaming canvas with the strudel draw context canvas // this allows us to use the strudel output - window.useStrudelCanvas = (s) => { + window.initStrudel = (s) => { if (window.parent.strudel == undefined) return; const canvas = window.parent.strudel.draw.getDrawContext().canvas; canvas.style.display = 'none'; s.init({ src: canvas }); }; + window.useStrudelCanvas = () => { + throw Error("'useStrudelCanvas' has been renamed to 'initStrudel'"); + }; + + // console.log(hydra); + const clamp = (num, min, max) => Math.min(Math.max(num, min), max); // Enables Hydra to use Strudel frequency data