public void calcBars() {
double maxTZ = score.highestBeattime;
double lastBar = 0;
double nextBar = 0;
int barNumber = 1;
ASTBar nullBar = new ASTBar(ParserTreeConstants.JJTBAR);
nullBar.barNumber = 0;
nullBar.setBeattime(0);
nullBar.generated = true;
score.getAllBar().add(nullBar);
while (lastBar < maxTZ) {
ASTTime test = new ASTTime(ParserTreeConstants.JJTTIME);
test.setBeattime(lastBar);
double taktlen = round(timeFor(lastBar).getTimeLen());
Double partialLen = score.getAllPartial().get(lastBar);
if (partialLen != null && partialLen < taktlen) {
taktlen = partialLen;
}
if (taktlen == 0)//ein spaßvogel gibt 0/4 ein:-)
{
return;
}
double nextTimeChange = nextTimeChange(lastBar);// nextTaktChange(lastTaktstrich, score);
double nextPart = nextPartial(lastBar); //nextPartial(lastTaktstrich, score);
nextBar = lastBar + taktlen;
if (nextTimeChange != -100 && nextTimeChange < nextBar) {
nextBar = nextTimeChange;
}
if (nextPart != -100 && nextPart < nextBar) {
nextBar = score.getAllPartial().get(nextPart);
nextBar = nextBar + nextPart;
} else {
barNumber++;
}
if (nextBar > maxTZ) {
return;
}
ASTBar newBar = new ASTBar(ParserTreeConstants.JJTBAR);
newBar.barNumber = barNumber;
newBar.setBeattime(nextBar);
newBar.generated = true;
lastBar = nextBar;
// newBar.lastTime = lastTime;
score.getAllBar().add(newBar);
BarLayout.testLayout(null, newBar);