Browse Source

选段评测,预备小节时长获取不对问题修复

TIANYONG 2 months ago
parent
commit
e27ebd1995
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/page-instrument/evaluat-model/index.tsx

+ 3 - 4
src/page-instrument/evaluat-model/index.tsx

@@ -187,13 +187,12 @@ export default defineComponent({
         const startIndex = state.times.findIndex((n: any) => n.noteId == state.section[0].noteId);
         let endIndex = state.times.findIndex((n: any) => n.noteId == state.section[1].noteId);
         endIndex = endIndex < state.section[1].i ? state.section[1].i : endIndex;
-        if (startIndex > 1) {
+        if (startIndex >= 1) {
           // firstNoteTime应该取预备小节的第一个音符的开始播放的时间
           const idx = startIndex - 1 - state.times[startIndex - 1].si;
           preTime = state.times[idx] ? state.times[idx].time * 1000 : 0;
         }
-        // mp3节拍器时长
-        actualBeatLength = state.isOpenMetronome ? actualBeatLength : 0;
+        actualBeatLength = startIndex == 0 && state.isOpenMetronome ? actualBeatLength : 0;
         selectTimes = state.times.filter((n: any, index: number) => {
           return index >= startIndex && index <= endIndex;
         });
@@ -210,7 +209,7 @@ export default defineComponent({
         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 firstNoteTime = unitTestIdx >= 1 ? preTime : 0;
       let measureIndex = -1;
       let recordMeasure = -1;