change variable name
This commit is contained in:
parent
d5dfbd7aa4
commit
3a7b237765
5 changed files with 8 additions and 13 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { errorLogger } from '@strudel/core';
|
import { errorLogger } from '@strudel/core';
|
||||||
import { useSettings, storeStartupScript } from '../../../settings.mjs';
|
import { useSettings, storePrebakeScript } from '../../../settings.mjs';
|
||||||
import { SpecialActionInput } from '../button/action-button';
|
import { SpecialActionInput } from '../button/action-button';
|
||||||
|
|
||||||
async function importScript(script) {
|
async function importScript(script) {
|
||||||
|
|
@ -8,7 +8,7 @@ async function importScript(script) {
|
||||||
|
|
||||||
reader.onload = () => {
|
reader.onload = () => {
|
||||||
const text = reader.result;
|
const text = reader.result;
|
||||||
storeStartupScript(text);
|
storePrebakeScript(text);
|
||||||
};
|
};
|
||||||
|
|
||||||
reader.onerror = () => {
|
reader.onerror = () => {
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ export function SettingsTab({ started }) {
|
||||||
isTabIndentationEnabled,
|
isTabIndentationEnabled,
|
||||||
isMultiCursorEnabled,
|
isMultiCursorEnabled,
|
||||||
patternAutoStart,
|
patternAutoStart,
|
||||||
startupScript,
|
prebakeScript,
|
||||||
} = useSettings();
|
} = useSettings();
|
||||||
const shouldAlwaysSync = isUdels();
|
const shouldAlwaysSync = isUdels();
|
||||||
const canChangeAudioDevice = AudioContext.prototype.setSinkId != null;
|
const canChangeAudioDevice = AudioContext.prototype.setSinkId != null;
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,6 @@ const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL
|
||||||
const baseCDN = 'https://strudel.b-cdn.net';
|
const baseCDN = 'https://strudel.b-cdn.net';
|
||||||
|
|
||||||
export async function prebake() {
|
export async function prebake() {
|
||||||
// const settings = settingsMap.get()
|
|
||||||
|
|
||||||
// const prebakeScript = settings.startupScript || '';
|
|
||||||
// await evaluate(prebakeScript);
|
|
||||||
|
|
||||||
// https://archive.org/details/SalamanderGrandPianoV3
|
// https://archive.org/details/SalamanderGrandPianoV3
|
||||||
// License: CC-by http://creativecommons.org/licenses/by/3.0/ Author: Alexander Holm
|
// License: CC-by http://creativecommons.org/licenses/by/3.0/ Author: Alexander Holm
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ if (typeof window !== 'undefined') {
|
||||||
multiChannelOrbits: parseBoolean(multiChannelOrbits),
|
multiChannelOrbits: parseBoolean(multiChannelOrbits),
|
||||||
});
|
});
|
||||||
modulesLoading = loadModules();
|
modulesLoading = loadModules();
|
||||||
// prebakeScript = evaluate(settingsMap.get().startupScript ?? '')
|
// prebakeScript = evaluate(settingsMap.get().prebakeScript ?? '')
|
||||||
presets = prebake();
|
presets = prebake();
|
||||||
drawContext = getDrawContext();
|
drawContext = getDrawContext();
|
||||||
clearCanvas = () => drawContext.clearRect(0, 0, drawContext.canvas.height, drawContext.canvas.width);
|
clearCanvas = () => drawContext.clearRect(0, 0, drawContext.canvas.height, drawContext.canvas.width);
|
||||||
|
|
@ -64,7 +64,7 @@ async function getModule(name) {
|
||||||
const initialCode = `// LOADING`;
|
const initialCode = `// LOADING`;
|
||||||
|
|
||||||
export function useReplContext() {
|
export function useReplContext() {
|
||||||
const { isSyncEnabled, audioEngineTarget, startupScript } = useSettings();
|
const { isSyncEnabled, audioEngineTarget, prebakeScript } = useSettings();
|
||||||
const shouldUseWebaudio = audioEngineTarget !== audioEngineTargets.osc;
|
const shouldUseWebaudio = audioEngineTarget !== audioEngineTargets.osc;
|
||||||
const defaultOutput = shouldUseWebaudio ? webaudioOutput : superdirtOutput;
|
const defaultOutput = shouldUseWebaudio ? webaudioOutput : superdirtOutput;
|
||||||
const getTime = shouldUseWebaudio ? getAudioContextCurrentTime : getPerformanceTimeSeconds;
|
const getTime = shouldUseWebaudio ? getAudioContextCurrentTime : getPerformanceTimeSeconds;
|
||||||
|
|
@ -86,7 +86,7 @@ export function useReplContext() {
|
||||||
drawContext,
|
drawContext,
|
||||||
prebake: async () =>
|
prebake: async () =>
|
||||||
Promise.all([modulesLoading, presets]).then(() => {
|
Promise.all([modulesLoading, presets]).then(() => {
|
||||||
return evaluate(startupScript ?? '');
|
return evaluate(prebakeScript ?? '');
|
||||||
}),
|
}),
|
||||||
onUpdateState: (state) => {
|
onUpdateState: (state) => {
|
||||||
setReplState({ ...state });
|
setReplState({ ...state });
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export const defaultSettings = {
|
||||||
isPanelOpen: true,
|
isPanelOpen: true,
|
||||||
togglePanelTrigger: 'click', //click | hover
|
togglePanelTrigger: 'click', //click | hover
|
||||||
userPatterns: '{}',
|
userPatterns: '{}',
|
||||||
startupScript: '//edit this script to run code on startup\n',
|
prebakeScript: '',
|
||||||
audioEngineTarget: audioEngineTargets.webaudio,
|
audioEngineTarget: audioEngineTargets.webaudio,
|
||||||
isButtonRowHidden: false,
|
isButtonRowHidden: false,
|
||||||
isCSSAnimationDisabled: false,
|
isCSSAnimationDisabled: false,
|
||||||
|
|
@ -109,7 +109,7 @@ export const setActiveFooter = (tab) => settingsMap.setKey('activeFooter', tab);
|
||||||
export const setPanelPinned = (bool) => settingsMap.setKey('isPanelPinned', bool);
|
export const setPanelPinned = (bool) => settingsMap.setKey('isPanelPinned', bool);
|
||||||
export const setIsPanelOpened = (bool) => settingsMap.setKey('isPanelOpen', bool);
|
export const setIsPanelOpened = (bool) => settingsMap.setKey('isPanelOpen', bool);
|
||||||
|
|
||||||
export const storeStartupScript = (script) => settingsMap.setKey('startupScript', script);
|
export const storePrebakeScript = (script) => settingsMap.setKey('prebakeScript', script);
|
||||||
|
|
||||||
export const setIsZen = (active) => settingsMap.setKey('isZen', !!active);
|
export const setIsZen = (active) => settingsMap.setKey('isZen', !!active);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue