Browse Source

feat: 评测选段BeatLength修改

TIANYONG 3 weeks ago
parent
commit
72f1854e79
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/page-instrument/evaluat-model/index.tsx

+ 7 - 2
src/page-instrument/evaluat-model/index.tsx

@@ -193,7 +193,7 @@ export default defineComponent({
           const idx = startIndex - 1 - state.times[startIndex - 1].si;
           preTime = state.times[idx] ? state.times[idx].time * 1000 : 0;
         }
-        actualBeatLength = startIndex == 0 && state.isOpenMetronome ? actualBeatLength : 0;
+        actualBeatLength = startIndex == 0 && state.isOpenMetronome ? actualBeatLength : 0; 
         selectTimes = state.times.filter((n: any, index: number) => {
           return index >= startIndex && index <= endIndex;
         });
@@ -207,13 +207,18 @@ export default defineComponent({
       actualBeatLength = preTimes.length ? actualBeatLength + preTimes[preTimes.length - 1].relaMeasureLength * 1000 : actualBeatLength;
       // 如果是弱起,并且预备小节是第一节
       if (state.section.length && state.sectionFirst && state.sectionFirst.measureListIndex == 0) {
-        actualBeatLength = actualBeatLength < Math.round((state.times[0].fixtime * 1000) / 1) ? Math.round((state.times[0].fixtime * 1000) / 1) : actualBeatLength;
+        // actualBeatLength = actualBeatLength < Math.round((state.times[0].fixtime * 1000) / 1) ? Math.round((state.times[0].fixtime * 1000) / 1) : actualBeatLength;
       }
       
       let firstNoteTime = unitTestIdx > 1 ? preTime : 0;
       let measureIndex = -1;
       let recordMeasure = -1;
 
+      // 如果有mp3节拍器,并且预备小节是第一节,并且从0开始播放,actualBeatLength需要加上mp3节拍器时间
+      if (state.section.length === 2 && firstNoteTime === 0 && state.section[0]?.MeasureNumberXML === state.firstMeasureNumber + 1 && state.times[0].fixtime) {
+        actualBeatLength  = actualBeatLength + Math.round((state.times[0].fixtime * 1000) / 1)
+      }
+
       for (let index = 0; index < selectTimes.length; index++) {
         const item = selectTimes[index];
         const note = getNoteByMeasuresSlursStart(item);