|
@@ -8,6 +8,7 @@ import { SourceMeasure } from "../VoiceData/SourceMeasure";
|
|
|
import { SourceStaffEntry } from "../VoiceData/SourceStaffEntry";
|
|
|
import { Beam } from "../VoiceData/Beam";
|
|
|
import { Tie } from "../VoiceData/Tie";
|
|
|
+import { TieTypes } from "../../Common/Enums/";
|
|
|
import { Tuplet } from "../VoiceData/Tuplet";
|
|
|
import { Fraction } from "../../Common/DataObjects/Fraction";
|
|
|
import { IXmlElement } from "../../Common/FileIO/Xml";
|
|
@@ -190,9 +191,23 @@ export class VoiceGenerator {
|
|
|
// check for Ties - must be the last check
|
|
|
const tiedNodeList: IXmlElement[] = notationNode.elements("tied");
|
|
|
if (tiedNodeList.length > 0) {
|
|
|
- this.addTie(tiedNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction);
|
|
|
+ this.addTie(tiedNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction, TieTypes.SIMPLE);
|
|
|
+ }
|
|
|
+ //check for slides, they are the same as Ties but with a different connection
|
|
|
+ const slideNodeList: IXmlElement[] = notationNode.elements("slide");
|
|
|
+ if (slideNodeList.length > 0) {
|
|
|
+ this.addTie(slideNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction, TieTypes.SLIDE);
|
|
|
+ }
|
|
|
+ //check for slides, they are the same as Ties but with a different connection
|
|
|
+ const technicalNode: IXmlElement = notationNode.element("technical");
|
|
|
+ const hammerNodeList: IXmlElement[] = technicalNode.elements("hammer-on");
|
|
|
+ if (hammerNodeList.length > 0) {
|
|
|
+ this.addTie(hammerNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction, TieTypes.HAMMERON);
|
|
|
+ }
|
|
|
+ const pulloffNodeList: IXmlElement[] = technicalNode.elements("pull-off");
|
|
|
+ if (pulloffNodeList.length > 0) {
|
|
|
+ this.addTie(pulloffNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction, TieTypes.PULLOFF);
|
|
|
}
|
|
|
-
|
|
|
// remove open ties, if there is already a gap between the last tie note and now.
|
|
|
const openTieDict: { [_: number]: Tie; } = this.openTieDict;
|
|
|
for (const key in openTieDict) {
|
|
@@ -757,7 +772,7 @@ export class VoiceGenerator {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private addTie(tieNodeList: IXmlElement[], measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction): void {
|
|
|
+ private addTie(tieNodeList: IXmlElement[], measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction, tieType: TieTypes): void {
|
|
|
if (tieNodeList) {
|
|
|
if (tieNodeList.length === 1) {
|
|
|
const tieNode: IXmlElement = tieNodeList[0];
|
|
@@ -770,7 +785,7 @@ export class VoiceGenerator {
|
|
|
delete this.openTieDict[num];
|
|
|
}
|
|
|
const newTieNumber: number = this.getNextAvailableNumberForTie();
|
|
|
- const tie: Tie = new Tie(this.currentNote);
|
|
|
+ const tie: Tie = new Tie(this.currentNote, tieType);
|
|
|
this.openTieDict[newTieNumber] = tie;
|
|
|
} else if (type === "stop") {
|
|
|
const tieNumber: number = this.findCurrentNoteInTieDict(this.currentNote);
|
|
@@ -830,8 +845,14 @@ export class VoiceGenerator {
|
|
|
for (const key in openTieDict) {
|
|
|
if (openTieDict.hasOwnProperty(key)) {
|
|
|
const tie: Tie = openTieDict[key];
|
|
|
+ const tieTabNote: TabNote = tie.Notes[0] as TabNote;
|
|
|
+ const tieCandidateNote: TabNote = candidateNote as TabNote;
|
|
|
if (tie.Pitch.FundamentalNote === candidateNote.Pitch.FundamentalNote && tie.Pitch.Octave === candidateNote.Pitch.Octave) {
|
|
|
return +key;
|
|
|
+ } else {
|
|
|
+ if (tieTabNote.StringNumber === tieCandidateNote.StringNumber) {
|
|
|
+ return +key;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|