Bug fixes
This commit is contained in:
parent
98031676d6
commit
92d3fe496d
3 changed files with 9 additions and 7 deletions
|
|
@ -264,9 +264,9 @@ export class StrudelMirror {
|
||||||
console.warn('first frame could not be painted');
|
console.warn('first frame could not be painted');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async evaluate() {
|
async evaluate(autoplay = true) {
|
||||||
this.flash();
|
this.flash();
|
||||||
await this.repl.evaluate(this.code);
|
await this.repl.evaluate(this.code, autoplay);
|
||||||
}
|
}
|
||||||
async stop() {
|
async stop() {
|
||||||
this.repl.scheduler.stop();
|
this.repl.scheduler.stop();
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,11 @@ export async function renderPatternAudio(pattern, cps, begin, end, sampleRate, d
|
||||||
setSuperdoughAudioController(new SuperdoughAudioController(audioContext));
|
setSuperdoughAudioController(new SuperdoughAudioController(audioContext));
|
||||||
setMaxPolyphony(1024);
|
setMaxPolyphony(1024);
|
||||||
setMultiChannelOrbits(true);
|
setMultiChannelOrbits(true);
|
||||||
await loadWorklets();
|
await initAudio();
|
||||||
logger('[webaudio] start rendering');
|
logger('[webaudio] start rendering');
|
||||||
|
|
||||||
let haps = pattern.queryArc(begin, end, { _cps: cps });
|
let haps = pattern.queryArc(begin, end, { _cps: cps });
|
||||||
Promise.all(
|
await Promise.all(
|
||||||
haps.map(async (h) => {
|
haps.map(async (h) => {
|
||||||
let s;
|
let s;
|
||||||
if (h.value.s) {
|
if (h.value.s) {
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,8 @@ export function useReplContext() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleExport = async (begin, end, sampleRate, downloadName = undefined) => {
|
const handleExport = async (begin, end, sampleRate, downloadName = undefined) => {
|
||||||
await editorRef.current.evaluate();
|
await editorRef.current.evaluate(true);
|
||||||
|
editorRef.current.repl.scheduler.stop();
|
||||||
await renderPatternAudio(
|
await renderPatternAudio(
|
||||||
editorRef.current.repl.state.pattern,
|
editorRef.current.repl.state.pattern,
|
||||||
editorRef.current.repl.scheduler.cps,
|
editorRef.current.repl.scheduler.cps,
|
||||||
|
|
@ -214,8 +215,9 @@ export function useReplContext() {
|
||||||
end,
|
end,
|
||||||
sampleRate,
|
sampleRate,
|
||||||
downloadName,
|
downloadName,
|
||||||
);
|
).finally(() => {
|
||||||
editorRef.current.repl.scheduler.stop();
|
editorRef.current.repl.scheduler.stop();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const handleShuffle = async () => {
|
const handleShuffle = async () => {
|
||||||
const patternData = await getRandomTune();
|
const patternData = await getRandomTune();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue