common sample

This commit is contained in:
wataru 2023-06-17 20:13:25 +09:00
parent db322756f6
commit 3729b44f37
10 changed files with 1045 additions and 2919 deletions

View File

@ -1,10 +1 @@
<!DOCTYPE html> <!doctype html><html style="width:100%;height:100%;overflow:hidden"><head><meta charset="utf-8"/><title>Voice Changer Client Demo</title><script defer="defer" src="index.js"></script></head><body style="width:100%;height:100%;margin:0"><div id="app" style="width:100%;height:100%"></div></body></html>
<html style="width: 100%; height: 100%; overflow: hidden">
<head>
<meta charset="utf-8" />
<title>Voice Changer Client Demo</title>
<script defer src="index.js"></script></head>
<body style="width: 100%; height: 100%; margin: 0px">
<div id="app" style="width: 100%; height: 100%"></div>
</body>
</html>

File diff suppressed because one or more lines are too long

31
client/demo/dist/index.js.LICENSE.txt vendored Normal file
View File

@ -0,0 +1,31 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

File diff suppressed because it is too large Load Diff

View File

@ -24,14 +24,14 @@
"@babel/preset-env": "^7.22.5", "@babel/preset-env": "^7.22.5",
"@babel/preset-react": "^7.22.5", "@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5", "@babel/preset-typescript": "^7.22.5",
"@types/node": "^20.3.0", "@types/node": "^20.3.1",
"@types/react": "^18.2.11", "@types/react": "^18.2.12",
"@types/react-dom": "^18.2.4", "@types/react-dom": "^18.2.5",
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.14",
"babel-loader": "^9.1.2", "babel-loader": "^9.1.2",
"copy-webpack-plugin": "^11.0.0", "copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1", "css-loader": "^6.8.1",
"eslint": "^8.42.0", "eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2", "eslint-plugin-react": "^7.32.2",
@ -47,12 +47,12 @@
"ts-loader": "^9.4.3", "ts-loader": "^9.4.3",
"tsconfig-paths": "^4.2.0", "tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3", "typescript": "^5.1.3",
"webpack": "^5.86.0", "webpack": "^5.87.0",
"webpack-cli": "^5.1.4", "webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1" "webpack-dev-server": "^4.15.1"
}, },
"dependencies": { "dependencies": {
"@dannadori/voice-changer-client-js": "^1.0.144", "@dannadori/voice-changer-client-js": "^1.0.146",
"@fortawesome/fontawesome-svg-core": "^6.4.0", "@fortawesome/fontawesome-svg-core": "^6.4.0",
"@fortawesome/free-brands-svg-icons": "^6.4.0", "@fortawesome/free-brands-svg-icons": "^6.4.0",
"@fortawesome/free-regular-svg-icons": "^6.4.0", "@fortawesome/free-regular-svg-icons": "^6.4.0",

View File

@ -1,5 +1,6 @@
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 { useAppRoot } from "../../../001_provider/001_AppRootProvider"
export type ConvertProps = { export type ConvertProps = {
inputChunkNums: number[] inputChunkNums: number[]
@ -8,7 +9,8 @@ export type ConvertProps = {
export const ConvertArea = (props: ConvertProps) => { export const ConvertArea = (props: ConvertProps) => {
const { clientSetting, serverSetting, workletNodeSetting } = useAppState() const { clientSetting, serverSetting, workletNodeSetting } = useAppState()
const { appGuiSettingState } = useAppRoot()
const edition = appGuiSettingState.edition
const convertArea = useMemo(() => { const convertArea = useMemo(() => {
let nums: number[] let nums: number[]
if (!props.inputChunkNums) { if (!props.inputChunkNums) {
@ -23,6 +25,38 @@ export const ConvertArea = (props: ConvertProps) => {
name: "cpu", name: "cpu",
memory: 0 memory: 0
}) })
const gpuSelect = edition == "onnxdirectML-cuda" || true ? (
<div className="config-sub-area-control">
<div className="config-sub-area-control-title">GPU(dml):</div>
<div className="config-sub-area-control-field">
<div className="config-sub-area-buttons left-padding-1">
<div onClick={
async () => {
await serverSetting.updateServerSettings({
...serverSetting.serverSetting, gpu: serverSetting.serverSetting.gpu == 0 ? -1 : 0
})
}} className="config-sub-area-button ">{serverSetting.serverSetting.gpu == 0 ? "on" : "off"}</div>
</div>
</div>
</div >
) : (
<div className="config-sub-area-control">
<div className="config-sub-area-control-title">GPU:</div>
<div className="config-sub-area-control-field">
<select className="body-select" value={serverSetting.serverSetting.gpu} onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, gpu: Number(e.target.value) })
}}>
{
gpusEntry.map(x => {
return <option key={x.id} value={x.id}>{x.name}{x.name == "cpu" ? "" : `(${(x.memory / 1024 / 1024 / 1024).toFixed(0)}GB)`} </option>
})
}
</select>
</div>
</div>
)
return ( return (
<div className="config-sub-area"> <div className="config-sub-area">
<div className="config-sub-area-control"> <div className="config-sub-area-control">
@ -57,24 +91,10 @@ export const ConvertArea = (props: ConvertProps) => {
</select> </select>
</div> </div>
</div> </div>
<div className="config-sub-area-control"> {gpuSelect}
<div className="config-sub-area-control-title">GPU:</div>
<div className="config-sub-area-control-field">
<select className="body-select" value={serverSetting.serverSetting.gpu} onChange={(e) => {
serverSetting.updateServerSettings({ ...serverSetting.serverSetting, gpu: Number(e.target.value) })
}}>
{
gpusEntry.map(x => {
return <option key={x.id} value={x.id}>{x.name}{x.name == "cpu" ? "" : `(${(x.memory / 1024 / 1024 / 1024).toFixed(0)}GB)`} </option>
})
}
</select>
</div>
</div>
</div> </div>
) )
}, [serverSetting.serverSetting, clientSetting.clientSetting, workletNodeSetting.workletNodeSetting, serverSetting.updateServerSettings, clientSetting.updateClientSetting, workletNodeSetting.updateWorkletNodeSetting]) }, [serverSetting.serverSetting, clientSetting.clientSetting, workletNodeSetting.workletNodeSetting, serverSetting.updateServerSettings, clientSetting.updateClientSetting, workletNodeSetting.updateWorkletNodeSetting, edition])
return convertArea return convertArea

View File

@ -16,6 +16,7 @@ export const DeviceArea = (_props: DeviceAreaProps) => {
const audioSrcNode = useRef<MediaElementAudioSourceNode>() const audioSrcNode = useRef<MediaElementAudioSourceNode>()
const { appGuiSettingState } = useAppRoot() const { appGuiSettingState } = useAppRoot()
const clientType = appGuiSettingState.appGuiSetting.id const clientType = appGuiSettingState.appGuiSetting.id
const { getItem, setItem } = useIndexedDB({ clientType: clientType }) const { getItem, setItem } = useIndexedDB({ clientType: clientType })
const [outputRecordingStarted, setOutputRecordingStarted] = useState<boolean>(false) const [outputRecordingStarted, setOutputRecordingStarted] = useState<boolean>(false)

View File

@ -1,37 +0,0 @@
const messages_: {
[id: string]: {
[lang: string]: string
}
} = {
"notice_1": {
"en": "DirectML version is an experimental version. There are the known issues as follows.",
"ja": "directML版は実験的バージョンです。以下の既知の問題があります。",
},
"notice_2": {
"en": "(1) When some settings are changed, conversion process becomes slow even when using GPU. If this occurs, reset the GPU value to -1 and then back to 0.",
"ja": "(1) 一部の設定変更を行うとgpuを使用していても変換処理が遅くなることが発生します。もしこの現象が発生したらGPUの値を-1にしてから再度0に戻してください。",
},
"donate_1": {
"en": "This software is supported by donations. Thank you for your support!",
"ja": "開発者にコーヒーをご馳走してあげよう。この黄色いアイコンから。",
},
"click_to_start_1": {
"en": "Click to start",
"ja": "スタートボタンを押してください。",
}
}
export const getMessage_ = (id: string) => {
let lang = window.navigator.language
if (lang != "ja") {
lang = "en"
}
if (!messages_[id]) {
return "undefined message."
}
return messages_[id][lang]
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@dannadori/voice-changer-client-js", "name": "@dannadori/voice-changer-client-js",
"version": "1.0.144", "version": "1.0.146",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"directories": { "directories": {
@ -26,11 +26,11 @@
"author": "wataru.okada@flect.co.jp", "author": "wataru.okada@flect.co.jp",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@types/audioworklet": "^0.0.46", "@types/audioworklet": "^0.0.47",
"@types/node": "^20.2.5", "@types/node": "^20.3.1",
"@types/react": "18.2.9", "@types/react": "18.2.12",
"@types/react-dom": "18.2.4", "@types/react-dom": "18.2.5",
"eslint": "^8.42.0", "eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2", "eslint-plugin-react": "^7.32.2",
@ -41,7 +41,7 @@
"rimraf": "^5.0.1", "rimraf": "^5.0.1",
"ts-loader": "^9.4.3", "ts-loader": "^9.4.3",
"typescript": "^5.1.3", "typescript": "^5.1.3",
"webpack": "^5.86.0", "webpack": "^5.87.0",
"webpack-cli": "^5.1.4", "webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1" "webpack-dev-server": "^4.15.1"
}, },