Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit b233c33

Browse files
fnordomatfnordomat
authored andcommitted
(squash me) save setting in variable, not store
1 parent e3b6884 commit b233c33

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

packages/soundfonts/fontloader.mjs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { persistentMap } from '@nanostores/persistent';
21
import { noteToMidi, freqToMidi, getSoundIndex } from '@strudel/core';
32
import {
43
getAudioContext,
@@ -10,18 +9,11 @@ import {
109
} from '@strudel/webaudio';
1110
import gm from './gm.mjs';
1211

13-
export const defaultFontloaderConfig = {
14-
soundfontUrl: 'https://felixroos.github.io/webaudiofontdata/sound'
15-
}
16-
17-
export const fontloaderConfigMap = persistentMap('strudel-config-fontloader', defaultFontloaderConfig);
18-
19-
export function setSoundfontUrl(obj) {
20-
fontloaderConfigMap.setKey('soundfontUrl', JSON.stringify(obj));
21-
}
12+
let defaultSoundfontUrl = 'https://felixroos.github.io/webaudiofontdata/sound';
13+
let soundfontUrl = defaultSoundfontUrl;
2214

23-
export function getSoundfontUrl() {
24-
return JSON.parse(fontloaderConfigMap.get().soundfontUrl);
15+
export function setSoundfontUrl(value) {
16+
soundfontUrl = value;
2517
}
2618

2719
let loadCache = {};
@@ -31,7 +23,7 @@ async function loadFont(name) {
3123
}
3224
const load = async () => {
3325
// TODO: make soundfont source configurable
34-
const url = `${getSoundfontUrl()}/${name}.js`;
26+
const url = `${soundfontUrl}/${name}.js`;
3527
const preset = await fetch(url).then((res) => res.text());
3628
let [_, data] = preset.split('={');
3729
return eval('{' + data);

0 commit comments

Comments
 (0)