Skip to content

Commit

Permalink
Merge pull request #402 from ryohey/fix-export-black-midi
Browse files Browse the repository at this point in the history
Fix export black midi
  • Loading branch information
ryohey authored Sep 10, 2024
2 parents bd23262 + ae41529 commit 45ff781
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions app/src/actions/selection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { min } from "lodash"
import { max, min } from "lodash"
import {
PianoNotesClipboardData,
isPianoNotesClipboardData,
Expand Down Expand Up @@ -330,8 +330,8 @@ export const duplicateSelection =
.filter(isNoteEvent)

if (deltaTick === 0) {
const left = Math.min(...selectedNotes.map((n) => n.tick))
const right = Math.max(...selectedNotes.map((n) => n.tick + n.duration))
const left = min(selectedNotes.map((n) => n.tick)) ?? 0
const right = max(selectedNotes.map((n) => n.tick + n.duration)) ?? 0
deltaTick = right - left
}

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/community/src/track/Track.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { max } from "lodash"
import { AnyEvent } from "midifile-ts"
import { DistributiveOmit } from "../types.js"

Expand All @@ -13,5 +14,5 @@ export interface Track {
}

export function getEndOfTrack(events: TrackEvent[]) {
return Math.max(...events.map((event) => event.tick)) || 0
return max(events.map((event) => event.tick)) ?? 0
}
2 changes: 1 addition & 1 deletion packages/player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@ryohey/wavelet": "^0.7.3"
"@ryohey/wavelet": "^0.7.4"
}
}

0 comments on commit 45ff781

Please sign in to comment.