|
@@ -126,58 +126,62 @@ export class RepetitionInstructionReader {
|
|
|
// must Trim string and ToLower before compare
|
|
|
const innerText: string = wordsNode.value.trim().toLowerCase();
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, dsRegEx + " al fine", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
- measureIndex--;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // @correctness i don't think we should manipulate the measure index by relative position [ssch]
|
|
|
+ // it's clearly assigned a measure in the xml
|
|
|
+ // this has misfired in the past, see test_staverepetitions_coda_etc_positioning.musicxml
|
|
|
+ // there, it put the 'To Coda' in measure 1, same as the 'Signo', which was not correct.
|
|
|
+ // if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
+ // measureIndex--;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.DalSegnoAlFine);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
const dcRegEx: string = "d\\.\\s?c\\.";
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, dcRegEx + " al coda", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition < 0.5) {
|
|
|
- measureIndex--;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition < 0.5) {
|
|
|
+ // measureIndex--;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.DalSegnoAlCoda);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, dcRegEx + " al fine", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
- measureIndex--;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
+ // measureIndex--;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.DaCapoAlFine);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, dcRegEx + " al coda", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition < 0.5) {
|
|
|
- measureIndex--;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition < 0.5) {
|
|
|
+ // measureIndex--;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.DaCapoAlCoda);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, dcRegEx) ||
|
|
|
StringUtil.StringContainsSeparatedWord(innerText, "da\\s?capo", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
- measureIndex--;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
+ // measureIndex--;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.DaCapo);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, dsRegEx, true) ||
|
|
|
StringUtil.StringContainsSeparatedWord(innerText, "dal\\s?segno", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
- measureIndex--;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition < 0.5 && this.currentMeasureIndex < this.xmlMeasureList[0].length - 1) { // not in last measure
|
|
|
+ // measureIndex--;
|
|
|
+ // }
|
|
|
let newInstruction: RepetitionInstruction;
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, "al\\s?coda", true)) {
|
|
|
newInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.DalSegnoAlCoda);
|
|
@@ -189,54 +193,54 @@ export class RepetitionInstructionReader {
|
|
|
}
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, "to\\s?coda", true) ||
|
|
|
StringUtil.StringContainsSeparatedWord(innerText, "a (la )?coda", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition < 0.5) {
|
|
|
- measureIndex--;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition < 0.5) {
|
|
|
+ // measureIndex--;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.ToCoda);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, "fine", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition < 0.5) {
|
|
|
- measureIndex--;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition < 0.5) {
|
|
|
+ // measureIndex--;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.Fine);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, "coda", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition > 0.5) {
|
|
|
- measureIndex++;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition > 0.5) {
|
|
|
+ // measureIndex++;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.Coda);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
if (StringUtil.StringContainsSeparatedWord(innerText, "segno", true)) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition > 0.5) {
|
|
|
- measureIndex++;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition > 0.5) {
|
|
|
+ // measureIndex++;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.Segno);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
}
|
|
|
} else if (directionTypeNode.element("segno")) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition > 0.5) {
|
|
|
- measureIndex++;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition > 0.5) {
|
|
|
+ // measureIndex++;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.Segno);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|
|
|
} else if (directionTypeNode.element("coda")) {
|
|
|
- let measureIndex: number = this.currentMeasureIndex;
|
|
|
- if (relativeMeasurePosition > 0.5) {
|
|
|
- measureIndex++;
|
|
|
- }
|
|
|
+ const measureIndex: number = this.currentMeasureIndex;
|
|
|
+ // if (relativeMeasurePosition > 0.5) {
|
|
|
+ // measureIndex++;
|
|
|
+ // }
|
|
|
const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.Coda);
|
|
|
this.addInstruction(this.repetitionInstructions, newInstruction);
|
|
|
return true;
|