Skip to content

Commit

Permalink
feat: attempt to fix chart
Browse files Browse the repository at this point in the history
  • Loading branch information
xhayper committed Nov 12, 2023
1 parent 8412291 commit 7317683
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/internal/syntacticAnalysis/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class Serializer {
let writer = "";

writer += `(${chart.timingChanges[this._currentTimingChange].tempo})`;
writer += `{{${chart.timingChanges[this._currentTimingChange].subdivisions}}}`;
writer += `{${chart.timingChanges[this._currentTimingChange].subdivisions}}`;

while (this._currentTime <= (chart.finishTiming ? chart.finishTiming : 0)) {
if (
Expand All @@ -39,7 +39,7 @@ export class Serializer {
chart.timingChanges[this._currentTimingChange - 1].subdivisions
) > 1.401298E-45
) {
writer += `{{${chart.timingChanges[this._currentTimingChange].subdivisions}}}`;
writer += `{${chart.timingChanges[this._currentTimingChange].subdivisions}}`;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/internal/syntacticAnalysis/states/subdivisionReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class SubdivisionReader {
}

newTimingChange.subdivisions = subdivision;
newTimingChange.time = parent.currentTime;

if (Math.abs(parent.timingChanges[parent.timingChanges.length - 1].time - parent.currentTime) <= 1.401298e-45)
parent.timingChanges.pop();
Expand Down
1 change: 1 addition & 0 deletions tests/chartTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ describe("SimaiConvert", () => {
const chart = SimaiConvert.deserialize(simaiFile.getValue("inote_3"));

const serialized = SimaiConvert.serialize(chart);
console.log(serialized);
assert.notEqual(serialized, "");
});
});

0 comments on commit 7317683

Please sign in to comment.