Merge pull request 'add setDefault + resetDefaults to superdough' (#1433) from set-default-default into main
Reviewed-on: https://codeberg.org/uzu/strudel/pulls/1433
This commit is contained in:
commit
b0b2b6a120
2 changed files with 14 additions and 1 deletions
|
|
@ -126,7 +126,7 @@ export const getAudioDevices = async () => {
|
||||||
return devicesMap;
|
return devicesMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultDefaultValues = {
|
let defaultDefaultValues = {
|
||||||
s: 'triangle',
|
s: 'triangle',
|
||||||
gain: 0.8,
|
gain: 0.8,
|
||||||
postgain: 1,
|
postgain: 1,
|
||||||
|
|
@ -150,6 +150,17 @@ const defaultDefaultValues = {
|
||||||
fft: 8,
|
fft: 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const defaultDefaultDefaultValues = Object.freeze({ ...defaultDefaultValues });
|
||||||
|
|
||||||
|
export function setDefault(control, value) {
|
||||||
|
// const main = getControlName(control); // we cant do this because superdough is independent of strudel/core
|
||||||
|
defaultDefaultValues[control] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resetDefaults() {
|
||||||
|
defaultDefaultValues = { ...defaultDefaultDefaultValues };
|
||||||
|
}
|
||||||
|
|
||||||
let defaultControls = new Map(Object.entries(defaultDefaultValues));
|
let defaultControls = new Map(Object.entries(defaultDefaultValues));
|
||||||
|
|
||||||
export function setDefaultValue(key, value) {
|
export function setDefaultValue(key, value) {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import {
|
||||||
resetGlobalEffects,
|
resetGlobalEffects,
|
||||||
resetLoadedSounds,
|
resetLoadedSounds,
|
||||||
initAudioOnFirstClick,
|
initAudioOnFirstClick,
|
||||||
|
resetDefaults,
|
||||||
} from '@strudel/webaudio';
|
} from '@strudel/webaudio';
|
||||||
import { setVersionDefaultsFrom } from './util.mjs';
|
import { setVersionDefaultsFrom } from './util.mjs';
|
||||||
import { StrudelMirror, defaultSettings } from '@strudel/codemirror';
|
import { StrudelMirror, defaultSettings } from '@strudel/codemirror';
|
||||||
|
|
@ -181,6 +182,7 @@ export function useReplContext() {
|
||||||
|
|
||||||
const resetEditor = async () => {
|
const resetEditor = async () => {
|
||||||
(await getModule('@strudel/tonal'))?.resetVoicings();
|
(await getModule('@strudel/tonal'))?.resetVoicings();
|
||||||
|
resetDefaults();
|
||||||
resetGlobalEffects();
|
resetGlobalEffects();
|
||||||
clearCanvas();
|
clearCanvas();
|
||||||
clearHydra();
|
clearHydra();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue