mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-26 21:18:49 +00:00
load imported samples directly in prebake
This commit is contained in:
parent
e2a082f748
commit
8bde87246b
@ -21,7 +21,6 @@ import {
|
|||||||
import { Header } from './Header';
|
import { Header } from './Header';
|
||||||
import Loader from './Loader';
|
import Loader from './Loader';
|
||||||
import './Repl.css';
|
import './Repl.css';
|
||||||
import { registerSamplesFromDB, userSamplesDBConfig } from './idbutils.mjs';
|
|
||||||
import { Panel } from './panel/Panel';
|
import { Panel } from './panel/Panel';
|
||||||
import { prebake } from './prebake.mjs';
|
import { prebake } from './prebake.mjs';
|
||||||
import { themes } from './themes.mjs';
|
import { themes } from './themes.mjs';
|
||||||
@ -117,7 +116,6 @@ export function Repl({ embedded = false }) {
|
|||||||
msg = `A random code snippet named "${name}" has been loaded!`;
|
msg = `A random code snippet named "${name}" has been loaded!`;
|
||||||
}
|
}
|
||||||
//registers samples that have been saved to the index DB
|
//registers samples that have been saved to the index DB
|
||||||
registerSamplesFromDB(userSamplesDBConfig);
|
|
||||||
logger(`Welcome to Strudel! ${msg} Press play or hit ctrl+enter to run it!`, 'highlight');
|
logger(`Welcome to Strudel! ${msg} Press play or hit ctrl+enter to run it!`, 'highlight');
|
||||||
setPending(false);
|
setPending(false);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -24,7 +24,7 @@ const clearIDB = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// queries the DB, and registers the sounds so they can be played
|
// queries the DB, and registers the sounds so they can be played
|
||||||
export const registerSamplesFromDB = (config, onComplete = () => {}) => {
|
export const registerSamplesFromDB = (config = userSamplesDBConfig, onComplete = () => {}) => {
|
||||||
openDB(config, (objectStore) => {
|
openDB(config, (objectStore) => {
|
||||||
let query = objectStore.getAll();
|
let query = objectStore.getAll();
|
||||||
query.onsuccess = (event) => {
|
query.onsuccess = (event) => {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Pattern, noteToMidi, valueToMidi } from '@strudel.cycles/core';
|
import { Pattern, noteToMidi, valueToMidi } from '@strudel.cycles/core';
|
||||||
import { registerSynthSounds, registerZZFXSounds, samples } from '@strudel.cycles/webaudio';
|
import { registerSynthSounds, registerZZFXSounds, samples } from '@strudel.cycles/webaudio';
|
||||||
|
import { registerSamplesFromDB } from './idbutils.mjs';
|
||||||
import './piano.mjs';
|
import './piano.mjs';
|
||||||
import './files.mjs';
|
import './files.mjs';
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ export async function prebake() {
|
|||||||
await Promise.all([
|
await Promise.all([
|
||||||
registerSynthSounds(),
|
registerSynthSounds(),
|
||||||
registerZZFXSounds(),
|
registerZZFXSounds(),
|
||||||
|
registerSamplesFromDB(),
|
||||||
//registerSoundfonts(),
|
//registerSoundfonts(),
|
||||||
// need dynamic import here, because importing @strudel.cycles/soundfonts fails on server:
|
// need dynamic import here, because importing @strudel.cycles/soundfonts fails on server:
|
||||||
// => getting "window is not defined", as soon as "@strudel.cycles/soundfonts" is imported statically
|
// => getting "window is not defined", as soon as "@strudel.cycles/soundfonts" is imported statically
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user