disable unrecommended fodet on directml ver

This commit is contained in:
w-okada 2023-09-22 01:06:02 +09:00
parent 7febd37198
commit ee6ba8ee90
2 changed files with 105 additions and 49 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,17 +1,52 @@
import React, { useMemo } from "react"
import { useAppState } from "../../../001_provider/001_AppStateProvider"
import { F0Detector, } from "@dannadori/voice-changer-client-js"
import React, { useMemo } from "react";
import { useAppState } from "../../../001_provider/001_AppStateProvider";
import { F0Detector } from "@dannadori/voice-changer-client-js";
import { useAppRoot } from "../../../001_provider/001_AppRootProvider";
export type QualityAreaProps = {
detectors: string[]
}
detectors: string[];
};
export const QualityArea = (props: QualityAreaProps) => {
const { setVoiceChangerClientSetting, serverSetting, setting } = useAppState()
const { setVoiceChangerClientSetting, serverSetting, setting } = useAppState();
const { appGuiSettingState } = useAppRoot();
const edition = appGuiSettingState.edition;
const qualityArea = useMemo(() => {
if (!serverSetting.updateServerSettings || !setVoiceChangerClientSetting || !serverSetting.serverSetting || !setting) {
return <></>
return <></>;
}
const generateF0DetOptions = () => {
if (edition.indexOf("onnxdirectML-cuda") >= 0) {
const recommended = ["crepe_tiny", "rmvpe_onnx"];
return Object.values(props.detectors).map((x) => {
if (recommended.includes(x)) {
return (
<option key={x} value={x}>
{x}
</option>
);
} else {
return (
<option key={x} value={x} disabled>
{x}(N/A)
</option>
);
}
});
} else {
return Object.values(props.detectors).map((x) => {
return (
<option key={x} value={x}>
{x}
</option>
);
});
}
};
const f0DetOptions = generateF0DetOptions();
return (
<div className="config-sub-area">
<div className="config-sub-area-control">
@ -19,33 +54,49 @@ export const QualityArea = (props: QualityAreaProps) => {
<div className="config-sub-area-control-field">
<div className="config-sub-area-noise-container">
<div className="config-sub-area-noise-checkbox-container">
<input type="checkbox" disabled={serverSetting.serverSetting.enableServerAudio != 0} checked={setting.voiceChangerClientSetting.echoCancel} onChange={(e) => {
<input
type="checkbox"
disabled={serverSetting.serverSetting.enableServerAudio != 0}
checked={setting.voiceChangerClientSetting.echoCancel}
onChange={(e) => {
try {
setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, echoCancel: e.target.checked })
setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, echoCancel: e.target.checked });
} catch (e) {
console.error(e)
console.error(e);
}
}} /> <span>Echo</span>
}}
/>{" "}
<span>Echo</span>
</div>
<div className="config-sub-area-noise-checkbox-container">
<input type="checkbox" disabled={serverSetting.serverSetting.enableServerAudio != 0} checked={setting.voiceChangerClientSetting.noiseSuppression} onChange={(e) => {
<input
type="checkbox"
disabled={serverSetting.serverSetting.enableServerAudio != 0}
checked={setting.voiceChangerClientSetting.noiseSuppression}
onChange={(e) => {
try {
setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, noiseSuppression: e.target.checked })
setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, noiseSuppression: e.target.checked });
} catch (e) {
console.error(e)
console.error(e);
}
}} /> <span>Sup1</span>
}}
/>{" "}
<span>Sup1</span>
</div>
<div className="config-sub-area-noise-checkbox-container">
<input type="checkbox" disabled={serverSetting.serverSetting.enableServerAudio != 0} checked={setting.voiceChangerClientSetting.noiseSuppression2} onChange={(e) => {
<input
type="checkbox"
disabled={serverSetting.serverSetting.enableServerAudio != 0}
checked={setting.voiceChangerClientSetting.noiseSuppression2}
onChange={(e) => {
try {
setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, noiseSuppression2: e.target.checked })
setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, noiseSuppression2: e.target.checked });
} catch (e) {
console.error(e)
console.error(e);
}
}} /> <span>Sup2</span>
}}
/>{" "}
<span>Sup2</span>
</div>
</div>
</div>
@ -53,15 +104,14 @@ export const QualityArea = (props: QualityAreaProps) => {
<div className="config-sub-area-control">
<div className="config-sub-area-control-title">F0 Det.:</div>
<div className="config-sub-area-control-field">
<select className="body-select" value={serverSetting.serverSetting.f0Detector} onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, f0Detector: e.target.value as F0Detector })
}}>
{
Object.values(props.detectors).map(x => {
//@ts-ignore
return <option key={x} value={x}>{x}</option>
})
}
<select
className="body-select"
value={serverSetting.serverSetting.f0Detector}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, f0Detector: e.target.value as F0Detector });
}}
>
{f0DetOptions}
</select>
</div>
</div>
@ -71,19 +121,25 @@ export const QualityArea = (props: QualityAreaProps) => {
<div className="config-sub-area-slider-control">
<span className="config-sub-area-slider-control-kind"></span>
<span className="config-sub-area-slider-control-slider">
<input type="range" className="config-sub-area-slider-control-slider" min="0.00000" max="0.001" step="0.00001" value={serverSetting.serverSetting.silentThreshold || 0} onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, silentThreshold: Number(e.target.value) })
}}></input>
<input
type="range"
className="config-sub-area-slider-control-slider"
min="0.00000"
max="0.001"
step="0.00001"
value={serverSetting.serverSetting.silentThreshold || 0}
onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, silentThreshold: Number(e.target.value) });
}}
></input>
</span>
<span className="config-sub-area-slider-control-val">{serverSetting.serverSetting.silentThreshold}</span>
</div>
</div>
</div>
</div>
)
}, [serverSetting.serverSetting, setting, serverSetting.updateServerSettings, setVoiceChangerClientSetting])
);
}, [serverSetting.serverSetting, setting, serverSetting.updateServerSettings, setVoiceChangerClientSetting]);
return qualityArea
}
return qualityArea;
};