Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into to-0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Jan 12, 2024
2 parents 43215f8 + 97ebf38 commit 72a775d
Show file tree
Hide file tree
Showing 27 changed files with 631 additions and 463 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:

env:
VOICEVOX_ENGINE_REPO_URL: "https://github.com/VOICEVOX/voicevox_engine"
VOICEVOX_ENGINE_VERSION: 0.14.6
VOICEVOX_ENGINE_VERSION: 0.14.7
VOICEVOX_RESOURCE_VERSION: 0.15.0-preview.3
VOICEVOX_EDITOR_VERSION:
|- # releaseタグ名か、workflow_dispatchでのバージョン名か、999.999.999-developが入る
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ npm run test-watch:electron-e2e # 監視モード

## 依存ライブラリのライセンス情報の生成

依存ライブラリのライセンス情報は Github Workflow でのビルド時に自動生成されます。以下のコマンドで生成できます。

```bash
# get licenses.json from voicevox_engine as engine_licenses.json

Expand Down
19 changes: 16 additions & 3 deletions docs/細かい設計方針.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,28 @@ SpeakerId は話者が持つ ID で、世界で唯一かつ不変。エンジン
StyleId はスタイルごとの ID で、エンジンごとに唯一であれば良いです。

声を一意に決めるには、(EngineId, SpeakerId, StyleId)の3組が揃っている必要がある、という仕様を目指しています。
現状は、音声合成APIに SpeakerId 引数が無いため、(EngineId, StyleId)の2組で一意に声が決まっています。
現状は、音声合成 API に SpeakerId 引数が無いため、(EngineId, StyleId)の2組で一意に声が決まっています。
現状は StyleId はエンジンごとに唯一である必要がありますが、話者ごとに唯一であれば良いという仕様を目指しています。

VOICEVOX は歴史的経緯により、 SpeakerId と StyleId が混同していることがあります。
特に型が整数値になっている SpeakerId は StyleId と混同している場合があります。
(エンジン API の SpeakerId 引数に StyleId を渡したりなど。)

StyleId は現在整数値型になっていますが、将来的にはUuidにしたいと考えています
StyleId は現在整数値型になっていますが、将来的には Uuid にしたいと考えています

## シングルファイルコンポーネント(SFC、`.vue`ファイル)のtemplate、script、styleの順序
## シングルファイルコンポーネント(SFC、`.vue`ファイル)の template、script、style の順序

`<template>``<script>``<style>`の順序で記述してください。

## Zod のスキーマと型定義

Zod のスキーマ(`z.object`)の変数名は、`[camelCaseでの名前]Schema`、型定義(`z.infer`)の名前は、`[PascalCaseでの名前]Type`としてください。

```ts
export const hogeFugaSchema = z.object({
hoge: z.string(),
fuga: z.number(),
});

export type HogeFugaType = z.infer<typeof hogeFugaSchema>;
```
7 changes: 7 additions & 0 deletions public/updateInfos.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
[
{
"version": "0.14.11",
"descriptions": [
"キャラクター「小夜」「ずんだもん」「もち子さん」「青山龍星」のスタイルを追加・更新"
],
"contributors": []
},
{
"version": "0.14.10",
"descriptions": ["初回起動及び0.13からアップデートできないバグを修正"],
Expand Down
6 changes: 3 additions & 3 deletions src/background/engineManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import {
EngineInfo,
EngineDirValidationResult,
MinimumEngineManifest,
MinimumEngineManifestType,
EngineId,
minimumEngineManifestSchema,
envEngineInfoSchema,
Expand Down Expand Up @@ -97,7 +97,7 @@ export class EngineManager {
if (!fs.existsSync(manifestPath)) {
return "manifestNotFound";
}
let manifest: MinimumEngineManifest;
let manifest: MinimumEngineManifestType;
try {
manifest = minimumEngineManifestSchema.parse(
JSON.parse(fs.readFileSync(manifestPath, { encoding: "utf8" }))
Expand Down Expand Up @@ -529,7 +529,7 @@ export class EngineManager {
path.join(engineDir, "engine_manifest.json"),
"utf-8"
);
let manifestContent: MinimumEngineManifest;
let manifestContent: MinimumEngineManifestType;
try {
manifestContent = minimumEngineManifestSchema.parse(JSON.parse(manifest));
} catch (e) {
Expand Down
23 changes: 12 additions & 11 deletions src/background/vvppManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
EngineId,
EngineInfo,
minimumEngineManifestSchema,
MinimumEngineManifest,
MinimumEngineManifestType,
} from "@/type/preload";

const isNotWin = process.platform !== "win32";
Expand Down Expand Up @@ -93,12 +93,12 @@ export class VvppManager {
this.willDeleteEngineIds.add(engineId);
}

toValidDirName(manifest: MinimumEngineManifest) {
toValidDirName(manifest: MinimumEngineManifestType) {
// フォルダに使用できない文字が含まれている場合は置換する
return `${manifest.name.replace(/[\s<>:"/\\|?*]+/g, "_")}+${manifest.uuid}`;
}

isEngineDirName(dir: string, manifest: MinimumEngineManifest) {
isEngineDirName(dir: string, manifest: MinimumEngineManifestType) {
return dir.endsWith(`+${manifest.uuid}`);
}

Expand All @@ -121,7 +121,7 @@ export class VvppManager {

private async extractVvpp(
vvppLikeFilePath: string
): Promise<{ outputDir: string; manifest: MinimumEngineManifest }> {
): Promise<{ outputDir: string; manifest: MinimumEngineManifestType }> {
const nonce = new Date().getTime().toString();
const outputDir = path.join(this.vvppEngineDir, ".tmp", nonce);

Expand Down Expand Up @@ -240,14 +240,15 @@ export class VvppManager {
await fs.promises.rm(tmpConcatenatedFile);
}
}
const manifest: MinimumEngineManifest = minimumEngineManifestSchema.parse(
JSON.parse(
await fs.promises.readFile(
path.join(outputDir, "engine_manifest.json"),
"utf-8"
const manifest: MinimumEngineManifestType =
minimumEngineManifestSchema.parse(
JSON.parse(
await fs.promises.readFile(
path.join(outputDir, "engine_manifest.json"),
"utf-8"
)
)
)
);
);
return {
outputDir,
manifest,
Expand Down
8 changes: 4 additions & 4 deletions src/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
defaultToolbarButtonSetting,
configSchema,
EngineId,
EngineSetting,
EngineSettingType,
EngineSettings,
HotkeySetting,
HotkeySettingType,
Sandbox,
ThemeConf,
} from "@/type/preload";
Expand Down Expand Up @@ -220,7 +220,7 @@ export const api: Sandbox = {
openEngineDirectory(/* engineId: EngineId */) {
throw new Error(`Not supported on Browser version: openEngineDirectory`);
},
async hotkeySettings(newData?: HotkeySetting) {
async hotkeySettings(newData?: HotkeySettingType) {
type HotkeySettingType = ReturnType<
typeof configSchema["parse"]
>["hotkeySettings"];
Expand Down Expand Up @@ -294,7 +294,7 @@ export const api: Sandbox = {
configManager.set(key, newValue);
return newValue;
},
async setEngineSetting(engineId: EngineId, engineSetting: EngineSetting) {
async setEngineSetting(engineId: EngineId, engineSetting: EngineSettingType) {
const engineSettings = (await this.getSetting(
"engineSettings"
)) as EngineSettings;
Expand Down
4 changes: 2 additions & 2 deletions src/components/AudioDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ import AccentPhrase from "./AccentPhrase.vue";
import { useStore } from "@/store";
import {
AudioKey,
HotkeyAction,
HotkeyActionType,
HotkeyReturnType,
isMac,
} from "@/type/preload";
Expand All @@ -111,7 +111,7 @@ const supportedFeatures = computed(
.supportedFeatures) as EngineManifest["supportedFeatures"] | undefined
);
const hotkeyMap = new Map<HotkeyAction, () => HotkeyReturnType>([
const hotkeyMap = new Map<HotkeyActionType, () => HotkeyReturnType>([
[
"再生/停止",
() => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/HeaderBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
import { useStore } from "@/store";
import { setHotkeyFunctions } from "@/store/setting";
import {
HotkeyAction,
HotkeyActionType,
HotkeyReturnType,
ToolbarButtonTagType,
} from "@/type/preload";
Expand All @@ -54,7 +54,7 @@ const nowPlayingContinuously = computed(
() => store.state.nowPlayingContinuously
);
const undoRedoHotkeyMap = new Map<HotkeyAction, () => HotkeyReturnType>([
const undoRedoHotkeyMap = new Map<HotkeyActionType, () => HotkeyReturnType>([
// undo
[
"元に戻す",
Expand All @@ -78,7 +78,7 @@ const undoRedoHotkeyMap = new Map<HotkeyAction, () => HotkeyReturnType>([
]);
setHotkeyFunctions(undoRedoHotkeyMap);
const hotkeyMap = new Map<HotkeyAction, () => HotkeyReturnType>([
const hotkeyMap = new Map<HotkeyActionType, () => HotkeyReturnType>([
// play/stop continuously
[
"連続再生/停止",
Expand Down
4 changes: 2 additions & 2 deletions src/components/HeaderBarCustomDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
import { computed, ref, watch, Ref } from "vue";
import draggable from "vuedraggable";
import { useStore } from "@/store";
import { ToolbarButtonTagType, ToolbarSetting } from "@/type/preload";
import { ToolbarButtonTagType, ToolbarSettingType } from "@/type/preload";
import { getToolbarButtonName } from "@/store/utility";
const props =
Expand Down Expand Up @@ -148,7 +148,7 @@ watch(
}
);
const defaultSetting: ToolbarSetting = [];
const defaultSetting: ToolbarSettingType = [];
window.electron.getDefaultToolbarSetting().then((setting) => {
defaultSetting.push(...setting);
});
Expand Down
6 changes: 3 additions & 3 deletions src/components/HotkeySettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
import { computed, ref } from "vue";
import { useStore } from "@/store";
import { parseCombo } from "@/store/setting";
import { HotkeyAction, HotkeySetting } from "@/type/preload";
import { HotkeyActionType, HotkeySettingType } from "@/type/preload";
const props =
defineProps<{
Expand Down Expand Up @@ -280,7 +280,7 @@ const recordCombination = (event: KeyboardEvent) => {
const changeHotkeySettings = (action: string, combo: string) => {
return store.dispatch("SET_HOTKEY_SETTINGS", {
data: {
action: action as HotkeyAction,
action: action as HotkeyActionType,
combination: combo,
},
});
Expand Down Expand Up @@ -359,7 +359,7 @@ const resetHotkey = async (action: string) => {
if (result === "OK") {
window.electron
.getDefaultHotkeySettings()
.then((defaultSettings: HotkeySetting[]) => {
.then((defaultSettings: HotkeySettingType[]) => {
const setting = defaultSettings.find((value) => value.action == action);
if (setting == undefined) {
return;
Expand Down
4 changes: 2 additions & 2 deletions src/components/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
import MenuButton from "./MenuButton.vue";
import TitleBarButtons from "./TitleBarButtons.vue";
import { useStore } from "@/store";
import { HotkeyAction, HotkeyReturnType } from "@/type/preload";
import { HotkeyActionType, HotkeyReturnType } from "@/type/preload";
import { setHotkeyFunctions } from "@/store/setting";
import { base64ImageToUri } from "@/helpers/imageHelper";
Expand Down Expand Up @@ -430,7 +430,7 @@ const reassignSubMenuOpen = (idx: number) => {
}
};
const hotkeyMap = new Map<HotkeyAction, () => HotkeyReturnType>([
const hotkeyMap = new Map<HotkeyActionType, () => HotkeyReturnType>([
["新規プロジェクト", createNewProject],
["音声書き出し", generateAndSaveAllAudio],
["選択音声を書き出し", generateAndSaveSelectedAudio],
Expand Down
38 changes: 25 additions & 13 deletions src/components/SettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -948,15 +948,15 @@ import FileNamePatternDialog from "./FileNamePatternDialog.vue";
import { useStore } from "@/store";
import {
SavingSetting,
EngineSetting,
ExperimentalSetting,
EngineSettingType,
ExperimentalSettingType,
ActivePointScrollMode,
SplitTextWhenPasteType,
EditorFontType,
EngineId,
} from "@/type/preload";
type SamplingRateOption = EngineSetting["outputSamplingRate"];
type SamplingRateOption = EngineSettingType["outputSamplingRate"];
const props =
defineProps<{
Expand Down Expand Up @@ -1041,18 +1041,25 @@ const availableThemeNameComputed = computed(() => {
const editorFont = computed(() => store.state.editorFont);
const changeEditorFont = (editorFont: EditorFontType) => {
store.dispatch("SET_EDITOR_FONT", { editorFont });
store.dispatch("SET_ROOT_MISC_SETTING", {
key: "editorFont",
value: editorFont,
});
};
const enableMultiEngine = computed(() => store.state.enableMultiEngine);
const setEnableMultiEngine = (enableMultiEngine: boolean) => {
store.dispatch("SET_ENABLE_MULTI_ENGINE", { enableMultiEngine });
store.dispatch("SET_ROOT_MISC_SETTING", {
key: "enableMultiEngine",
value: enableMultiEngine,
});
};
const showTextLineNumber = computed(() => store.state.showTextLineNumber);
const changeShowTextLineNumber = (showTextLineNumber: boolean) => {
store.dispatch("SET_SHOW_TEXT_LINE_NUMBER", {
showTextLineNumber,
store.dispatch("SET_ROOT_MISC_SETTING", {
key: "showTextLineNumber",
value: showTextLineNumber,
});
};
Expand All @@ -1063,8 +1070,9 @@ const showAddAudioItemButton = computed(
const changeShowAddAudioItemButton = async (
showAddAudioItemButton: boolean
) => {
store.dispatch("SET_SHOW_ADD_AUDIO_ITEM_BUTTON", {
showAddAudioItemButton,
store.dispatch("SET_ROOT_MISC_SETTING", {
key: "showAddAudioItemButton",
value: showAddAudioItemButton,
});
// 設定をオフにする場合はヒントを表示
Expand All @@ -1076,8 +1084,9 @@ const changeShowAddAudioItemButton = async (
});
if (result === "CANCEL") {
// キャンセルしたら設定を元に戻す
store.dispatch("SET_SHOW_ADD_AUDIO_ITEM_BUTTON", {
showAddAudioItemButton: true,
store.dispatch("SET_ROOT_MISC_SETTING", {
key: "showAddAudioItemButton",
value: true,
});
}
}
Expand Down Expand Up @@ -1182,7 +1191,7 @@ const changeEnablePreset = (value: boolean) => {
};
const changeExperimentalSetting = async (
key: keyof ExperimentalSetting,
key: keyof ExperimentalSettingType,
data: boolean
) => {
store.dispatch("SET_EXPERIMENTAL_SETTING", {
Expand Down Expand Up @@ -1272,7 +1281,10 @@ const splitTextWhenPaste = computed(() => store.state.splitTextWhenPaste);
const changeSplitTextWhenPaste = (
splitTextWhenPaste: SplitTextWhenPasteType
) => {
store.dispatch("SET_SPLIT_TEXT_WHEN_PASTE", { splitTextWhenPaste });
store.dispatch("SET_ROOT_MISC_SETTING", {
key: "splitTextWhenPaste",
value: splitTextWhenPaste,
});
};
const showsFilePatternEditDialog = ref(false);
Expand Down
Loading

0 comments on commit 72a775d

Please sign in to comment.