*/
public MooNoteElement (MooNote mn) {
note = mn;
- columns = mn.getDuration() / 24;
+ columns = mn.getDuration() / (Moosique.getSequence().getResolution() / 4);
setBorder(BorderFactory.createLineBorder(Color.black));
setBackground(bgColor);
}
MidiEvent note;
MooNoteElement elem;
int x, y, height;
+ int beatsPerSixteenth = Moosique.getSequence().getResolution() / 4;
rects = new ArrayList(track.size() / 2);
// Placing note elements
// 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);
* 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);