Ver Fonte

Merge branch 'feature-tianyong-newVersion' into ktyq-online-new

TIANYONG há 6 meses atrás
pai
commit
0fa72610fe
3 ficheiros alterados com 24 adições e 10 exclusões
  1. 3 2
      src/helpers/formateMusic.ts
  2. 1 2
      src/helpers/metronome.ts
  3. 20 6
      src/state.ts

+ 3 - 2
src/helpers/formateMusic.ts

@@ -1164,7 +1164,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			// 当前音符的持续时长,当前音符的RealValue值*拍数*(60/后台设置的基准速度)
 			let noteLength = gradualLength ? gradualLength : Math.min(vRealValue, NoteRealValue) * formatBeatUnit(beatUnit) * (60 / beatSpeed);
 			// 小节时长
-			const measureLength = vRealValue * vDenominator * (60 / beatSpeed);
+			const measureLength = vRealValue * 4 * (60 / beatSpeed);
 			// console.table({value: iterator.currentTimeStamp.realValue, vRealValue,NoteRealValue, noteLength,measureLength, MeasureNumberXML: note.sourceMeasure.MeasureNumberXML})
 			// console.log(i, Math.min(vRealValue, NoteRealValue),noteLength,gradualLength, formatBeatUnit(beatUnit),beatSpeed, NoteRealValue * formatBeatUnit(beatUnit) * (60 / beatSpeed) )
 			/**
@@ -1264,7 +1264,8 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 				const allowRange = Math.abs(_notes[idx+1]?.note?.noteTimeInfo?.[0]?.begin - _notes[idx-1]?.note?.noteTimeInfo?.[0]?.end) < 10;
 				if (allowRange) {
 					note.maxNoteNum = note.maxNoteNum - 1;
-					// 唱名时间补齐
+					// 唱名时间补齐,唱名上一个音符的结束时候,也需要补上这个时间
+					allNotes[allNotes.length-1].xmlNoteEndTime = retain(xmlNoteTime + noteLength)
 					xmlNoteTime += noteLength
 					continue;
 				}

+ 1 - 2
src/helpers/metronome.ts

@@ -287,9 +287,8 @@ class Metronome {
 			if (measureNumberXML > -1) {
 				if (measureNumberXML != xmlNumber) {
 					// 弱起的时候 根据音符结尾时间减去音符开头时间,得到的不是正常小节的时间,然后平均分配节拍之后,当前节拍间隔会非常短 这里弱起拿正常
-					// 妙极客的弱起不受这个影响
 					let startTime = note.measures[0].time
-					if(!state.isEvxml && i === 0){
+					if(i === 0){
 						startTime = note.measures[note.measures.length - 1].endtime - note.measures[0].measureLength
 					}
 					const m = {

+ 20 - 6
src/state.ts

@@ -1391,23 +1391,37 @@ function initMusicSource(data: any, tracks: string[], partIndex: number) {
   let musicObj, accompanyObj, fanSongObj, banSongObj
    /* 独奏 */
   if (musicSheetType === "SINGLE") {
+    accompanyObj = musicSheetAccompanimentList.find((item: any) => {
+      return item.audioPlayType === "PLAY"
+    })
     // 适用声部(isAllSubject)为true 时候没有乐器只有一个原音;当前用户有乐器就匹配  不然取第一个原音
     musicObj = musicSheetSoundList.find((item: any) => {
       return (isAllSubject || !instrumentId) ? item.audioPlayType === "PLAY" : (item.audioPlayType === "PLAY" && item.musicalInstrumentId == instrumentId)
     })
     // 因为可能根据学生的乐器id也找不到曲目所以尝试取第一个
-    musicObj || (musicObj = musicSheetSoundList.find((item: any) => {
-      return item.audioPlayType === "PLAY"
-    }))
+    if(!musicObj){
+      musicObj = musicSheetSoundList.find((item: any) => {
+        return item.audioPlayType === "PLAY"
+      })
+      // 取第一个时候,不播放演奏文件切换为演唱模式  总控平台排除这个逻辑
+      if(!query.isCbs){
+        state.playType = "sing"
+        if(musicObj) {
+          musicObj.audioFileUrl = null
+          musicObj.audioBeatMixUrl = null
+        }
+        if(accompanyObj) {
+          accompanyObj.audioFileUrl = null
+          accompanyObj.audioBeatMixUrl = null
+        }
+      }
+    }
     fanSongObj = musicSheetSoundList.find((item: any) => {
       return item.audioPlayType === "SING"
     })
     banSongObj = musicSheetAccompanimentList.find((item: any) => {
       return item.audioPlayType === "SING"
     })
-    accompanyObj = musicSheetAccompanimentList.find((item: any) => {
-      return item.audioPlayType === "PLAY"
-    })
     track = musicObj?.track   //没有原音的时候track为空 不显示指法
     index = tracks.findIndex(item => {
       return item === track