Skip to content

Commit

Permalink
rename useStrudelCanvas to initStrudel
Browse files Browse the repository at this point in the history
  • Loading branch information
TodePond committed Feb 1, 2025
1 parent 30339c6 commit e69e012
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/hydra.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Hydra from 'hydra-synth';
import HydraRenderer from 'hydra-synth';

export class HydraSession {
constructor({ onError, canvas, onHighlight }) {
Expand All @@ -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,
});
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e69e012

Please sign in to comment.