diff --git a/packages/core/cyclist.mjs b/packages/core/cyclist.mjs index e07722b77..9cabceb45 100644 --- a/packages/core/cyclist.mjs +++ b/packages/core/cyclist.mjs @@ -7,6 +7,7 @@ This program is free software: you can redistribute it and/or modify it under th import createClock from './zyklus.mjs'; import { logger } from './logger.mjs'; import { Invoke } from '../../website/src/tauri.mjs'; +import { listen } from '@tauri-apps/api/event'; export class Cyclist { constructor({ interval, onTrigger, onToggle, onError, getTime, latency = 0.1 }) { @@ -17,6 +18,24 @@ export class Cyclist { this.lastEnd = 0; // query end of last tick this.getTime = getTime; // get absolute time this.onToggle = onToggle; + // this.abeLinkListener = listen('abelink-event', async (e) => { + // const payload = e?.payload; + // if (payload == null) { + // return; + // } + // const { play, bpm, timestamp } = payload; + // console.log('play'); + + // if (this.started !== play && play != null) { + // if (play) { + // this.start(); + // } else { + // this.stop(); + // } + // } + + // const { message, message_type } = e.payload; + // }); this.latency = latency; // fixed trigger time offset const round = (x) => Math.round(x * 1000) / 1000; this.clock = createClock( diff --git a/packages/react/src/hooks/useStrudel.mjs b/packages/react/src/hooks/useStrudel.mjs index 5c9ca374d..93674af5a 100644 --- a/packages/react/src/hooks/useStrudel.mjs +++ b/packages/react/src/hooks/useStrudel.mjs @@ -128,26 +128,6 @@ function useStrudel({ } }; - // useEffect(() => { - // async function listenForAbelinkMessage() { - // await listen('abelink-event', async (e) => { - // const payload = e?.payload; - // if (payload == null) { - // return; - // } - // const { play, bpm, timestamp } = payload; - // console.log(scheduler.started); - - // if (scheduler.started !== play && play != null) { - // togglePlay(); - // } - - // const { message, message_type } = e.payload; - // }); - // } - // listenForAbelinkMessage(); - // }, []); - listen('abelink-event', async (e) => { const payload = e?.payload; if (payload == null) { @@ -157,6 +137,7 @@ function useStrudel({ if (started !== play && play != null) { if (play) { + // activateCode(); start(); } else { stop();