figuring out backend integration

This commit is contained in:
Jade Rowland
2023-09-27 15:28:23 -04:00
parent 172006a3b3
commit 6719c6127b
2 changed files with 20 additions and 20 deletions
+19
View File
@@ -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(
+1 -20
View File
@@ -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();