|
@@ -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"];
|
|
|
+ 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 = ["ocarina", "pan-flute", "piccolo"];
|
|
|
+ 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];
|