From 499365ecb64b500aeba8d4df334250e296aa6e0a Mon Sep 17 00:00:00 2001 From: Einar Pehrson Date: Tue, 13 May 2003 00:27:34 +0000 Subject: [PATCH] Fixed the note element length. --- MooNote.java | 2 +- MooTrackView.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MooNote.java b/MooNote.java index 3e66dab..2774c30 100644 --- a/MooNote.java +++ b/MooNote.java @@ -134,7 +134,7 @@ public class MooNote extends MidiEvent { */ public int getDuration() { if (!hasNoteOffEvent()) return 0; - return (int)(getTick() - noteOffEvent.getTick()); + return (int)(noteOffEvent.getTick() - getTick()); } /** diff --git a/MooTrackView.java b/MooTrackView.java index 5efb002..dbbcc92 100644 --- a/MooTrackView.java +++ b/MooTrackView.java @@ -93,8 +93,8 @@ public class MooTrackView extends JPanel implements ActionListener { // Moves the note element to the appropriate place. x = insets.left; y = insets.top + (int)(mn.getTick() / 24) * NOTE_HEIGHT; - height = NOTE_HEIGHT; - // height = (mn.getDuration() / 24) * NOTE_HEIGHT; + height = (mn.getDuration() / 24) * NOTE_HEIGHT; + if (height == 0) height = NOTE_HEIGHT; Rectangle r = new Rectangle(x, y, NOTE_WIDTH, height); while(isOccupied(r)) r.translate(NOTE_WIDTH, 0); elem.setBounds(r); -- 2.39.2