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] レンダリングできなかったときの表示を修正 #1740

Merged
Merged
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
31 changes: 19 additions & 12 deletions src/components/Sing/ScoreSequencer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export default defineComponent({
let dragStartNoteNumber = 0;
let dragStartGuideLineTicks = 0;
let draggingNoteId = ""; // FIXME: 無効状態はstring以外の型にする
let executePreviewProcess = false;
let edited = false; // プレビュー終了時にScoreの変更を行うかどうかを表す変数
// ダブルクリック
let mouseDownNoteId: string | undefined;
Expand Down Expand Up @@ -518,17 +519,20 @@ export default defineComponent({
};

const preview = () => {
if (previewMode === "ADD") {
previewAdd();
}
if (previewMode === "MOVE") {
previewMove();
}
if (previewMode === "RESIZE_RIGHT") {
previewResizeRight();
}
if (previewMode === "RESIZE_LEFT") {
previewResizeLeft();
if (executePreviewProcess) {
if (previewMode === "ADD") {
previewAdd();
}
if (previewMode === "MOVE") {
previewMove();
}
if (previewMode === "RESIZE_RIGHT") {
previewResizeRight();
}
if (previewMode === "RESIZE_LEFT") {
previewResizeLeft();
}
executePreviewProcess = false;
}
previewRequestId = requestAnimationFrame(preview);
};
Expand Down Expand Up @@ -628,6 +632,7 @@ export default defineComponent({
dragStartNoteNumber = cursorNoteNumber;
dragStartGuideLineTicks = guideLineTicks;
draggingNoteId = note.id;
executePreviewProcess = true;
edited = mode === "ADD";
copiedNotesForPreview.clear();
for (const copiedNote of copiedNotes) {
Expand Down Expand Up @@ -706,7 +711,9 @@ export default defineComponent({
cursorX = getXInBorderBox(event.clientX, sequencerBodyElement);
cursorY = getYInBorderBox(event.clientY, sequencerBodyElement);

if (!nowPreviewing.value) {
if (nowPreviewing.value) {
executePreviewProcess = true;
} else {
const scrollLeft = sequencerBodyElement.scrollLeft;
const cursorBaseX = (scrollLeft + cursorX) / zoomX.value;
const cursorTicks = baseXToTick(cursorBaseX, tpqn.value);
Expand Down
27 changes: 23 additions & 4 deletions src/store/singing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,10 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
continue;
}

if (phrase.state === "WAITING_TO_BE_RENDERED") {
if (
phrase.state === "WAITING_TO_BE_RENDERED" ||
phrase.state === "COULD_NOT_RENDER"
) {
commit("SET_STATE_TO_PHRASE", {
phraseKey,
phraseState: "NOW_RENDERING",
Expand All @@ -1073,14 +1076,20 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
if (!phrase.query) {
const engineId = phrase.singer.engineId;
const frameRate = state.engineManifests[engineId].frameRate;
const restDurationSeconds = 1; // 仮置き
const restDurationSeconds = 1; // 前後の休符の長さはとりあえず1秒に設定

const frameAudioQuery = await fetchQuery(
phrase.singer.engineId,
phrase.score,
frameRate,
restDurationSeconds
);
).catch((error) => {
commit("SET_STATE_TO_PHRASE", {
phraseKey,
phraseState: "COULD_NOT_RENDER",
});
throw error;
});
const phonemes = getPhonemes(frameAudioQuery);

window.electron.logInfo(
Expand Down Expand Up @@ -1124,7 +1133,17 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
if (phraseData.blob) {
window.electron.logInfo(`Loaded audio buffer from cache.`);
} else {
phraseData.blob = await synthesize(phrase.singer, phrase.query);
const blob = await synthesize(phrase.singer, phrase.query).catch(
(error) => {
commit("SET_STATE_TO_PHRASE", {
phraseKey,
phraseState: "COULD_NOT_RENDER",
});
throw error;
}
);

phraseData.blob = blob;
phraseAudioBlobCache.set(phraseKey, phraseData.blob);

window.electron.logInfo(`Synthesized.`);
Expand Down
Loading