Standard Edtion avoid load process.js

This commit is contained in:
w-okada 2023-11-23 06:46:12 +09:00
parent 6fd61b9591
commit ecf1976837
2 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
export type UseWebInfoProps = { export type UseWebInfoProps = {
clientState: ClientState | null; clientState: ClientState | null;
webEdition: boolean;
}; };
export const WebModelLoadingState = { export const WebModelLoadingState = {
@ -215,6 +216,10 @@ export const useWebInfo = (props: UseWebInfoProps): WebInfoStateAndMethod => {
console.warn("[useWebInfo] clientState is not initialized yet"); console.warn("[useWebInfo] clientState is not initialized yet");
return; return;
} }
if (!props.webEdition) {
console.warn("[useWebInfo] this is not web edition");
return;
}
console.log("loadVoiceChanagerModel1", voiceChangerConfig); console.log("loadVoiceChanagerModel1", voiceChangerConfig);
setWebModelLoadingState("loading"); setWebModelLoadingState("loading");
voiceChangerJSClient.current = new VoiceChangerJSClient(); voiceChangerJSClient.current = new VoiceChangerJSClient();

View File

@ -15,6 +15,7 @@ type AppStateValue = ClientState & {
audioContext: AudioContext; audioContext: AudioContext;
initializedRef: React.MutableRefObject<boolean>; initializedRef: React.MutableRefObject<boolean>;
webInfoState: WebInfoStateAndMethod; webInfoState: WebInfoStateAndMethod;
webEdition: boolean;
}; };
const AppStateContext = React.createContext<AppStateValue | null>(null); const AppStateContext = React.createContext<AppStateValue | null>(null);
@ -28,9 +29,10 @@ export const useAppState = (): AppStateValue => {
export const AppStateProvider = ({ children }: Props) => { export const AppStateProvider = ({ children }: Props) => {
const appRoot = useAppRoot(); const appRoot = useAppRoot();
const webEdition = appRoot.appGuiSettingState.edition.indexOf("web") >= 0;
const clientState = useVCClient({ audioContext: appRoot.audioContextState.audioContext }); const clientState = useVCClient({ audioContext: appRoot.audioContextState.audioContext });
const messageBuilderState = useMessageBuilder(); const messageBuilderState = useMessageBuilder();
const webInfoState = useWebInfo(clientState); const webInfoState = useWebInfo({ clientState: clientState.clientState, webEdition: webEdition });
// const voiceChangerJSClient = useRef<VoiceChangerJSClient>(); // const voiceChangerJSClient = useRef<VoiceChangerJSClient>();
useEffect(() => { useEffect(() => {
@ -70,6 +72,7 @@ export const AppStateProvider = ({ children }: Props) => {
...clientState.clientState, ...clientState.clientState,
initializedRef, initializedRef,
webInfoState, webInfoState,
webEdition,
}; };
return <AppStateContext.Provider value={providerValue}>{children}</AppStateContext.Provider>; return <AppStateContext.Provider value={providerValue}>{children}</AppStateContext.Provider>;