瀏覽代碼

fix: 评测speedRate修改

TIANYONG 11 月之前
父節點
當前提交
c8ebe58cf0
共有 3 個文件被更改,包括 6 次插入6 次删除
  1. 1 1
      src/helpers/customMusicScore.ts
  2. 3 2
      src/view/audio-list/index.tsx
  3. 2 3
      src/view/evaluating/index.tsx

+ 1 - 1
src/helpers/customMusicScore.ts

@@ -626,7 +626,7 @@ const transSinglePage = () => {
 	if (state.isSingleLine && !state.isSimplePage) {
 	if (state.isSingleLine && !state.isSimplePage) {
 		const svgPage = document?.getElementById('osmdSvgPage1')?.getBoundingClientRect();
 		const svgPage = document?.getElementById('osmdSvgPage1')?.getBoundingClientRect();
 		const staffLine = document?.querySelector('.staffline')?.getBoundingClientRect();
 		const staffLine = document?.querySelector('.staffline')?.getBoundingClientRect();
-		if (svgPage && staffLine && svgPage.height > 200 && state.platform !== 'PC') {
+		if (svgPage && staffLine && svgPage.height > 200) {
 			// 需要上移的距离
 			// 需要上移的距离
 			// console.log('need',svgPage.height,staffLine.height)
 			// console.log('need',svgPage.height,staffLine.height)
 			const rate = svgPage.height > 400 ? 1.2 : 2;
 			const rate = svgPage.height > 400 ? 1.2 : 2;

+ 3 - 2
src/view/audio-list/index.tsx

@@ -86,8 +86,8 @@ export const setAudioPlaybackRate = (rate: number) => {
 
 
 /** 获取当前播放的时间 */
 /** 获取当前播放的时间 */
 export const getAudioCurrentTime = () => {
 export const getAudioCurrentTime = () => {
-	// 如果是midi播放
-	if (state.isAppPlay) {
+	// 如果是midi播放,或者是评测
+	if (state.isAppPlay || state.modeType === 'evaluating') {
 		// const c = getMidiCurrentTime();
 		// const c = getMidiCurrentTime();
 		return audioData.progress;
 		return audioData.progress;
 	}
 	}
@@ -277,6 +277,7 @@ export default defineComponent({
 				res?.content?.totalDuration > 1000 &&
 				res?.content?.totalDuration > 1000 &&
 				currentTime >= total
 				currentTime >= total
 			) {
 			) {
+				console.log('播放结束1111',evaluatingData.isAudioPlayEnd,currentTime,total)
 				if (evaluatingData.isAudioPlayEnd) return
 				if (evaluatingData.isAudioPlayEnd) return
 				evaluatingData.isAudioPlayEnd = true
 				evaluatingData.isAudioPlayEnd = true
 				onEnded();
 				onEnded();

+ 2 - 3
src/view/evaluating/index.tsx

@@ -421,13 +421,12 @@ export const handleStartBegin = async (preTimes?: number) => {
 	// 	accompanimentState: state.setting.enableAccompaniment ? 1 : 0,
 	// 	accompanimentState: state.setting.enableAccompaniment ? 1 : 0,
 	// 	firstNoteTime: preTimes || 0,
 	// 	firstNoteTime: preTimes || 0,
 	// });
 	// });
-	let rate = state.speed / state.originSpeed;
-	rate = parseFloat(rate.toFixed(2));
+  const rate = state.basePlayRate * state.originAudioPlayRate; // 播放倍率
 	await api_startRecordingCb({
 	await api_startRecordingCb({
 		// accompanimentState: state.setting.enableAccompaniment ? 1 : 0,
 		// accompanimentState: state.setting.enableAccompaniment ? 1 : 0,
 		accompanimentState: !state.accompany ? 0 : 1, // 评测没有伴奏时,静音播放
 		accompanimentState: !state.accompany ? 0 : 1, // 评测没有伴奏时,静音播放
 		firstNoteTime: preTimes || 0,
 		firstNoteTime: preTimes || 0,
-		speedRate: rate, // 播放倍率
+    speedRate: parseFloat(rate.toFixed(2)), // 播放倍率
 	}, () => {
 	}, () => {
 		if (state.isAppPlay) {
 		if (state.isAppPlay) {
 			setTimeout(() => {
 			setTimeout(() => {