Skip to content

Commit

Permalink
無声化処理のexperimentalタグを外しデフォルトで有効にする (#454)
Browse files Browse the repository at this point in the history
* undo/redoable devoicing (#435)

* undo/redoable devoicing

* remove unnecessary codes

* remove experimental tag from unvoicing

* revert unvoicableVowels

Co-authored-by: Hiroshiba <hihokaruta@gmail.com>

Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
  • Loading branch information
Yosshi999 and Hiroshiba authored Nov 7, 2021
1 parent b9d8d6f commit 3bdad5d
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 70 deletions.
12 changes: 0 additions & 12 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const store = new Store<{
savingSetting: SavingSetting;
hotkeySettings: HotkeySetting[];
defaultStyleIds: DefaultStyleId[];
useVoicing: boolean;
}>({
schema: {
useGpu: {
Expand Down Expand Up @@ -199,10 +198,6 @@ const store = new Store<{
},
default: [],
},
useVoicing: {
type: "boolean",
default: false,
},
},
migrations: {
">=0.7.3": (store) => {
Expand Down Expand Up @@ -636,13 +631,6 @@ ipcMainHandle("HOTKEY_SETTINGS", (_, { newData }) => {
return store.get("hotkeySettings");
});

ipcMainHandle("USE_VOICING", (_, { newData }) => {
if (newData !== undefined) {
store.set("useVoicing", newData);
}
return store.get("useVoicing");
});

ipcMainHandle("CHECK_FILE_EXISTS", (_, { file }) => {
return fs.existsSync(file);
});
Expand Down
5 changes: 2 additions & 3 deletions src/components/AudioDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ export default defineComponent({
const selectDetail = (index: number) => {
selectedDetail.value = index === 0 ? "accent" : "pitch";
};
const useVoicing = computed(() => store.state.useVoicing);
// accent phrase
const uiLocked = computed(() => store.getters.UI_LOCKED);
Expand Down Expand Up @@ -553,7 +552,7 @@ export default defineComponent({
if (accentPhraseIndex === accentHoveredInfo.accentPhraseIndex) {
isHover = true;
}
} else if (selectedDetail.value == "pitch" && useVoicing.value) {
} else if (selectedDetail.value == "pitch") {
if (
accentPhraseIndex === pitchHoveredInfo.accentPhraseIndex &&
moraIndex === pitchHoveredInfo.moraIndex &&
Expand Down Expand Up @@ -602,7 +601,7 @@ export default defineComponent({
accentPhraseIndex: number,
moraIndex: number
) => {
if (!uiLocked.value && useVoicing.value) {
if (!uiLocked.value) {
if (
selectedDetail.value == "pitch" &&
unvoicableVowels.indexOf(mora.vowel) > -1
Expand Down
28 changes: 3 additions & 25 deletions src/components/SettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,26 +285,12 @@
</q-select>
</q-card-actions> -->
</q-card>
<q-card flat class="setting-card">
<!-- 今後実験的機能を追加する場合はここに追加 -->
<!-- <q-card flat class="setting-card">
<q-card-actions>
<div class="text-h5">実験的機能</div>
</q-card-actions>
<q-card-actions class="q-px-md q-py-sm bg-grey-3">
<div>無声化切り替え</div>
<q-space />
<q-toggle v-model="useVoicingComputed">
<q-tooltip
:delay="500"
anchor="center left"
self="center right"
transition-show="jump-left"
transition-hide="jump-right"
>
この機能を有効にすると、元に戻す・やり直す機能が正しく動作しなくなる可能性があります
</q-tooltip>
</q-toggle>
</q-card-actions>
</q-card>
</q-card> -->
</div>
</q-page>
</q-page-container>
Expand Down Expand Up @@ -345,13 +331,6 @@ export default defineComponent({
});
const inheritAudioInfoMode = computed(() => store.state.inheritAudioInfo);
const useVoicingComputed = computed({
get: () => store.state.useVoicing,
set: (useVoicing: boolean) => {
store.dispatch("SET_USE_VOICING", { data: useVoicing });
},
});
const changeUseGPU = async (useGpu: boolean) => {
if (store.state.useGpu === useGpu) return;
Expand Down Expand Up @@ -474,7 +453,6 @@ export default defineComponent({
savingSetting,
handleSavingSettingChange,
openFileExplore,
useVoicingComputed,
};
},
});
Expand Down
4 changes: 0 additions & 4 deletions src/electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ const api: Sandbox = {
setDefaultStyleIds: async (defaultStyleIds) => {
await ipcRendererInvoke("SET_DEFAULT_STYLE_IDS", defaultStyleIds);
},

useVoicing: (newData) => {
return ipcRenderer.invoke("USE_VOICING", { newData });
},
};

contextBridge.exposeInMainWorld("electron", api);
13 changes: 0 additions & 13 deletions src/store/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const settingStoreState: SettingStoreState = {
outputSamplingRate: 24000,
},
hotkeySettings: [],
useVoicing: false,
engineHost: process.env.VUE_APP_ENGINE_URL as unknown as string,
};

Expand Down Expand Up @@ -59,9 +58,6 @@ export const settingStore: VoiceVoxStoreOptions<
});
if (flag) state.hotkeySettings.push(newHotkey);
},
SET_USE_VOICING(state, { useVoicing }: { useVoicing: boolean }) {
state.useVoicing = useVoicing;
},
},
actions: {
GET_SAVING_SETTING({ commit }) {
Expand Down Expand Up @@ -108,15 +104,6 @@ export const settingStore: VoiceVoxStoreOptions<
newHotkey: data,
});
},
GET_USE_VOICING({ commit }) {
window.electron.useVoicing().then((useVoicing) => {
commit("SET_USE_VOICING", { useVoicing: useVoicing });
});
},
SET_USE_VOICING({ commit }, { data }: { data: boolean }) {
window.electron.useVoicing(data);
commit("SET_USE_VOICING", { useVoicing: data });
},
},
};

Expand Down
10 changes: 0 additions & 10 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,6 @@ export type ProjectActions = StoreType<ProjectStoreTypes, "action">;
export type SettingStoreState = {
savingSetting: SavingSetting;
hotkeySettings: HotkeySetting[];
useVoicing: boolean;
engineHost: string;
};

Expand All @@ -628,15 +627,6 @@ type SettingStoreTypes = {
mutation: { newHotkey: HotkeySetting };
action(payload: { data: HotkeySetting }): void;
};

GET_USE_VOICING: {
action(): void;
};

SET_USE_VOICING: {
mutation: { useVoicing: boolean };
action(payload: { data: boolean }): void;
};
};

export type SettingGetters = StoreType<SettingStoreTypes, "getter">;
Expand Down
1 change: 0 additions & 1 deletion src/type/preload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export interface Sandbox {
setDefaultStyleIds(
defaultStyleIds: { speakerUuid: string; defaultStyleId: number }[]
): Promise<void>;
useVoicing(newData?: boolean): Promise<boolean>;
}

export type AppInfos = {
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/store/Vuex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe("store/vuex.js test", () => {
},
isPinned: false,
hotkeySettings: [],
useVoicing: false,
engineHost: "http://127.0.0.1",
},
getters: {
Expand Down Expand Up @@ -110,6 +109,5 @@ describe("store/vuex.js test", () => {
assert.equal(store.state.isPinned, false);
assert.isArray(store.state.hotkeySettings);
assert.isEmpty(store.state.hotkeySettings);
assert.equal(store.state.useVoicing, false);
});
});

0 comments on commit 3bdad5d

Please sign in to comment.