From c3476b7442e523964cddd4ec9ddbece785c7e7e8 Mon Sep 17 00:00:00 2001
From: qwerty2501 <939468+qwerty2501@users.noreply.github.com>
Date: Wed, 29 Dec 2021 17:16:39 +0900
Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E3=82=A2=E3=82=AF=E3=82=BB?=
=?UTF-8?q?=E3=83=B3=E3=83=88=E5=8F=A5=E5=8D=98=E4=BD=8D=E3=81=A7=E3=81=BE?=
=?UTF-8?q?=E3=81=A8=E3=82=81=E3=81=A6=E3=83=A2=E3=83=BC=E3=83=A9=E8=A8=AD?=
=?UTF-8?q?=E5=AE=9A=E5=80=A4=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=A7=E3=81=8D?=
=?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Altを押してる間は一緒に上がるように修正した
refs #551
---
src/components/AudioDetail.vue | 122 ++++++++++++++++++++++++++-------
1 file changed, 98 insertions(+), 24 deletions(-)
diff --git a/src/components/AudioDetail.vue b/src/components/AudioDetail.vue
index 9c93e00886..0682b18485 100644
--- a/src/components/AudioDetail.vue
+++ b/src/components/AudioDetail.vue
@@ -59,8 +59,8 @@
:accentPhraseIndex="accentPhraseIndex"
:value="mora.pitch"
:uiLocked="uiLocked"
- :min="3"
- :max="6.5"
+ :min="minPitch"
+ :max="maxPitch"
:disable="mora.pitch == 0.0"
:type="'pitch'"
:clip="false"
@@ -84,8 +84,8 @@
:accentPhraseIndex="accentPhraseIndex"
:value="mora.consonantLength"
:uiLocked="uiLocked"
- :min="0"
- :max="0.3"
+ :min="minMoraLength"
+ :max="maxMoraLength"
:step="0.001"
:type="'consonant'"
:clip="true"
@@ -99,8 +99,8 @@
:accentPhraseIndex="accentPhraseIndex"
:value="mora.vowelLength"
:uiLocked="uiLocked"
- :min="0"
- :max="0.3"
+ :min="minMoraLength"
+ :max="maxMoraLength"
:step="0.001"
:type="'vowel'"
:clip="mora.consonant ? true : false"
@@ -323,22 +323,94 @@ export default defineComponent({
});
};
+ const maxPitch = 6.5;
+ const minPitch = 3;
+ const maxMoraLength = 0.3;
+ const minMoraLength = 0;
const changeMoraData = (
accentPhraseIndex: number,
moraIndex: number,
data: number,
type: MoraDataType
) => {
- if (type == "pitch") {
- lastPitches.value[accentPhraseIndex][moraIndex] = data;
+ if (altKeyFlag.value) {
+ if (accentPhrases.value !== undefined) {
+ const accentPhrase = accentPhrases.value[accentPhraseIndex];
+ const targetMora = accentPhrase.moras[moraIndex];
+
+ let diffData = data;
+ switch (type) {
+ case "pitch":
+ diffData -= targetMora.pitch;
+ break;
+ case "consonant":
+ if (targetMora.consonantLength !== undefined) {
+ diffData -= targetMora.consonantLength;
+ }
+ break;
+ case "vowel":
+ diffData -= targetMora.vowelLength;
+ break;
+ }
+
+ accentPhrase.moras.forEach((mora, moraIndex) => {
+ switch (type) {
+ case "pitch":
+ {
+ const newData = Math.max(
+ minPitch,
+ Math.min(maxPitch, mora.pitch + diffData)
+ );
+ lastPitches.value[accentPhraseIndex][moraIndex] = newData;
+ store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
+ audioKey: props.activeAudioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data: newData,
+ type,
+ });
+ }
+ break;
+ case "consonant":
+ case "vowel":
+ if (mora.consonantLength !== undefined) {
+ store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
+ audioKey: props.activeAudioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data: Math.max(
+ minMoraLength,
+ Math.min(maxMoraLength, mora.consonantLength + diffData)
+ ),
+ type: "consonant",
+ });
+ }
+ store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
+ audioKey: props.activeAudioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data: Math.max(
+ minMoraLength,
+ Math.min(maxMoraLength, mora.vowelLength + diffData)
+ ),
+ type: "vowel",
+ });
+ break;
+ }
+ });
+ }
+ } else {
+ if (type == "pitch") {
+ lastPitches.value[accentPhraseIndex][moraIndex] = data;
+ }
+ store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
+ audioKey: props.activeAudioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data,
+ type,
+ });
}
- store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
- audioKey: props.activeAudioKey,
- accentPhraseIndex,
- moraIndex,
- data,
- type,
- });
};
// audio play
@@ -524,15 +596,13 @@ export default defineComponent({
};
const shiftKeyFlag = ref(false);
+ const altKeyFlag = ref(false);
- const setShiftKeyFlag = (event: KeyboardEvent) => {
+ const keyEventListter = (event: KeyboardEvent) => {
shiftKeyFlag.value = event.shiftKey;
+ altKeyFlag.value = event.altKey;
};
- function resetShiftKeyFlag(event: KeyboardEvent) {
- if (event.key === "Shift") shiftKeyFlag.value = false;
- }
-
const handleChangeVoicing = (
mora: Mora,
accentPhraseIndex: number,
@@ -558,16 +628,20 @@ export default defineComponent({
};
onMounted(() => {
- window.addEventListener("keyup", resetShiftKeyFlag);
- document.addEventListener("keydown", setShiftKeyFlag);
+ window.addEventListener("keyup", keyEventListter);
+ document.addEventListener("keydown", keyEventListter);
});
onUnmounted(() => {
- window.removeEventListener("keyup", resetShiftKeyFlag);
- document.removeEventListener("keydown", setShiftKeyFlag);
+ window.removeEventListener("keyup", keyEventListter);
+ document.removeEventListener("keydown", keyEventListter);
});
return {
+ maxPitch,
+ minPitch,
+ maxMoraLength,
+ minMoraLength,
selectDetail,
selectedDetail,
uiLocked,
From d975a8c722ba6cf5459100edd78c68d77ac8e1ed Mon Sep 17 00:00:00 2001
From: qwerty2501 <939468+qwerty2501@users.noreply.github.com>
Date: Wed, 29 Dec 2021 19:53:20 +0900
Subject: [PATCH 2/9] =?UTF-8?q?feat:=20howtouse=E3=81=AB=E8=AA=AC=E6=98=8E?=
=?UTF-8?q?=E8=BF=BD=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/howtouse.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/public/howtouse.md b/public/howtouse.md
index 749e2ffc74..d27c4add83 100644
--- a/public/howtouse.md
+++ b/public/howtouse.md
@@ -206,6 +206,8 @@ Apple Silicon搭載のMacとRosettaの詳しい情報はこちらのリソース
- スライダーの値を変更します
- Ctrl キーを押しながらマウスホイールを使うと更に細かく調整できます
- スライダー →
+- Alt キーを押しながらアクセントのイントネーションと長さを調整
+ - 増減させた値分、同じアクセントの値を増減します
From e3793b7d212b1a64d53d5c36606f566cf5a57499 Mon Sep 17 00:00:00 2001
From: qwerty2501 <939468+qwerty2501@users.noreply.github.com>
Date: Thu, 30 Dec 2021 03:33:53 +0900
Subject: [PATCH 3/9] =?UTF-8?q?pitch=E3=81=8C0=E3=81=AE=E5=A0=B4=E5=90=88?=
=?UTF-8?q?=E3=81=AF=E5=A4=89=E6=9B=B4=E3=81=97=E3=81=AA=E3=81=84=E3=82=88?=
=?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
pitch0は固定にするという仕様のため
---
src/components/AudioDetail.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/AudioDetail.vue b/src/components/AudioDetail.vue
index 0682b18485..4c76e25a80 100644
--- a/src/components/AudioDetail.vue
+++ b/src/components/AudioDetail.vue
@@ -356,7 +356,7 @@ export default defineComponent({
accentPhrase.moras.forEach((mora, moraIndex) => {
switch (type) {
case "pitch":
- {
+ if (mora.pitch > 0) {
const newData = Math.max(
minPitch,
Math.min(maxPitch, mora.pitch + diffData)
From 958a25b41e754df198aa210ca92bb2eeb4c7cc1f Mon Sep 17 00:00:00 2001
From: qwerty2501 <939468+qwerty2501@users.noreply.github.com>
Date: Wed, 12 Jan 2022 11:56:39 +0900
Subject: [PATCH 4/9] =?UTF-8?q?=E6=8C=87=E6=91=98=E3=81=AB=E3=82=88?=
=?UTF-8?q?=E3=82=8B=E8=AA=AC=E6=98=8E=E6=96=87=E3=81=AE=E4=BF=AE=E6=AD=A3?=
=?UTF-8?q?=E5=8F=8D=E6=98=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Hiroshiba
---
public/howtouse.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/public/howtouse.md b/public/howtouse.md
index d27c4add83..aa4e894f55 100644
--- a/public/howtouse.md
+++ b/public/howtouse.md
@@ -206,8 +206,7 @@ Apple Silicon搭載のMacとRosettaの詳しい情報はこちらのリソース
- スライダーの値を変更します
- Ctrl キーを押しながらマウスホイールを使うと更に細かく調整できます
- スライダー →
-- Alt キーを押しながらアクセントのイントネーションと長さを調整
- - 増減させた値分、同じアクセントの値を増減します
+ - Alt キーを押しながらイントネーションや長さを調整することで、同じアクセント区間内を同時に調整できます
From ef2a7de7e409f13c309a0ba460fc14a1a54b9b2c Mon Sep 17 00:00:00 2001
From: qwerty2501 <939468+qwerty2501@users.noreply.github.com>
Date: Wed, 12 Jan 2022 23:12:54 +0900
Subject: [PATCH 5/9] =?UTF-8?q?=E5=87=A6=E7=90=86=E3=82=92=E4=B8=80?=
=?UTF-8?q?=E8=88=AC=E7=9A=84=E3=81=AA=E3=82=82=E3=81=AE=E3=82=92=E4=B8=8A?=
=?UTF-8?q?=E3=81=AB=E6=9D=A5=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97?=
=?UTF-8?q?=E3=81=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/AudioDetail.vue | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/components/AudioDetail.vue b/src/components/AudioDetail.vue
index 4c76e25a80..77488366e3 100644
--- a/src/components/AudioDetail.vue
+++ b/src/components/AudioDetail.vue
@@ -333,7 +333,18 @@ export default defineComponent({
data: number,
type: MoraDataType
) => {
- if (altKeyFlag.value) {
+ if (altKeyFlag.value === false) {
+ if (type == "pitch") {
+ lastPitches.value[accentPhraseIndex][moraIndex] = data;
+ }
+ store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
+ audioKey: props.activeAudioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data,
+ type,
+ });
+ } else {
if (accentPhrases.value !== undefined) {
const accentPhrase = accentPhrases.value[accentPhraseIndex];
const targetMora = accentPhrase.moras[moraIndex];
@@ -399,17 +410,6 @@ export default defineComponent({
}
});
}
- } else {
- if (type == "pitch") {
- lastPitches.value[accentPhraseIndex][moraIndex] = data;
- }
- store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
- audioKey: props.activeAudioKey,
- accentPhraseIndex,
- moraIndex,
- data,
- type,
- });
}
};
From c258b0bd60d527aca62843f08ae2d0298d7c94c4 Mon Sep 17 00:00:00 2001
From: qwerty2501 <939468+qwerty2501@users.noreply.github.com>
Date: Wed, 12 Jan 2022 23:25:46 +0900
Subject: [PATCH 6/9] =?UTF-8?q?accentPhrases=E3=81=8C=E3=81=AA=E3=81=8B?=
=?UTF-8?q?=E3=81=A3=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AF=E4=BE=8B=E5=A4=96?=
=?UTF-8?q?=E3=82=92=E6=8A=95=E3=81=92=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?=
=?UTF-8?q?=E3=81=97=E3=81=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/AudioDetail.vue | 103 +++++++++++++++++----------------
1 file changed, 52 insertions(+), 51 deletions(-)
diff --git a/src/components/AudioDetail.vue b/src/components/AudioDetail.vue
index 77488366e3..17bee64a4f 100644
--- a/src/components/AudioDetail.vue
+++ b/src/components/AudioDetail.vue
@@ -345,71 +345,72 @@ export default defineComponent({
type,
});
} else {
- if (accentPhrases.value !== undefined) {
- const accentPhrase = accentPhrases.value[accentPhraseIndex];
- const targetMora = accentPhrase.moras[moraIndex];
+ if (accentPhrases.value === undefined) {
+ throw Error("accentPhrases.value === undefined");
+ }
+ const accentPhrase = accentPhrases.value[accentPhraseIndex];
+ const targetMora = accentPhrase.moras[moraIndex];
+
+ let diffData = data;
+ switch (type) {
+ case "pitch":
+ diffData -= targetMora.pitch;
+ break;
+ case "consonant":
+ if (targetMora.consonantLength !== undefined) {
+ diffData -= targetMora.consonantLength;
+ }
+ break;
+ case "vowel":
+ diffData -= targetMora.vowelLength;
+ break;
+ }
- let diffData = data;
+ accentPhrase.moras.forEach((mora, moraIndex) => {
switch (type) {
case "pitch":
- diffData -= targetMora.pitch;
- break;
- case "consonant":
- if (targetMora.consonantLength !== undefined) {
- diffData -= targetMora.consonantLength;
+ if (mora.pitch > 0) {
+ const newData = Math.max(
+ minPitch,
+ Math.min(maxPitch, mora.pitch + diffData)
+ );
+ lastPitches.value[accentPhraseIndex][moraIndex] = newData;
+ store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
+ audioKey: props.activeAudioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data: newData,
+ type,
+ });
}
break;
+ case "consonant":
case "vowel":
- diffData -= targetMora.vowelLength;
- break;
- }
-
- accentPhrase.moras.forEach((mora, moraIndex) => {
- switch (type) {
- case "pitch":
- if (mora.pitch > 0) {
- const newData = Math.max(
- minPitch,
- Math.min(maxPitch, mora.pitch + diffData)
- );
- lastPitches.value[accentPhraseIndex][moraIndex] = newData;
- store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
- audioKey: props.activeAudioKey,
- accentPhraseIndex,
- moraIndex,
- data: newData,
- type,
- });
- }
- break;
- case "consonant":
- case "vowel":
- if (mora.consonantLength !== undefined) {
- store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
- audioKey: props.activeAudioKey,
- accentPhraseIndex,
- moraIndex,
- data: Math.max(
- minMoraLength,
- Math.min(maxMoraLength, mora.consonantLength + diffData)
- ),
- type: "consonant",
- });
- }
+ if (mora.consonantLength !== undefined) {
store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
audioKey: props.activeAudioKey,
accentPhraseIndex,
moraIndex,
data: Math.max(
minMoraLength,
- Math.min(maxMoraLength, mora.vowelLength + diffData)
+ Math.min(maxMoraLength, mora.consonantLength + diffData)
),
- type: "vowel",
+ type: "consonant",
});
- break;
- }
- });
- }
+ }
+ store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
+ audioKey: props.activeAudioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data: Math.max(
+ minMoraLength,
+ Math.min(maxMoraLength, mora.vowelLength + diffData)
+ ),
+ type: "vowel",
+ });
+ break;
+ }
+ });
}
};
From 50cdb2bcf9a924e536bbd90818cdd3a4578bae2a Mon Sep 17 00:00:00 2001
From: qwerty2501 <939468+qwerty2501@users.noreply.github.com>
Date: Thu, 13 Jan 2022 00:08:15 +0900
Subject: [PATCH 7/9] =?UTF-8?q?false=E3=81=A8=E3=81=AE=E6=AF=94=E8=BC=83?=
=?UTF-8?q?=E3=81=8B=E3=82=89=E5=90=A6=E5=AE=9A=E5=BD=A2=E3=81=AB=E5=A4=89?=
=?UTF-8?q?=E6=9B=B4(undefined=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AB?=
=?UTF-8?q?=E5=82=99=E3=81=88=E3=82=8B=E3=81=9F=E3=82=81)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/AudioDetail.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/AudioDetail.vue b/src/components/AudioDetail.vue
index 17bee64a4f..4f30bbbeb8 100644
--- a/src/components/AudioDetail.vue
+++ b/src/components/AudioDetail.vue
@@ -333,7 +333,7 @@ export default defineComponent({
data: number,
type: MoraDataType
) => {
- if (altKeyFlag.value === false) {
+ if (!altKeyFlag.value) {
if (type == "pitch") {
lastPitches.value[accentPhraseIndex][moraIndex] = data;
}
From 7322cdd3afa9d072c9402d715b46f5f32f7251ac Mon Sep 17 00:00:00 2001
From: qwerty2501 <939468+qwerty2501@users.noreply.github.com>
Date: Thu, 13 Jan 2022 22:53:57 +0900
Subject: [PATCH 8/9] =?UTF-8?q?AccentPhrase=E5=8D=98=E4=BD=8D=E3=81=A7?=
=?UTF-8?q?=E3=81=AE=E8=AA=BF=E6=95=B4=E5=87=A6=E7=90=86=E3=82=92=E3=81=A8?=
=?UTF-8?q?=E3=82=8A=E3=81=82=E3=81=88=E3=81=9ACommand=E5=8C=96=E3=81=97?=
=?UTF-8?q?=E3=81=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
処理をそのままコピペしただけ
---
src/components/AudioDetail.vue | 68 +++--------------------
src/store/audio.ts | 98 ++++++++++++++++++++++++++++++++++
src/store/type.ts | 19 +++++++
3 files changed, 124 insertions(+), 61 deletions(-)
diff --git a/src/components/AudioDetail.vue b/src/components/AudioDetail.vue
index 4f30bbbeb8..3054ef1734 100644
--- a/src/components/AudioDetail.vue
+++ b/src/components/AudioDetail.vue
@@ -349,67 +349,13 @@ export default defineComponent({
throw Error("accentPhrases.value === undefined");
}
const accentPhrase = accentPhrases.value[accentPhraseIndex];
- const targetMora = accentPhrase.moras[moraIndex];
-
- let diffData = data;
- switch (type) {
- case "pitch":
- diffData -= targetMora.pitch;
- break;
- case "consonant":
- if (targetMora.consonantLength !== undefined) {
- diffData -= targetMora.consonantLength;
- }
- break;
- case "vowel":
- diffData -= targetMora.vowelLength;
- break;
- }
-
- accentPhrase.moras.forEach((mora, moraIndex) => {
- switch (type) {
- case "pitch":
- if (mora.pitch > 0) {
- const newData = Math.max(
- minPitch,
- Math.min(maxPitch, mora.pitch + diffData)
- );
- lastPitches.value[accentPhraseIndex][moraIndex] = newData;
- store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
- audioKey: props.activeAudioKey,
- accentPhraseIndex,
- moraIndex,
- data: newData,
- type,
- });
- }
- break;
- case "consonant":
- case "vowel":
- if (mora.consonantLength !== undefined) {
- store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
- audioKey: props.activeAudioKey,
- accentPhraseIndex,
- moraIndex,
- data: Math.max(
- minMoraLength,
- Math.min(maxMoraLength, mora.consonantLength + diffData)
- ),
- type: "consonant",
- });
- }
- store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", {
- audioKey: props.activeAudioKey,
- accentPhraseIndex,
- moraIndex,
- data: Math.max(
- minMoraLength,
- Math.min(maxMoraLength, mora.vowelLength + diffData)
- ),
- type: "vowel",
- });
- break;
- }
+ store.dispatch("COMMAND_SET_AUDIO_MORA_DATA_ACCENT_PHRASE", {
+ audioKey: props.activeAudioKey,
+ accentPhraseIndex,
+ accentPhrase,
+ moraIndex,
+ data,
+ type,
});
}
};
diff --git a/src/store/audio.ts b/src/store/audio.ts
index 12ae663af8..6b5fab638e 100644
--- a/src/store/audio.ts
+++ b/src/store/audio.ts
@@ -1661,6 +1661,19 @@ export const audioCommandStore: VoiceVoxStoreOptions<
) {
commit("COMMAND_SET_AUDIO_MORA_DATA", payload);
},
+ COMMAND_SET_AUDIO_MORA_DATA_ACCENT_PHRASE(
+ { commit },
+ payload: {
+ audioKey: string;
+ accentPhraseIndex: number;
+ accentPhrase: AccentPhrase;
+ moraIndex: number;
+ data: number;
+ type: MoraDataType;
+ }
+ ) {
+ commit("COMMAND_SET_AUDIO_MORA_DATA_ACCENT_PHRASE", payload);
+ },
COMMAND_SET_AUDIO_SPEED_SCALE(
{ commit },
payload: { audioKey: string; speedScale: number }
@@ -1953,6 +1966,91 @@ export const audioCommandStore: VoiceVoxStoreOptions<
) {
audioStore.mutations.SET_AUDIO_MORA_DATA(draft, payload);
},
+ COMMAND_SET_AUDIO_MORA_DATA_ACCENT_PHRASE(
+ draft,
+ payload: {
+ audioKey: string;
+ accentPhraseIndex: number;
+ accentPhrase: AccentPhrase;
+ moraIndex: number;
+ data: number;
+ type: MoraDataType;
+ }
+ ) {
+ const maxPitch = 6.5;
+ const minPitch = 3;
+ const maxMoraLength = 0.3;
+ const minMoraLength = 0;
+ const {
+ audioKey,
+ accentPhraseIndex,
+ accentPhrase,
+ moraIndex,
+ data,
+ type,
+ } = payload;
+ const targetMora = accentPhrase.moras[moraIndex];
+
+ let diffData = data;
+ switch (type) {
+ case "pitch":
+ diffData -= targetMora.pitch;
+ break;
+ case "consonant":
+ if (targetMora.consonantLength !== undefined) {
+ diffData -= targetMora.consonantLength;
+ }
+ break;
+ case "vowel":
+ diffData -= targetMora.vowelLength;
+ break;
+ }
+
+ accentPhrase.moras.forEach((mora, moraIndex) => {
+ switch (type) {
+ case "pitch":
+ if (mora.pitch > 0) {
+ const newData = Math.max(
+ minPitch,
+ Math.min(maxPitch, mora.pitch + diffData)
+ );
+ audioStore.mutations.SET_AUDIO_MORA_DATA(draft, {
+ audioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data: newData,
+ type,
+ });
+ }
+ break;
+ case "consonant":
+ case "vowel":
+ if (mora.consonantLength !== undefined) {
+ audioStore.mutations.SET_AUDIO_MORA_DATA(draft, {
+ audioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data: Math.max(
+ minMoraLength,
+ Math.min(maxMoraLength, mora.consonantLength + diffData)
+ ),
+ type,
+ });
+ }
+ audioStore.mutations.SET_AUDIO_MORA_DATA(draft, {
+ audioKey,
+ accentPhraseIndex,
+ moraIndex,
+ data: Math.max(
+ minMoraLength,
+ Math.min(maxMoraLength, mora.vowelLength + diffData)
+ ),
+ type: "vowel",
+ });
+ break;
+ }
+ });
+ },
COMMAND_SET_AUDIO_SPEED_SCALE(
draft,
payload: { audioKey: string; speedScale: number }
diff --git a/src/store/type.ts b/src/store/type.ts
index c00af87e90..f0b8590ca3 100644
--- a/src/store/type.ts
+++ b/src/store/type.ts
@@ -442,6 +442,25 @@ type AudioCommandStoreTypes = {
}): void;
};
+ COMMAND_SET_AUDIO_MORA_DATA_ACCENT_PHRASE: {
+ mutation: {
+ audioKey: string;
+ accentPhraseIndex: number;
+ accentPhrase: AccentPhrase;
+ moraIndex: number;
+ data: number;
+ type: MoraDataType;
+ };
+ action(payload: {
+ audioKey: string;
+ accentPhraseIndex: number;
+ accentPhrase: AccentPhrase;
+ moraIndex: number;
+ data: number;
+ type: MoraDataType;
+ }): void;
+ };
+
COMMAND_SET_AUDIO_SPEED_SCALE: {
mutation: { audioKey: string; speedScale: number };
action(payload: { audioKey: string; speedScale: number }): void;
From 28b9b0bb20e8e76ac39c14a0835550f002c24597 Mon Sep 17 00:00:00 2001
From: qwerty2501 <939468+qwerty2501@users.noreply.github.com>
Date: Fri, 14 Jan 2022 22:41:17 +0900
Subject: [PATCH 9/9] =?UTF-8?q?=E6=AF=8D=E9=9F=B3=E3=82=92=E5=A2=97?=
=?UTF-8?q?=E6=B8=9B=E3=81=95=E3=81=9B=E3=81=9F=E6=99=82=E3=81=AB=E5=AD=90?=
=?UTF-8?q?=E9=9F=B3=E3=81=AE=E5=80=A4=E3=81=8C=E5=8F=8D=E6=98=A0=E3=81=95?=
=?UTF-8?q?=E3=81=9B=E3=82=8C=E3=81=AA=E3=81=84=E3=83=90=E3=82=B0=E3=82=92?=
=?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/AudioDetail.vue | 2 --
src/store/audio.ts | 18 +++++++-----------
src/store/type.ts | 2 --
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/components/AudioDetail.vue b/src/components/AudioDetail.vue
index 3054ef1734..69e9b1f95a 100644
--- a/src/components/AudioDetail.vue
+++ b/src/components/AudioDetail.vue
@@ -348,11 +348,9 @@ export default defineComponent({
if (accentPhrases.value === undefined) {
throw Error("accentPhrases.value === undefined");
}
- const accentPhrase = accentPhrases.value[accentPhraseIndex];
store.dispatch("COMMAND_SET_AUDIO_MORA_DATA_ACCENT_PHRASE", {
audioKey: props.activeAudioKey,
accentPhraseIndex,
- accentPhrase,
moraIndex,
data,
type,
diff --git a/src/store/audio.ts b/src/store/audio.ts
index 6b5fab638e..79b19e71f3 100644
--- a/src/store/audio.ts
+++ b/src/store/audio.ts
@@ -1666,7 +1666,6 @@ export const audioCommandStore: VoiceVoxStoreOptions<
payload: {
audioKey: string;
accentPhraseIndex: number;
- accentPhrase: AccentPhrase;
moraIndex: number;
data: number;
type: MoraDataType;
@@ -1971,7 +1970,6 @@ export const audioCommandStore: VoiceVoxStoreOptions<
payload: {
audioKey: string;
accentPhraseIndex: number;
- accentPhrase: AccentPhrase;
moraIndex: number;
data: number;
type: MoraDataType;
@@ -1981,14 +1979,12 @@ export const audioCommandStore: VoiceVoxStoreOptions<
const minPitch = 3;
const maxMoraLength = 0.3;
const minMoraLength = 0;
- const {
- audioKey,
- accentPhraseIndex,
- accentPhrase,
- moraIndex,
- data,
- type,
- } = payload;
+ const { audioKey, accentPhraseIndex, moraIndex, data, type } = payload;
+ const audioItem = draft.audioItems[audioKey];
+ if (audioItem.query === undefined) {
+ throw Error("draft.audioItems[audioKey].query === undefined");
+ }
+ const accentPhrase = audioItem.query.accentPhrases[accentPhraseIndex];
const targetMora = accentPhrase.moras[moraIndex];
let diffData = data;
@@ -2034,7 +2030,7 @@ export const audioCommandStore: VoiceVoxStoreOptions<
minMoraLength,
Math.min(maxMoraLength, mora.consonantLength + diffData)
),
- type,
+ type: "consonant",
});
}
audioStore.mutations.SET_AUDIO_MORA_DATA(draft, {
diff --git a/src/store/type.ts b/src/store/type.ts
index f0b8590ca3..df8f22b20f 100644
--- a/src/store/type.ts
+++ b/src/store/type.ts
@@ -446,7 +446,6 @@ type AudioCommandStoreTypes = {
mutation: {
audioKey: string;
accentPhraseIndex: number;
- accentPhrase: AccentPhrase;
moraIndex: number;
data: number;
type: MoraDataType;
@@ -454,7 +453,6 @@ type AudioCommandStoreTypes = {
action(payload: {
audioKey: string;
accentPhraseIndex: number;
- accentPhrase: AccentPhrase;
moraIndex: number;
data: number;
type: MoraDataType;