mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-02-02 16:23:58 +03:00
Standard Edtion avoid load process.js
This commit is contained in:
parent
6fd61b9591
commit
ecf1976837
@ -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();
|
||||
|
@ -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>;
|
||||
|
Loading…
Reference in New Issue
Block a user