|
@@ -4,7 +4,7 @@ import { OpenSheetMusicDisplay } from "../osmd-extended/src";
|
|
|
import { metronomeData } from "./helpers/metronome";
|
|
|
import { GradualNote, GradualTimes, GradualVersion } from "./type";
|
|
|
import { handleEndEvaluat, handleStartEvaluat } from "./view/evaluating";
|
|
|
-import { IFingering, mappingVoicePart, subjectFingering } from "/src/view/fingering/fingering-config";
|
|
|
+import { IFingering, mappingVoicePart, subjectFingering, matchVoicePart } from "/src/view/fingering/fingering-config";
|
|
|
import { handleStartTick } from "./view/tick";
|
|
|
import { audioListStart, getAudioCurrentTime, getAudioDuration, setAudioCurrentTime, setAudioPlaybackRate } from "./view/audio-list";
|
|
|
import { toggleFollow } from "./view/follow-practice";
|
|
@@ -44,6 +44,85 @@ export enum IPlatform {
|
|
|
*/
|
|
|
const classids = [1, 2, 6, 7, 8, 9, 3, 10, 11, 12, 13, 4, 14, 15, 16, 17, 30, 31, 35, 36, 46, 108]; // 大雅金唐, 竖笛教程, 声部训练展开的分类ID
|
|
|
|
|
|
+// 乐器code码
|
|
|
+const musicalInstrumentCodeInfo = [
|
|
|
+ {
|
|
|
+ name: '排箫',
|
|
|
+ code: 'Panpipes',
|
|
|
+ id: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '陶笛',
|
|
|
+ code: 'Ocarina',
|
|
|
+ id: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '葫芦丝',
|
|
|
+ code: 'Woodwind',
|
|
|
+ id: 3
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '德式竖笛',
|
|
|
+ code: 'Tenor Recorder',
|
|
|
+ id: 4
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '口风琴',
|
|
|
+ code: 'Nai',
|
|
|
+ id: 5
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '英式竖笛',
|
|
|
+ code: 'BaroqueRecorder',
|
|
|
+ id: 6
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '打击乐',
|
|
|
+ code: 'PERCUSSION',
|
|
|
+ id: 7
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '长笛',
|
|
|
+ code: 'FLUTE',
|
|
|
+ id: 8
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '萨克斯',
|
|
|
+ code: 'SAX',
|
|
|
+ id: 9
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '单簧管',
|
|
|
+ code: 'CLARINET',
|
|
|
+ id: 10
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '小号',
|
|
|
+ code: 'TRUMPET',
|
|
|
+ id: 11
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '长号',
|
|
|
+ code: 'TROMBONE',
|
|
|
+ id: 12
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '圆号',
|
|
|
+ code: 'HORN',
|
|
|
+ id: 13
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '上低音号',
|
|
|
+ code: 'BARITONE',
|
|
|
+ id: 14
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '大号',
|
|
|
+ code: 'TUBA',
|
|
|
+ id: 15
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
const state = reactive({
|
|
|
/** 来源 : PC , app */
|
|
|
platform: "" as IPlatform,
|
|
@@ -197,6 +276,8 @@ const state = reactive({
|
|
|
repeatInfo: [],
|
|
|
/** 多分轨的曲子,可支持筛选的分轨 */
|
|
|
canSelectTracks: "",
|
|
|
+ /** 声部codeId,用于匹配乐器指法、声部转调、特殊声部处理等 */
|
|
|
+ subjectCodeId: 0 as number,
|
|
|
});
|
|
|
const browserInfo = browser();
|
|
|
let offset_duration = 0;
|
|
@@ -684,7 +765,10 @@ const setState = (data: any, index: number) => {
|
|
|
state.xmlUrl = data.xmlFileUrl;
|
|
|
state.partIndex = index;
|
|
|
state.trackId = data.track;
|
|
|
- state.subjectId = data.subjectIds;
|
|
|
+ state.subjectId = data.subjectIds ? data.subjectIds.split(',')?.[0] : 0;
|
|
|
+ const subjectCode = data.subjectCodes ? data.subjectCodes.split(',')?.[0] : 0;
|
|
|
+ const pitchSubject = musicalInstrumentCodeInfo.find((n) => n.code === subjectCode)
|
|
|
+ state.subjectCodeId = pitchSubject ? pitchSubject.id : 0
|
|
|
state.categoriesId = data.musicCategoryId;
|
|
|
state.categoriesName = data.musicTagNames;
|
|
|
state.enableEvaluation = data.isEvaluated ? true : false;
|
|
@@ -729,7 +813,12 @@ const setState = (data: any, index: number) => {
|
|
|
state.isSpecialBookCategory = !classids.includes(data.musicCategoryId);
|
|
|
|
|
|
// 设置指法
|
|
|
- const code = state.isConcert ? mappingVoicePart(state.trackId, "ENSEMBLE") : mappingVoicePart(state.subjectId, "INSTRUMENT");
|
|
|
+ // const code = state.isConcert ? mappingVoicePart(state.trackId, "ENSEMBLE") : mappingVoicePart(state.subjectId, "INSTRUMENT");
|
|
|
+ /**
|
|
|
+ * 各平台的乐器声部id不统一,为了兼容处理老的数据,加上乐器code码,此码唯一
|
|
|
+ * 获取指法code
|
|
|
+ */
|
|
|
+ const code = state.isConcert ? matchVoicePart(state.trackId, "CONCERT") : matchVoicePart(state.subjectCodeId, "SINGLE");
|
|
|
state.fingeringInfo = subjectFingering(code);
|
|
|
console.log("🚀 ~ state.fingeringInfo:", code, state.fingeringInfo, state.trackId, state.track);
|
|
|
|