]> ruin.nu Git - moosique.git/blobdiff - MooTrackView.java
no message
[moosique.git] / MooTrackView.java
index c44bc24eeb0c5974b428f8eb82cefefd19f6681c..a0da5dc7339c6f45c90e7063dd0c199333e02879 100644 (file)
@@ -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);