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

View File

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