From 0f7c84e646806d501e256452addb980067911d1f Mon Sep 17 00:00:00 2001 From: Einar Pehrson Date: Tue, 13 May 2003 18:22:43 +0000 Subject: [PATCH] no message --- MooNoteElement.java | 2 +- MooTrackView.java | 5 +++-- MooView.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/MooNoteElement.java b/MooNoteElement.java index 65afa7b..46b8047 100644 --- a/MooNoteElement.java +++ b/MooNoteElement.java @@ -23,7 +23,7 @@ public class MooNoteElement extends JPanel { */ public MooNoteElement (MooNote mn) { note = mn; - columns = mn.getDuration() / 24; + columns = mn.getDuration() / (Moosique.getSequence().getResolution() / 4); setBorder(BorderFactory.createLineBorder(Color.black)); setBackground(bgColor); } diff --git a/MooTrackView.java b/MooTrackView.java index c44bc24..a0da5dc 100644 --- a/MooTrackView.java +++ b/MooTrackView.java @@ -81,6 +81,7 @@ public class MooTrackView extends JPanel implements ActionListener { MidiEvent note; MooNoteElement elem; int x, y, height; + int beatsPerSixteenth = Moosique.getSequence().getResolution() / 4; rects = new ArrayList(track.size() / 2); // Placing note elements @@ -95,8 +96,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 = (mn.getDuration() / 24) * NOTE_HEIGHT; + y = insets.top + (int)(mn.getTick() / beatsPerSixteenth) * NOTE_HEIGHT; + height = (mn.getDuration() / beatsPerSixteenth) * 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); diff --git a/MooView.java b/MooView.java index 146738d..50819ef 100644 --- a/MooView.java +++ b/MooView.java @@ -84,7 +84,7 @@ public class MooView extends JScrollPane { * Calls on each track view to update itself. */ public void update(long tickPosition) { - getViewport().setViewPosition(new Point((int)getViewport().getViewPosition().getX(), (int)(tickPosition / 24) * MooTrackView.NOTE_HEIGHT)); + getViewport().setViewPosition(new Point((int)getViewport().getViewPosition().getX(), (int)(tickPosition / (Moosique.getSequence().getResolution() / 4)) * MooTrackView.NOTE_HEIGHT)); Component[] comps = getComponents(); for (int i = 0; i < comps.length; i++) { if(comps[i] instanceof MooTrackView) ((MooTrackView)comps[i]).update(tickPosition); -- 2.39.2