|
@@ -1390,7 +1390,9 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
|
|
|
// usetime = usetime + state.secondEvXmlBeginTime;
|
|
|
// relativeTime = relativeTime + state.secondEvXmlBeginTime;
|
|
|
// }
|
|
|
- if (state.isEvxml && nodeDetail.repeatIdx && nodeDetail.i > 0 && nodeDetail.MeasureNumberXML === 1 && nodeDetail.noteId === 0) {
|
|
|
+ // if (state.isEvxml && nodeDetail.repeatIdx && nodeDetail.i > 0 && nodeDetail.MeasureNumberXML === 1 && nodeDetail.noteId === 0) {
|
|
|
+ const firstRepeatNodeId = allNotes.find((item: any) => item.MeasureNumberXML === state.timegapRepeatMeasureIndex)?.noteId || 0;
|
|
|
+ if (state.isEvxml && nodeDetail.repeatIdx && nodeDetail.i > 0 && nodeDetail.MeasureNumberXML === state.timegapRepeatMeasureIndex && nodeDetail.noteId === firstRepeatNodeId) {
|
|
|
const currentWaitTime = state.evXmlBeginArr[nodeDetail.repeatIdx] || 0;
|
|
|
nodeDetail.time = nodeDetail.time + currentWaitTime;
|
|
|
nodeDetail.endtime = nodeDetail.endtime + currentWaitTime;
|
|
@@ -1653,6 +1655,16 @@ const analyzeEvxml = (xmlParse: any, xmlUrl?: string) => {
|
|
|
const hasTimeGap = state.xmlHasTimeGap = xmlParse.getElementsByTagName("timegap").length > 0;
|
|
|
const hasTimes = xmlParse.getElementsByTagName("times").length > 0;
|
|
|
if (timeGaps && timeGaps.length && !firstNoteBeginTime) {
|
|
|
+ // 有timegap的曲子,需要找到是从哪一小节开始循环的,默认是从第一节开始循环
|
|
|
+ const startRepeat = Array.from(xmlParse.getElementsByTagName("repeat") || []).filter((item: any) => item?.getAttribute('direction') === 'forward')
|
|
|
+ const firstRepeat: any = startRepeat?.length ? startRepeat[0] : null;
|
|
|
+ if (firstRepeat) {
|
|
|
+ let parentElement = firstRepeat?.parentNode
|
|
|
+ while (parentElement && parentElement.tagName !== 'measure') {
|
|
|
+ parentElement = parentElement.parentNode
|
|
|
+ }
|
|
|
+ state.timegapRepeatMeasureIndex = parentElement?.getAttribute('number') ? Number(parentElement?.getAttribute('number')) : 1;
|
|
|
+ }
|
|
|
for (const timeGap of timeGaps) {
|
|
|
const num: any = timeGap?.getAttribute('num'), den: any = timeGap?.getAttribute('den');
|
|
|
const startTime = num ? 60 / state.originSpeed * num * 4/den : 0;
|