Ver código fonte

Merge branch '2023-9-13_指法' into online

liushengqiang 1 ano atrás
pai
commit
b99b0ab520

+ 11 - 7
src/page-instrument/view-detail/index.tsx

@@ -27,16 +27,20 @@ import { storeData } from "/src/store";
 import ViewFigner from "../view-figner";
 import { recalculateNoteData } from "/src/view/selection";
 
+const calcCeilFrequency = (frequency: number) => {
+  if (frequency) return frequency * 1000 * 2 / 1000;
+  return 0
+};
 /** 需要处理频率的乐器
- * 120: 竖笛
  */
-const instrumentSubject = [120];
 const resetFrequency = (list: any[]) => {
-  if (!instrumentSubject.includes(state.subjectId)) return list;
+  const instrumentNames = ["ocarina", "pan-flute", "piccolo", "hulusi-flute"];
+  if (!state.fingeringInfo?.name || !instrumentNames.includes(state.fingeringInfo.name)) return list;
+  console.log(state.subjectId, state.fingeringInfo.name, instrumentNames)
   for (let i = 0; i < list.length; i++) {
-    if (list[i].prevFrequency) list[i].prevFrequency = list[i].prevFrequency * 2;
-    if (list[i].frequency) list[i].frequency = list[i].frequency * 2;
-    if (list[i].nextFrequency) list[i].nextFrequency = list[i].nextFrequency * 2;
+    if (list[i].prevFrequency) list[i].prevFrequency = calcCeilFrequency(list[i].prevFrequency);
+    if (list[i].frequency) list[i].frequency = calcCeilFrequency(list[i].frequency);
+    if (list[i].nextFrequency) list[i].nextFrequency = calcCeilFrequency(list[i].nextFrequency);
   }
   return list;
 };
@@ -45,7 +49,7 @@ const resetFrequency = (list: any[]) => {
  * 乐器指法处理
  */
 const setNoteHalfTone = (list: any[]) => {
-  const instrumentNames = ["hulusi-flute"];
+  const instrumentNames = ["hulusi-flute"] // ["ocarina", "pan-flute", "piccolo"];
   if (!state.fingeringInfo?.name || !instrumentNames.includes(state.fingeringInfo.name)) return list;
   for (let i = 0; i < list.length; i++) {
     const note = list[i];

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
src/view/fingering/fingering-img/pan-flute/index.json


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
src/view/fingering/fingering-img/pan-flute1/index.json


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
src/view/fingering/fingering-img/pan-flute2/index.json


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff