Browse Source

feat: midi评测速度

TIANYONG 1 week ago
parent
commit
c8d6e454f9
3 changed files with 12 additions and 5 deletions
  1. 3 1
      src/helpers/midiPlay.tsx
  2. 7 2
      src/state.ts
  3. 2 2
      src/view/selection/index.tsx

+ 3 - 1
src/helpers/midiPlay.tsx

@@ -97,11 +97,13 @@ export const cloudToggleState = async (type: "play" | "paused") => {
     if (state.isSelectMeasureMode) {
       audioData.progress = state.midiSectionStart
     }
+    console.log('midi速度',state.originSpeed,state.speed)
     await api_cloudPlay({
       songID: state.examSongId,
       startTime: audioData.progress * 1000,
       originalSpeed: state.originSpeed, // midi初始速度
-      speed: state.modeType === "evaluating" ? state.originSpeed : state.speed,
+      // speed: state.modeType === "evaluating" ? state.originSpeed : state.speed,
+      speed: state.speed,
       hertz: 440, //SettingState.sett.hertz,
     })
     // startCapture()

+ 7 - 2
src/state.ts

@@ -584,12 +584,17 @@ const handlePlaying = () => {
 
 };
 /** 跳转到指定音符开始播放 */
-export const skipNotePlay = async (itemIndex: number, isStart = false) => {
+export const skipNotePlay = async (itemIndex: number, isStart = false, handType?: string) => {
   if (state.isPreView) return;
-  console.log('点击音符')
   // 点击或者重播的时候清除一行谱的时间信息
   state.isSingleLine && (smoothAnimationState.oldCurrentTime = 0)
+  if (handType === 'manual' && (query.workRecord)) return;
   const item = state.times[itemIndex];
+  // 如果是选段状态,可以点击段落范围内的音符,从当前音符开始播放,如果不是段落内的音符,直接return
+  if (handType === 'manual' && state.section.length === 2 && !(item.MeasureNumberXML >= state.section[0].MeasureNumberXML && item.MeasureNumberXML <= state.section[1].MeasureNumberXML)) {
+    return;
+  }  
+  console.log('点击音符')
   let itemTime = item.time;
   if (isStart) {
     itemTime = 0;

+ 2 - 2
src/view/selection/index.tsx

@@ -220,7 +220,7 @@ export default defineComponent({
 		};
 		/** 是否可以点击音符 */
 		const disableClickNote = computed(() => {
-			return state.sectionStatus || (state.modeType === "evaluating");
+			return (state.sectionStatus && state.section.length != 2) || (state.modeType === "evaluating");
 		});
 		// 选段符号
 		const sectionPosData = computed(() => {
@@ -364,7 +364,7 @@ export default defineComponent({
 							<div
 								class={[styles.position, disableClickNote.value && styles.disable, styles.note, `noteIndex_${item.index}`]}
 								style={item.bbox}
-								onClick={() => skipNotePlay(item.index)}
+								onClick={() => skipNotePlay(item.index, false, 'manual')}
 							>
 								{/* <div class={styles.noteFollow} data-vf={"vf" + item.id}>
 									<Icon name="success" />