Skip to content

Commit

Permalink
Forced splitting with 32 SG phonemes. Fixes #60
Browse files Browse the repository at this point in the history
  • Loading branch information
PoneyClairDeLune committed Feb 5, 2025
1 parent 90d681c commit fcca95d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/state/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ let OctaviaDevice = class extends CustomEventSource {
#masterVol = 100;
#metaChannel = 0;
#noteLength = 500;
#convertLastSyllable = 0;
#sgConvertLastSyllable = 0;
#sgRunningLineLength = 0;
#sgMaxLineLength = 32;
#letterDisp = "";
#letterExpire = 0;
#letterSet = 0;
Expand Down Expand Up @@ -1895,7 +1897,8 @@ let OctaviaDevice = class extends CustomEventSource {
upThis.#masterVol = 100;
upThis.#metaTexts = [];
upThis.#noteLength = 500;
upThis.#convertLastSyllable = 0;
upThis.#sgConvertLastSyllable = 0;
upThis.#sgRunningLineLength = 0;
upThis.#bitmapExpire = 0;
upThis.#bitmapPage = 0;
upThis.#bitmap.fill(0);
Expand Down Expand Up @@ -3426,19 +3429,26 @@ let OctaviaDevice = class extends CustomEventSource {
length += e * 13; // 7.5ms
};
});
if (timeNow >= upThis.#convertLastSyllable) {
this.dispatchEvent("metacommit", {
if (
timeNow >= upThis.#sgConvertLastSyllable ||
upThis.#sgRunningLineLength >= upThis.#sgMaxLineLength
) {
upThis.dispatchEvent("metacommit", {
"type": "SGLyrics",
"data": "",
"amend": false
});
//console.debug(`Splitted at length: ${upThis.#sgRunningLineLength}`);
upThis.#sgRunningLineLength = 0;
};
this.dispatchEvent("metacommit", {
upThis.dispatchEvent("metacommit", {
"type": "SGLyrics",
"data": `${getSgKana(vocal)}`,
"amend": true
});
upThis.#convertLastSyllable = timeNow + Math.ceil(length / 2) + upThis.#noteLength;
upThis.#sgRunningLineLength ++;
//console.debug(`Running length: ${upThis.#sgRunningLineLength}`);
upThis.#sgConvertLastSyllable = timeNow + Math.ceil(length / 2) + upThis.#noteLength;
if (getDebugState()) {
console.debug(`${dPref}vocals: ${vocal}`);
};
Expand Down

0 comments on commit fcca95d

Please sign in to comment.