Jelajahi Sumber

Merge branch 'vip_price_827'

yonge 3 tahun lalu
induk
melakukan
30e11abb21

+ 10 - 4
audio-analysis/src/main/java/com/yonge/netty/dto/UserChannelContext.java

@@ -523,6 +523,8 @@ public class UserChannelContext {
 		
 		chunkAnalysisList = totalChunkAnalysisList.stream().filter(t -> Double.doubleToLongBits(t.getStartTime()) >= Double.doubleToLongBits(correctedStartTime) && Double.doubleToLongBits(t.getEndTime()) <= Double.doubleToLongBits(correctedEndTime)).collect(Collectors.toList());
 		
+		double durationTime = chunkAnalysisList.get(chunkAnalysisList.size() - 1).getEndTime() - chunkAnalysisList.get(0).getStartTime();
+		
 		double playDurationTime = 0;
 		
 		if (subjectId == 23 || subjectId == 113) {
@@ -553,7 +555,7 @@ public class UserChannelContext {
 
 				if (!noteAnalysis.isTempo()) {
 					noteAnalysis.setMusicalErrorType(NoteErrorType.CADENCE_WRONG);
-				} else if (playDurationTime * 100 / noteAnalysis.getDurationTime() < hardLevel.getIntegrityRange()) {
+				} else if (playDurationTime * 100 / durationTime < hardLevel.getIntegrityRange()) {
 					noteAnalysis.setMusicalErrorType(NoteErrorType.INTEGRITY_WRONG);
 				} else if (notePlayResult.getStatus() == false) {
 					noteAnalysis.setMusicalErrorType(NoteErrorType.INTONATION_WRONG);
@@ -564,10 +566,12 @@ public class UserChannelContext {
 				playDurationTime = chunkAnalysisList.stream().filter(t -> t.getFrequency() > 100 && t.getFrequency() < 2000)
 						.mapToDouble(t -> t.getDurationTime()).sum();
 
-				if (playDurationTime * 100 / noteAnalysis.getDurationTime() < hardLevel.getNotPlayRange()) {
+				if (playDurationTime * 100 / durationTime < hardLevel.getNotPlayRange()) {
 					noteAnalysis.setMusicalErrorType(NoteErrorType.NOT_PLAY);
-				} else if (playDurationTime * 100 / noteAnalysis.getDurationTime() < hardLevel.getIntegrityRange()) {
+					LOGGER.info("未演奏:{}", playDurationTime * 100 / durationTime);
+				} else if (playDurationTime * 100 / durationTime < hardLevel.getIntegrityRange()) {
 					noteAnalysis.setMusicalErrorType(NoteErrorType.INTEGRITY_WRONG);
+					LOGGER.info("完整度不足:{}", playDurationTime * 100 / durationTime);
 				} else if (!noteAnalysis.isTempo()) {
 					noteAnalysis.setMusicalErrorType(NoteErrorType.CADENCE_WRONG);
 				} else if (notePlayResult.getStatus() == false) {
@@ -576,6 +580,8 @@ public class UserChannelContext {
 					noteAnalysis.setMusicalErrorType(NoteErrorType.RIGHT);
 				}
 			}
+			
+			LOGGER.info("[{}]演奏时长[{}]/[{}][{}]  时间[{}]-[{}]", noteAnalysis.getDurationTime(), playDurationTime, durationTime,playDurationTime * 100 / durationTime, correctedStartTime, correctedEndTime);
 		}
 
 		// 计算音分
@@ -599,7 +605,7 @@ public class UserChannelContext {
 				noteAnalysis.setTempoScore(tempoScore);
 			}
 
-			integrityScore = (int) (playDurationTime / noteAnalysis.getDurationTime() / hardLevel.getTempoEffectiveRange(musicXmlNote.getDenominator()));
+			integrityScore = (int) (playDurationTime * 100 * 100 / hardLevel.getIntegrityRange() / durationTime);
 			if (integrityScore > 100) {
 				integrityScore = 100;
 			}