Skip to content

Commit

Permalink
Merge pull request #391 from ryohey/fix-first-time-signature
Browse files Browse the repository at this point in the history
Fix issue where time signature could not be added
  • Loading branch information
ryohey authored Aug 17, 2024
2 parents ea8fcf4 + 10078ad commit 50f81c7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/src/actions/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,22 @@ export const toogleAllGhostTracks =
export const addTimeSignature =
({ song, pushHistory }: RootStore) =>
(tick: number, numerator: number, denominator: number) => {
const measureStart = Measure.getMeasureStart(
const measureStartTick = Measure.getMeasureStart(
song.measures,
tick,
song.timebase,
)
).tick

// prevent duplication
if (measureStart.eventTick === measureStart.tick) {
if (song.timeSignatures?.some((e) => e.tick === measureStartTick)) {
return
}

pushHistory()

song.conductorTrack?.addEvent({
...timeSignatureMidiEvent(0, numerator, denominator),
tick: measureStart.tick,
tick: measureStartTick,
})
}

Expand Down

0 comments on commit 50f81c7

Please sign in to comment.