Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] エンジン個別オプションの複数エンジン対応 #1136

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 33 additions & 28 deletions src/components/SettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,39 @@
>
</q-btn-toggle>
</q-card-actions>
<q-card-actions class="q-px-md q-py-none bg-surface">
<div>音声のサンプリングレート(全エンジン共通)</div>
<div>
<q-icon name="help_outline" size="sm" class="help-hover-icon">
<q-tooltip
:delay="500"
anchor="center left"
self="center right"
transition-show="jump-left"
transition-hide="jump-right"
>
再生・保存時の音声のサンプリングレートを変更します(サンプリングレートを上げても音声の品質は上がりません。)
</q-tooltip>
</q-icon>
</div>
<q-space />
<q-select
borderless
name="samplingRate"
:model-value="savingSetting.outputSamplingRate"
:options="[24000, 44100, 48000, 88200, 96000]"
:option-label="
(item) =>
`${item / 1000} kHz${
item === 24000 ? '(デフォルト)' : ''
}`
"
@update:model-value="
handleSavingSettingChange('outputSamplingRate', $event)
"
>
</q-select>
</q-card-actions>
</q-card>
<!-- Preservation Setting -->
<q-card flat class="setting-card">
Expand Down Expand Up @@ -538,34 +571,6 @@
>
</q-select>
</q-card-actions>
<q-card-actions class="q-px-md q-py-none bg-surface">
<div>音声のサンプリングレート</div>
<div>
<q-icon name="help_outline" size="sm" class="help-hover-icon">
<q-tooltip
:delay="500"
anchor="center left"
self="center right"
transition-show="jump-left"
transition-hide="jump-right"
>
再生・保存時の音声のサンプリングレートを変更します(サンプリングレートを上げても音声の品質は上がりません。)
</q-tooltip>
</q-icon>
</div>
<q-space />
<q-select
borderless
name="samplingRate"
:model-value="savingSetting.outputSamplingRate"
:options="samplingRateOptions"
:option-label="renderSamplingRateLabel"
@update:model-value="
handleSavingSettingChange('outputSamplingRate', $event)
"
>
</q-select>
</q-card-actions>
</q-card>
<q-card flat class="setting-card">
<q-card-actions>
Expand Down
15 changes: 15 additions & 0 deletions src/store/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const settingStoreState: SettingStoreState = {
confirmedTips: {
tweakableSliderByScroll: false,
},
engineSetting: {},
};

export const settingStore = createPartialStore<SettingStoreTypes>({
Expand Down Expand Up @@ -116,6 +117,10 @@ export const settingStore = createPartialStore<SettingStoreTypes>({
commit("SET_CONFIRMED_TIPS", {
confirmedTips: await window.electron.getSetting("confirmedTips"),
});

commit("SET_ENGINE_SETTING", {
engineSetting: await window.electron.getSetting("engineSetting"),
});
},
},

Expand Down Expand Up @@ -307,6 +312,16 @@ export const settingStore = createPartialStore<SettingStoreTypes>({
},
},

SET_ENGINE_SETTING: {
mutation(state, { engineSetting }) {
state.engineSetting = engineSetting;
},
action({ commit }, { engineSetting }) {
window.electron.setSetting("engineSetting", engineSetting);
commit("SET_ENGINE_SETTING", { engineSetting });
},
},

CHANGE_USE_GPU: {
/**
* CPU/GPUモードを切り替えようとする。
Expand Down
7 changes: 7 additions & 0 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
ConfirmedTips,
EngineDirValidationResult,
EditorFontType,
EngineSetting,
} from "@/type/preload";
import { IEngineConnectorFactory } from "@/infrastructures/EngineConnector";
import { QVueGlobals } from "quasar";
Expand Down Expand Up @@ -938,6 +939,7 @@ export type SettingStoreState = {
splitTextWhenPaste: SplitTextWhenPasteType;
splitterPosition: SplitterPosition;
confirmedTips: ConfirmedTips;
engineSetting: EngineSetting;
};

export type SettingStoreTypes = {
Expand Down Expand Up @@ -1002,6 +1004,11 @@ export type SettingStoreTypes = {
action(payload: { confirmedTips: ConfirmedTips }): void;
};

SET_ENGINE_SETTING: {
mutation: { engineSetting: EngineSetting };
action(payload: { engineSetting: EngineSetting }): void;
};

CHANGE_USE_GPU: {
action(payload: { useGpu: boolean }): void;
};
Expand Down
15 changes: 15 additions & 0 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ export type SavingSetting = {
audioOutputDevice: string;
};

export type EngineSetting = Record<string, EngineSettingRecord>;

type EngineSettingRecord = {
useGpu: boolean | "inherit";
outputSamplingRate: number | "inherit";
};

export type DefaultStyleId = {
engineId: string;
speakerUuid: string;
Expand Down Expand Up @@ -446,6 +453,14 @@ export const electronStoreSchema = z
toolbarSetting: toolbarSettingSchema
.array()
.default(defaultToolbarButtonSetting),
engineSetting: z.record(
z.object({
useGpu: z.union([z.boolean(), z.literal("inherit")]).default("inherit"),
outputSamplingRate: z
.union([z.number(), z.literal("inherit")])
.default("inherit"),
})
),
userCharacterOrder: z.string().array().default([]),
defaultStyleIds: z
.object({
Expand Down