|  | @@ -887,7 +887,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 | 
	
		
			
				|  |  |  	const currentTimes = [] as any[];
 | 
	
		
			
				|  |  |  	let isSetNextNoteReal = false;
 | 
	
		
			
				|  |  |  	let differFrom = 0;
 | 
	
		
			
				|  |  | -	// let testIdx = 0;
 | 
	
		
			
				|  |  | +	let testIdx = 0;
 | 
	
		
			
				|  |  |  	let repeatIdx = 0; // 循环的次数
 | 
	
		
			
				|  |  |  	const firstTrackName = state.canSelectTracks[0] || "";
 | 
	
		
			
				|  |  |  	while (!iterator.EndReached) {
 | 
	
	
		
			
				|  | @@ -999,7 +999,9 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 | 
	
		
			
				|  |  |  				measuresTempoInBPM: note?.sourceMeasure?.tempoInBPM
 | 
	
		
			
				|  |  |  			});
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +		if (testIdx == 313) {
 | 
	
		
			
				|  |  | +			// debugger
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  		iterator.moveToNextVisibleVoiceEntry(false);
 | 
	
		
			
				|  |  |  		// 从头开始循环,repeatIdx标记+1
 | 
	
		
			
				|  |  |  		if (iterator.backJumpOccurred) {
 | 
	
	
		
			
				|  | @@ -1007,7 +1009,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		iterator.repeatIdx = repeatIdx;
 | 
	
		
			
				|  |  |  		// console.log('小节',testIdx,iterator.repeatIdx,iterator.EndReached,iterator.currentMeasureIndex,iterator.backJumpOccurred,iterator.forwardJumpOccurred)
 | 
	
		
			
				|  |  | -		// testIdx += 1;
 | 
	
		
			
				|  |  | +		testIdx += 1;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	// 是否是变速的曲子
 | 
	
		
			
				|  |  |  	const hasVaryingSpeed = _notes.some((item: any) => item.measuresTempoInBPM !== _notes[0].measuresTempoInBPM)
 | 
	
	
		
			
				|  | @@ -1626,9 +1628,10 @@ const customizationXml = (xmlParse: any) => {
 | 
	
		
			
				|  |  |  	const graces: any = Array.from(xmlParse.querySelectorAll('grace'));
 | 
	
		
			
				|  |  |  	const measures: any[] = Array.from(xmlParse.getElementsByTagName("measure"));
 | 
	
		
			
				|  |  |  	const notes: any[] = Array.from(xmlParse.getElementsByTagName("note"));
 | 
	
		
			
				|  |  | +	const timegaps: any[] = Array.from(xmlParse.getElementsByTagName("timegap"));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	// 获取音符最多的歌词数,time最多的次数,取两者的最大值,用于自定义循环播放次数
 | 
	
		
			
				|  |  | -	let maxLyricNum = 0, maxTimeNum = 0;
 | 
	
		
			
				|  |  | +	let maxLyricNum = 0, maxTimeNum = 0, maxTimegap = 0;
 | 
	
		
			
				|  |  |  	if (notes && notes.length) {
 | 
	
		
			
				|  |  |  		for (const note of notes) {
 | 
	
		
			
				|  |  |  			if (maxLyricNum < note.getElementsByTagName("lyric").length) {
 | 
	
	
		
			
				|  | @@ -1639,10 +1642,18 @@ const customizationXml = (xmlParse: any) => {
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	state.maxLyricNum = Math.max(maxLyricNum, maxTimeNum);
 | 
	
		
			
				|  |  | +	// 获取最多的timegap次数
 | 
	
		
			
				|  |  | +	if (timegaps && timegaps.length) {
 | 
	
		
			
				|  |  | +		for (const timegap of timegaps) {
 | 
	
		
			
				|  |  | +			if (maxTimegap < timegap.getElementsByTagName("item").length) {
 | 
	
		
			
				|  |  | +				maxTimegap = timegap.getElementsByTagName("item").length
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +	state.maxLyricNum = Math.max(maxLyricNum, maxTimeNum, maxTimegap);
 | 
	
		
			
				|  |  |  	// state.osmd.EngravingRules.DYCustomRepeatCount = maxLyricNum;
 | 
	
		
			
				|  |  |  	;(window as any).DYCustomRepeatCount = state.maxLyricNum;
 | 
	
		
			
				|  |  | -	console.log('歌词次数',maxLyricNum)
 | 
	
		
			
				|  |  | +	console.log('歌词次数',maxLyricNum,'循环次数',state.maxLyricNum)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	if (credits && credits.length) {
 | 
	
		
			
				|  |  |  		for (const credit of credits) {
 |