(note: Note)
| 1159 | } |
| 1160 | |
| 1161 | public static findTieOrigin(note: Note): Note | null { |
| 1162 | let previousBeat: Beat | null = note.beat.previousBeat; |
| 1163 | // keep searching in same bar |
| 1164 | while ( |
| 1165 | previousBeat && |
| 1166 | previousBeat.voice.bar.index >= note.beat.voice.bar.index - Note._maxOffsetForSameLineSearch |
| 1167 | ) { |
| 1168 | if (note.isStringed) { |
| 1169 | const noteOnString: Note | null = previousBeat.getNoteOnString(note.string); |
| 1170 | if (noteOnString) { |
| 1171 | return noteOnString; |
| 1172 | } |
| 1173 | } else { |
| 1174 | if (note.octave === -1 && note.tone === -1) { |
| 1175 | // if the note has no value (e.g. alphaTex dash tie), we try to find a matching |
| 1176 | // note on the previous beat by index. |
| 1177 | if (note.index < previousBeat.notes.length) { |
| 1178 | return previousBeat.notes[note.index]; |
| 1179 | } |
| 1180 | } else { |
| 1181 | const noteWithValue: Note | null = previousBeat.getNoteWithRealValue(note.realValue); |
| 1182 | if (noteWithValue) { |
| 1183 | return noteWithValue; |
| 1184 | } |
| 1185 | } |
| 1186 | } |
| 1187 | previousBeat = previousBeat.previousBeat; |
| 1188 | } |
| 1189 | return null; |
| 1190 | } |
| 1191 | |
| 1192 | private static _noteIdLookupKey = 'NoteIdLookup'; |
| 1193 |
no test coverage detected