Browse Source

附点音符

liushengqiang 1 year ago
parent
commit
7cfbb7b55d
1 changed files with 10 additions and 2 deletions
  1. 10 2
      src/pc/home/runtime.ts

+ 10 - 2
src/pc/home/runtime.ts

@@ -297,7 +297,7 @@ export const moveNoteKey = (note: string, moveData: { step: number; move: number
 const formateGetData = {
 	getNoteType: (duration: number) => {
 		const type = 0.25 / duration;
-		console.log(type);
+		console.log(type, duration);
 		const noteType = [
 			{ name: 0.25, value: "4" },
 			{ name: 0.5, value: "2" },
@@ -306,7 +306,15 @@ const formateGetData = {
 			{ name: 4, value: "//" },
 			{ name: 8, value: "///" },
 		];
-		return noteType.find((n) => n.name === type)?.value || "";
+		let _duration = noteType.find((n) => n.name === type)?.value || "";
+		const noteDuration: any = {
+			"0.375": "3/2",
+			"0.75": "3"
+		}
+		if (_duration === "") {
+			_duration = noteDuration[duration] || "";
+		}
+		return _duration
 	},
 };