mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
Merge pull request #189 from tidalcycles/fix-188
wait for prebake to finish before evaluating
This commit is contained in:
commit
745c37f2d1
@ -219,12 +219,12 @@ function App() {
|
||||
className="hover:bg-gray-300 p-2"
|
||||
onClick={async () => {
|
||||
const _code = getRandomTune();
|
||||
console.log('tune', _code); // uncomment this to debug when random code fails
|
||||
// console.log('tune', _code); // uncomment this to debug when random code fails
|
||||
setCode(_code);
|
||||
cleanupDraw();
|
||||
cleanupUi();
|
||||
resetLoadedSamples();
|
||||
prebake();
|
||||
await prebake(); // declare default samples
|
||||
const parsed = await evaluate(_code);
|
||||
setPattern(parsed.pattern);
|
||||
setActiveCode(_code);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Pattern, toMidi } from '@strudel.cycles/core';
|
||||
import { samples } from '@strudel.cycles/webaudio';
|
||||
|
||||
export function prebake(isMock = false) {
|
||||
export async function prebake(isMock = false) {
|
||||
samples(
|
||||
{
|
||||
piano: {
|
||||
@ -42,7 +42,7 @@ export function prebake(isMock = false) {
|
||||
'./piano/',
|
||||
);
|
||||
if (!isMock) {
|
||||
fetch('EmuSP12.json')
|
||||
await fetch('EmuSP12.json')
|
||||
.then((res) => res.json())
|
||||
.then((json) => samples(json, './EmuSP12/'));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user