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 React, { useMemo } from "react";
import { useAppState } from "../../../001_provider/001_AppStateProvider" import { useAppState } from "../../../001_provider/001_AppStateProvider";
import { F0Detector, } from "@dannadori/voice-changer-client-js" import { F0Detector } from "@dannadori/voice-changer-client-js";
import { useAppRoot } from "../../../001_provider/001_AppRootProvider";
export type QualityAreaProps = { export type QualityAreaProps = {
detectors: string[] detectors: string[];
} };
export const QualityArea = (props: QualityAreaProps) => { 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(() => { const qualityArea = useMemo(() => {
if (!serverSetting.updateServerSettings || !setVoiceChangerClientSetting || !serverSetting.serverSetting || !setting) { 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 ( return (
<div className="config-sub-area"> <div className="config-sub-area">
<div className="config-sub-area-control"> <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-control-field">
<div className="config-sub-area-noise-container"> <div className="config-sub-area-noise-container">
<div className="config-sub-area-noise-checkbox-container"> <div className="config-sub-area-noise-checkbox-container">
<input type="checkbox" disabled={serverSetting.serverSetting.enableServerAudio != 0} checked={setting.voiceChangerClientSetting.echoCancel} onChange={(e) => { <input
try { type="checkbox"
setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, echoCancel: e.target.checked }) disabled={serverSetting.serverSetting.enableServerAudio != 0}
} catch (e) { checked={setting.voiceChangerClientSetting.echoCancel}
console.error(e) onChange={(e) => {
} try {
}} /> <span>Echo</span> setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, echoCancel: e.target.checked });
} catch (e) {
console.error(e);
}
}}
/>{" "}
<span>Echo</span>
</div> </div>
<div className="config-sub-area-noise-checkbox-container"> <div className="config-sub-area-noise-checkbox-container">
<input type="checkbox" disabled={serverSetting.serverSetting.enableServerAudio != 0} checked={setting.voiceChangerClientSetting.noiseSuppression} onChange={(e) => { <input
try { type="checkbox"
setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, noiseSuppression: e.target.checked }) disabled={serverSetting.serverSetting.enableServerAudio != 0}
} catch (e) { checked={setting.voiceChangerClientSetting.noiseSuppression}
console.error(e) onChange={(e) => {
} try {
}} /> <span>Sup1</span> setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, noiseSuppression: e.target.checked });
} catch (e) {
console.error(e);
}
}}
/>{" "}
<span>Sup1</span>
</div> </div>
<div className="config-sub-area-noise-checkbox-container"> <div className="config-sub-area-noise-checkbox-container">
<input type="checkbox" disabled={serverSetting.serverSetting.enableServerAudio != 0} checked={setting.voiceChangerClientSetting.noiseSuppression2} onChange={(e) => { <input
try { type="checkbox"
setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, noiseSuppression2: e.target.checked }) disabled={serverSetting.serverSetting.enableServerAudio != 0}
} catch (e) { checked={setting.voiceChangerClientSetting.noiseSuppression2}
console.error(e) onChange={(e) => {
} try {
}} /> <span>Sup2</span> setVoiceChangerClientSetting({ ...setting.voiceChangerClientSetting, noiseSuppression2: e.target.checked });
} catch (e) {
console.error(e);
}
}}
/>{" "}
<span>Sup2</span>
</div> </div>
</div> </div>
</div> </div>
@ -53,15 +104,14 @@ export const QualityArea = (props: QualityAreaProps) => {
<div className="config-sub-area-control"> <div className="config-sub-area-control">
<div className="config-sub-area-control-title">F0 Det.:</div> <div className="config-sub-area-control-title">F0 Det.:</div>
<div className="config-sub-area-control-field"> <div className="config-sub-area-control-field">
<select className="body-select" value={serverSetting.serverSetting.f0Detector} onChange={(e) => { <select
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, f0Detector: e.target.value as F0Detector }) className="body-select"
}}> value={serverSetting.serverSetting.f0Detector}
{ onChange={(e) => {
Object.values(props.detectors).map(x => { serverSetting.updateServerSettings({ ...serverSetting.serverSetting, f0Detector: e.target.value as F0Detector });
//@ts-ignore }}
return <option key={x} value={x}>{x}</option> >
}) {f0DetOptions}
}
</select> </select>
</div> </div>
</div> </div>
@ -71,19 +121,25 @@ export const QualityArea = (props: QualityAreaProps) => {
<div className="config-sub-area-slider-control"> <div className="config-sub-area-slider-control">
<span className="config-sub-area-slider-control-kind"></span> <span className="config-sub-area-slider-control-kind"></span>
<span className="config-sub-area-slider-control-slider"> <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) => { <input
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, silentThreshold: Number(e.target.value) }) type="range"
}}></input> 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>
<span className="config-sub-area-slider-control-val">{serverSetting.serverSetting.silentThreshold}</span> <span className="config-sub-area-slider-control-val">{serverSetting.serverSetting.silentThreshold}</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
) );
}, [serverSetting.serverSetting, setting, serverSetting.updateServerSettings, setVoiceChangerClientSetting]) }, [serverSetting.serverSetting, setting, serverSetting.updateServerSettings, setVoiceChangerClientSetting]);
return qualityArea;
return qualityArea };
}