Skip to content

Commit

Permalink
Merge pull request #350 from ryohey/fix-tempo
Browse files Browse the repository at this point in the history
Fix tempo
  • Loading branch information
ryohey committed May 15, 2024
2 parents dfdd762 + d5d5313 commit 6d56ebb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/common/measure/mbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const getMBT = (
}

const pad = (v: number, digit: number) => {
const str = v.toString(10)
const str = v.toFixed(0)
return ("0".repeat(digit) + str).slice(-Math.max(digit, str.length))
}

Expand Down
1 change: 1 addition & 0 deletions src/common/player/EventScheduler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe("EventScheduler", () => {
{
const result = s.readNextEvents(120, 0)
expect(result.length).toBe(1)
expect(result[0].timestamp).toBe(0)
expect(result[0].event).toBe(events[0])
}

Expand Down
6 changes: 2 additions & 4 deletions src/common/player/EventScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,11 @@ export default class EventScheduler<E extends SchedulableEvent> {
}
const delta = timestamp - this._prevTime
const deltaTick = Math.max(0, this.millisecToTick(delta, bpm))
const nowTick = Math.floor(this._currentTick + deltaTick)
const nowTick = this._currentTick + deltaTick

// 先読み時間
// Leading time
const lookAheadTick = Math.floor(
this.millisecToTick(this.lookAheadTime, bpm),
)
const lookAheadTick = this.millisecToTick(this.lookAheadTime, bpm)

// 前回スケジュール済みの時点から、
// From the previous scheduled point,
Expand Down
2 changes: 1 addition & 1 deletion src/main/components/PianoRoll/CanvasPianoRuler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function drawRuler(
ctx.textBaseline = "top"
ctx.font = `12px ${theme.canvasFont}`
ctx.fillStyle = theme.secondaryTextColor
ctx.fillText(`${measure}`, x + textPadding, textPadding)
ctx.fillText(`${measure + 1}`, x + textPadding, textPadding)
}
})

Expand Down

0 comments on commit 6d56ebb

Please sign in to comment.