2
* Created on 25-nov-2005
4
* TODO To change the template for this generated file go to
5
* Window - Preferences - Java - Code Style - Code Templates
7
package org.herac.tuxguitar.gui.editors.tab;
9
import java.util.ArrayList;
10
import java.util.List;
12
import org.herac.tuxguitar.song.models.Duration;
13
import org.herac.tuxguitar.song.models.Measure;
14
import org.herac.tuxguitar.song.models.TimeSignature;
18
* TODO To change the template for this generated type comment go to
19
* Window - Preferences - Java - Code Style - Code Templates
21
public class TablatureUtil {
24
* Calcula la posicion inicial de una nota, dependiendo de el span
26
public static final int getStartPosition(Measure measure,long start,int span){
27
double newStart = (double)start - (double)measure.getStart();
28
double displayPosition = 0.0;
30
double position = ((double)newStart / (double)Duration.QUARTER_TIME);
31
displayPosition = (position * span);
33
return (int)displayPosition;
38
public static List createDurations(long time){
39
List durations = new ArrayList();
40
Duration tempDuration = new Duration(Duration.WHOLE);
41
tempDuration.setDotted(true);
44
boolean finish = false;
46
long currentDurationTime = tempDuration.getTime();
47
if(currentDurationTime <= tempTime){
48
durations.add((Duration)tempDuration.clone());
49
tempTime -= currentDurationTime;
51
if(tempDuration.isDotted()){
52
tempDuration.setDotted(false);
54
tempDuration.setValue(tempDuration.getValue() * 2);
55
tempDuration.setDotted(true);
58
if(tempDuration.getValue() > Duration.SIXTY_FOURTH){
65
public static long getBeatLength(TimeSignature timeSignature){
66
long defaultLenght = Duration.QUARTER_TIME;
68
int denominator = timeSignature.getDenominator().getValue();
71
if(timeSignature.getNumerator() % 3 == 0){
72
defaultLenght += Duration.QUARTER_TIME / 2;