mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
add butterchurn presets ignore constant for broken presets
This commit is contained in:
+2
-1
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import styles from './visualizer-settings-form.module.css';
|
import styles from './visualizer-settings-form.module.css';
|
||||||
|
|
||||||
import i18n from '/@/i18n/i18n';
|
import i18n from '/@/i18n/i18n';
|
||||||
|
import { getButterchurnPresetOptions } from '/@/renderer/features/visualizer/components/butternchurn/visualizer';
|
||||||
import { useSettingsStoreActions, useVisualizerSettings } from '/@/renderer/store/settings.store';
|
import { useSettingsStoreActions, useVisualizerSettings } from '/@/renderer/store/settings.store';
|
||||||
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
||||||
import { Button } from '/@/shared/components/button/button';
|
import { Button } from '/@/shared/components/button/button';
|
||||||
@@ -32,7 +33,7 @@ const loadButterchurnPresetOptions = async (): Promise<ButterchurnPresetOption[]
|
|||||||
if (butterchurnPresetOptionsCache) return butterchurnPresetOptionsCache;
|
if (butterchurnPresetOptionsCache) return butterchurnPresetOptionsCache;
|
||||||
|
|
||||||
const mod = await import('butterchurn-presets');
|
const mod = await import('butterchurn-presets');
|
||||||
const presets = (mod as any).default ?? mod;
|
const presets = getButterchurnPresetOptions((mod as any).default ?? mod);
|
||||||
const presetNames = Object.keys(presets);
|
const presetNames = Object.keys(presets);
|
||||||
|
|
||||||
butterchurnPresetOptionsCache = presetNames.map((presetName) => ({
|
butterchurnPresetOptionsCache = presetNames.map((presetName) => ({
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ import { Group } from '/@/shared/components/group/group';
|
|||||||
import { Text } from '/@/shared/components/text/text';
|
import { Text } from '/@/shared/components/text/text';
|
||||||
import { PlayerStatus } from '/@/shared/types/types';
|
import { PlayerStatus } from '/@/shared/types/types';
|
||||||
|
|
||||||
|
// Ignore presets that are erroring out
|
||||||
|
const IGNORED_PRESETS = ['Flexi + Martin - astral projection'];
|
||||||
|
|
||||||
type ButterchurnVisualizer = {
|
type ButterchurnVisualizer = {
|
||||||
connectAudio: (audioNode: AudioNode) => void;
|
connectAudio: (audioNode: AudioNode) => void;
|
||||||
loadPreset: (preset: any, blendTime: number) => void;
|
loadPreset: (preset: any, blendTime: number) => void;
|
||||||
@@ -28,6 +31,13 @@ type ButterchurnVisualizer = {
|
|||||||
setRendererSize: (width: number, height: number) => void;
|
setRendererSize: (width: number, height: number) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function getButterchurnPresetOptions(presets: Record<string, string>) {
|
||||||
|
if (!presets) return [];
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(presets).filter(([preset]) => !IGNORED_PRESETS.includes(preset)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const VisualizerInner = () => {
|
const VisualizerInner = () => {
|
||||||
const { webAudio } = useWebAudio();
|
const { webAudio } = useWebAudio();
|
||||||
const canvasRef = createRef<HTMLCanvasElement>();
|
const canvasRef = createRef<HTMLCanvasElement>();
|
||||||
@@ -62,7 +72,9 @@ const VisualizerInner = () => {
|
|||||||
|
|
||||||
if (isMounted) {
|
if (isMounted) {
|
||||||
butterchurnRef.current = butterchurnModule.default;
|
butterchurnRef.current = butterchurnModule.default;
|
||||||
butterchurnPresetsRef.current = presetsModule.default;
|
butterchurnPresetsRef.current = butterchurnPresetsRef.current =
|
||||||
|
getButterchurnPresetOptions(presetsModule.default);
|
||||||
|
|
||||||
setLibrariesLoaded(true);
|
setLibrariesLoaded(true);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -490,7 +502,9 @@ export const Visualizer = () => {
|
|||||||
try {
|
try {
|
||||||
const presetsModule = await import('butterchurn-presets');
|
const presetsModule = await import('butterchurn-presets');
|
||||||
if (isMounted) {
|
if (isMounted) {
|
||||||
butterchurnPresetsRef.current = presetsModule.default;
|
butterchurnPresetsRef.current = getButterchurnPresetOptions(
|
||||||
|
presetsModule.default,
|
||||||
|
);
|
||||||
setPresetsLoaded(true);
|
setPresetsLoaded(true);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user