mirror of
https://codeberg.org/uzu/strudel
synced 2026-09-15 18:26:56 -04:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c74707e804 | |||
| af855a0c77 | |||
| 604a1b770c | |||
| 2aa978ca5b | |||
| 0571a8dc7d | |||
| a8a919f581 |
@@ -68,7 +68,7 @@ Pattern.prototype.serial = function (br = 115200, sendcrc = false, singlecharids
|
|||||||
if (!(name in writeMessagers)) {
|
if (!(name in writeMessagers)) {
|
||||||
getWriter(name, br);
|
getWriter(name, br);
|
||||||
}
|
}
|
||||||
const onTrigger = (t_deprecate, hap, currentTime, cps, targetTime) => {
|
const onTrigger = (hap, currentTime, _cps, targetTime) => {
|
||||||
var message = '';
|
var message = '';
|
||||||
var chk = 0;
|
var chk = 0;
|
||||||
if (typeof hap.value === 'object') {
|
if (typeof hap.value === 'object') {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default function ExportTab(Props) {
|
|||||||
<div className="flex flex-row gap-4 w-full">
|
<div className="flex flex-row gap-4 w-full">
|
||||||
<FormItem label="Start cycle" disabled={exporting}>
|
<FormItem label="Start cycle" disabled={exporting}>
|
||||||
<Textbox
|
<Textbox
|
||||||
min={1}
|
min={0}
|
||||||
max={Infinity}
|
max={Infinity}
|
||||||
onBlur={(e) => {
|
onBlur={(e) => {
|
||||||
let v = parseInt(e.target.value);
|
let v = parseInt(e.target.value);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { errorLogger } from '@strudel/core';
|
import { errorLogger } from '@strudel/core';
|
||||||
import { useSettings, storePrebakeScript } from '../../../settings.mjs';
|
import { useSettings, storePrebakeScript } from '../../../settings.mjs';
|
||||||
import { SpecialActionInput } from '../button/action-button';
|
import { SpecialActionInput } from '../button/action-button';
|
||||||
|
import { confirmDialog, SETTING_CHANGE_RELOAD_MSG } from '@src/repl/util.mjs';
|
||||||
|
|
||||||
async function importScript(script) {
|
async function importScript(script) {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
@@ -23,7 +24,19 @@ export function ImportPrebakeScriptButton() {
|
|||||||
type="file"
|
type="file"
|
||||||
label="import prebake script"
|
label="import prebake script"
|
||||||
accept=".strudel"
|
accept=".strudel"
|
||||||
onChange={(e) => importScript(e.target.files[0])}
|
onChange={async (e) => {
|
||||||
|
const file = e.target.files[0];
|
||||||
|
const confirmed = await confirmDialog(SETTING_CHANGE_RELOAD_MSG);
|
||||||
|
if (!confirmed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await importScript(file);
|
||||||
|
window.location.reload();
|
||||||
|
} catch (e) {
|
||||||
|
errorLogger(e);
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { defaultSettings, settingsMap, useSettings } from '../../../settings.mjs';
|
import { defaultSettings, settingsMap, useSettings } from '../../../settings.mjs';
|
||||||
import { themes } from '@strudel/codemirror';
|
import { themes } from '@strudel/codemirror';
|
||||||
import { Textbox } from '../textbox/Textbox.jsx';
|
import { Textbox } from '../textbox/Textbox.jsx';
|
||||||
import { isUdels } from '../../util.mjs';
|
import { confirmAndReloadPage, isUdels } from '../../util.mjs';
|
||||||
import { ButtonGroup } from './Forms.jsx';
|
import { ButtonGroup } from './Forms.jsx';
|
||||||
import { AudioDeviceSelector } from './AudioDeviceSelector.jsx';
|
import { AudioDeviceSelector } from './AudioDeviceSelector.jsx';
|
||||||
import { AudioEngineTargetSelector } from './AudioEngineTargetSelector.jsx';
|
import { AudioEngineTargetSelector } from './AudioEngineTargetSelector.jsx';
|
||||||
import { confirmDialog } from '../../util.mjs';
|
import { confirmDialog } from '../../util.mjs';
|
||||||
import { DEFAULT_MAX_POLYPHONY, setMaxPolyphony, setMultiChannelOrbits } from '@strudel/webaudio';
|
import { DEFAULT_MAX_POLYPHONY, setMaxPolyphony, setMultiChannelOrbits } from '@strudel/webaudio';
|
||||||
import { ActionButton, SpecialActionButton } from '../button/action-button.jsx';
|
import { SpecialActionButton } from '../button/action-button.jsx';
|
||||||
import { ImportPrebakeScriptButton } from './ImportPrebakeScriptButton.jsx';
|
import { ImportPrebakeScriptButton } from './ImportPrebakeScriptButton.jsx';
|
||||||
|
|
||||||
function Checkbox({ label, value, onChange, disabled = false }) {
|
function Checkbox({ label, value, onChange, disabled = false }) {
|
||||||
@@ -86,8 +86,6 @@ const fontFamilyOptions = {
|
|||||||
galactico: 'galactico',
|
galactico: 'galactico',
|
||||||
};
|
};
|
||||||
|
|
||||||
const RELOAD_MSG = 'Changing this setting requires the window to reload itself. OK?';
|
|
||||||
|
|
||||||
export function SettingsTab({ started }) {
|
export function SettingsTab({ started }) {
|
||||||
const {
|
const {
|
||||||
theme,
|
theme,
|
||||||
@@ -127,11 +125,8 @@ export function SettingsTab({ started }) {
|
|||||||
isDisabled={started}
|
isDisabled={started}
|
||||||
audioDeviceName={audioDeviceName}
|
audioDeviceName={audioDeviceName}
|
||||||
onChange={(audioDeviceName) => {
|
onChange={(audioDeviceName) => {
|
||||||
confirmDialog(RELOAD_MSG).then((r) => {
|
confirmAndReloadPage(() => {
|
||||||
if (r == true) {
|
settingsMap.setKey('audioDeviceName', audioDeviceName);
|
||||||
settingsMap.setKey('audioDeviceName', audioDeviceName);
|
|
||||||
return window.location.reload();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -141,11 +136,8 @@ export function SettingsTab({ started }) {
|
|||||||
<AudioEngineTargetSelector
|
<AudioEngineTargetSelector
|
||||||
target={audioEngineTarget}
|
target={audioEngineTarget}
|
||||||
onChange={(target) => {
|
onChange={(target) => {
|
||||||
confirmDialog(RELOAD_MSG).then((r) => {
|
confirmAndReloadPage(() => {
|
||||||
if (r == true) {
|
settingsMap.setKey('audioEngineTarget', target);
|
||||||
settingsMap.setKey('audioEngineTarget', target);
|
|
||||||
return window.location.reload();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -175,12 +167,9 @@ export function SettingsTab({ started }) {
|
|||||||
label="Multi Channel Orbits"
|
label="Multi Channel Orbits"
|
||||||
onChange={(cbEvent) => {
|
onChange={(cbEvent) => {
|
||||||
const val = cbEvent.target.checked;
|
const val = cbEvent.target.checked;
|
||||||
confirmDialog(RELOAD_MSG).then((r) => {
|
confirmAndReloadPage(() => {
|
||||||
if (r == true) {
|
settingsMap.setKey('multiChannelOrbits', val);
|
||||||
settingsMap.setKey('multiChannelOrbits', val);
|
setMultiChannelOrbits(val);
|
||||||
setMultiChannelOrbits(val);
|
|
||||||
return window.location.reload();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
value={multiChannelOrbits}
|
value={multiChannelOrbits}
|
||||||
@@ -297,11 +286,8 @@ export function SettingsTab({ started }) {
|
|||||||
label="Sync across Browser Tabs / Windows"
|
label="Sync across Browser Tabs / Windows"
|
||||||
onChange={(cbEvent) => {
|
onChange={(cbEvent) => {
|
||||||
const newVal = cbEvent.target.checked;
|
const newVal = cbEvent.target.checked;
|
||||||
confirmDialog(RELOAD_MSG).then((r) => {
|
confirmAndReloadPage(() => {
|
||||||
if (r) {
|
settingsMap.setKey('isSyncEnabled', newVal);
|
||||||
settingsMap.setKey('isSyncEnabled', newVal);
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
disabled={shouldAlwaysSync}
|
disabled={shouldAlwaysSync}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { code2hash, evalScope, hash2code, logger } from '@strudel/core';
|
import { code2hash, errorLogger, evalScope, hash2code, logger } from '@strudel/core';
|
||||||
import { settingPatterns } from '../settings.mjs';
|
import { settingPatterns } from '../settings.mjs';
|
||||||
import { setVersionDefaults } from '@strudel/webaudio';
|
import { setVersionDefaults } from '@strudel/webaudio';
|
||||||
import { getMetadata } from '../metadata_parser';
|
import { getMetadata } from '../metadata_parser';
|
||||||
@@ -107,7 +107,19 @@ export function confirmDialog(msg) {
|
|||||||
resolve(confirmed);
|
resolve(confirmed);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
export const SETTING_CHANGE_RELOAD_MSG = 'Changing this setting requires the window to reload itself. OK?';
|
||||||
|
export function confirmAndReloadPage(onSuccess) {
|
||||||
|
confirmDialog(SETTING_CHANGE_RELOAD_MSG).then((r) => {
|
||||||
|
if (r == true) {
|
||||||
|
try {
|
||||||
|
onSuccess();
|
||||||
|
return window.location.reload();
|
||||||
|
} catch (e) {
|
||||||
|
errorLogger(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
//RIP due to SPAM
|
//RIP due to SPAM
|
||||||
// let lastShared;
|
// let lastShared;
|
||||||
// export async function shareCode(codeToShare) {
|
// export async function shareCode(codeToShare) {
|
||||||
|
|||||||
Reference in New Issue
Block a user