WIP non-realtime exporting

This commit is contained in:
Nikita 2025-10-19 14:35:23 +03:00
parent 6e58c973af
commit 0fbde61b2d
12 changed files with 217 additions and 31 deletions

View file

@ -6,6 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th
import createClock from './zyklus.mjs';
import { errorLogger, logger } from './logger.mjs';
import { loadBuffer, renderPatternAudio, setAudioContext, superdough } from '@strudel/webaudio';
export class Cyclist {
constructor({
@ -98,6 +99,7 @@ export class Cyclist {
this.started = v;
this.onToggle?.(v);
}
async start() {
await this.beforeStart?.();
this.num_ticks_since_cps_change = 0;
@ -109,6 +111,17 @@ export class Cyclist {
this.clock.start();
this.setStarted(true);
}
async exportAudio(begin, end) {
if (!this.pattern) {
throw new Error('Scheduler: no pattern set! call .setPattern first.');
}
logger('[cyclist] exporting');
// this.clock.start();
// this.setStarted(true);
await renderPatternAudio(this.pattern, this.cps, begin, end)
}
pause() {
logger('[cyclist] pause');
this.clock.pause();