Files
VRCT/src-ui/logics/configs/useSelectedMicDevice.js
Sakamoto Shiina ac6b898a46 [Perf/bugfix] Separate custom hooks and prevent re-render issues.
Config Page: Device Tab. threshold component. fix problem that the input component focused out when input something each time.
Set threshold data when started python.
2024-09-10 17:21:03 +09:00

19 lines
855 B
JavaScript

import { useSelectedMicDevice as useStoreSelectedMicDevice } from "@store";
import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSelectedMicDevice = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { currentSelectedMicDevice, updateSelectedMicDevice } = useStoreSelectedMicDevice();
const getSelectedMicDevice = () => {
updateSelectedMicDevice(() => new Promise(() => {}));
asyncStdoutToPython("/config/choice_mic_device");
};
const setSelectedMicDevice = (selected_mic_device) => {
updateSelectedMicDevice(() => new Promise(() => {}));
asyncStdoutToPython("/controller/callback_set_mic_device", selected_mic_device);
};
return { currentSelectedMicDevice, getSelectedMicDevice, updateSelectedMicDevice, setSelectedMicDevice };
};