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

[project-s] Phraseをストアで持つようにする #1663

Merged
merged 2 commits into from
Dec 3, 2023

Conversation

sigprogramming
Copy link
Contributor

@sigprogramming sigprogramming commented Dec 2, 2023

内容

Phraseをストア(VuexのState)で持つようにし、ストアで持てないBlobなどはPhraseDataで持つようにします。
また、以下も行います。

  • PhrasestartTimeの計算をAudioQuery生成・編集時に行うようにする
  • AudioQueryのハッシュを計算・比較する処理を一旦削除
  • exportingAudionowAudioExportingに変更
  • EXPORT_WAVE_FILEにレンダリング未完了の場合の処理が残っていたので削除

関連 Issue

VOICEVOX/voicevox_project#15

その他

@sigprogramming sigprogramming requested a review from a team as a code owner December 2, 2023 11:50
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

いろいろコメントしていますが、このPRでマストで変更がいる感じではないのでそのままマージさせていただきます!

Comment on lines +281 to +285
type PhraseData = {
blob?: Blob;
source?: Instrument | AudioPlayer; // ひとまずPhraseDataに持たせる
sequence?: Sequence; // ひとまずPhraseDataに持たせる
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

おそらくこのデータは、Vuex内で閉じていて他で使ってほしくない値というニュアンスなのかなと思いました!
ローカル変数の概念が無いのでそう分けられたのかなと。

となると、コメントでこの型の説明付けておくとニュアンス伝わりやすいかもです。こんな感じとか?

Suggested change
type PhraseData = {
blob?: Blob;
source?: Instrument | AudioPlayer; // ひとまずPhraseDataに持たせる
sequence?: Sequence; // ひとまずPhraseDataに持たせる
};
// Phraseのstore内用データ
type PhraseData = {
blob?: Blob;
source?: Instrument | AudioPlayer; // ひとまずPhraseDataに持たせる
sequence?: Sequence; // ひとまずPhraseDataに持たせる
};

Comment on lines -297 to 289
const allPhrases = new Map<string, Phrase>();
const phraseDataMap = new Map<string, PhraseData>();
const phraseAudioBlobCache = new Map<string, Blob>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PhraseDataにもblobがあって、それとは別にphraseAudioBlobCacheもあるのでちょっとややこしいかもと思いました!

Comment on lines +1225 to +1228
commit("SET_AUDIO_QUERY_TO_PHRASE", { phraseKey: key, audioQuery });

const startTime = calcStartTime(phrase.score, audioQuery);
commit("SET_START_TIME_TO_PHRASE", { phraseKey: key, startTime });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

audioQueryとstartTimeは片方が存在すればもう片方は必ず存在する気がするので、それを型に入れてあげるとundefinedチェック用のifを二回実行しなくて済むかもと思いました!
つまり、こうでも良いかも、と。

type Phrase = {
  otherData?: {
    audioQuery: AudioQuery,
    startTime: number
  }
}

まあこのあたり今はどういう形が最高かわからないのですが、こういう考え方もあるよという感じで・・・!

@Hiroshiba Hiroshiba merged commit 46556c9 into VOICEVOX:project-s Dec 3, 2023
7 checks passed
@sigprogramming sigprogramming deleted the phrase branch January 14, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants