Explorar o código

feat: 速度修改

TIANYONG hai 11 meses
pai
achega
eb6873919d
Modificáronse 2 ficheiros con 6 adicións e 4 borrados
  1. 2 1
      src/page-instrument/header-top/speed/index.tsx
  2. 4 3
      src/state.ts

+ 2 - 1
src/page-instrument/header-top/speed/index.tsx

@@ -21,7 +21,8 @@ export default defineComponent({
 		watch(
 			() => speed.value,
 			() => {
-				handleSetSpeed(speed.value);
+				// handleSetSpeed(speed.value);
+				state.speed = speed.value;
 			}
 		);
 		watch(

+ 4 - 3
src/state.ts

@@ -588,8 +588,8 @@ export const onEnded = () => {
 const dynamicShowPlaySpeed = (index: number) => {
   const item: any = state.times[index];
   if (item && item.measureSpeed ) {
-    state.playIngSpeed = Math.floor(state.basePlayRate * item.measureSpeed)
-    state.speed = state.playIngSpeed
+    // console.log('速度1',item.measureSpeed)
+    state.speed = Math.floor(state.basePlayRate * item.measureSpeed)
   }
 }
 
@@ -608,6 +608,7 @@ export const initSetPlayRate = () => {
 export const resetBaseRate = () => {
   const currentItem: any = state.times[0];
   const currentSpeed = currentItem?.measureSpeed ? currentItem.measureSpeed : state.originSpeed;
+  // console.log('速度2',currentSpeed)
   state.speed = currentSpeed
   //state.activeNoteIndex = 0
   state.basePlayRate = 1;
@@ -622,7 +623,6 @@ const handlePlaying = () => {
   state.playProgress = (currentTime / duration) * 100;
   let item = getNote(currentTime);
   if (item) {
-    dynamicShowPlaySpeed(item.i);
     // 选段状态下
     if (state.sectionStatus && state.section.length === 2) {
       // 如果开启了预备拍
@@ -675,6 +675,7 @@ const handlePlaying = () => {
       }
     }
     gotoNext(item);
+    dynamicShowPlaySpeed(item.i);
   }
 
   // 评测不播放叮咚节拍器