Parcourir la source

Merge branch 'new-feature-tianyong' into kt-dev

TIANYONG il y a 1 an
Parent
commit
5c8c76e409

+ 1 - 1
osmd-extended

@@ -1 +1 @@
-Subproject commit c61975028e8f71a7448a92ba440fc9297a17a2ed
+Subproject commit 9d41c99bb92f1a836080f4a62e44211dbec45379

+ 2 - 1
src/helpers/formateMusic.ts

@@ -372,6 +372,7 @@ export const onlyVisible = (xml: string, partIndex: number): string => {
 	}
 	const visiblePartInfo = partList[partIndex];
 	// console.log(visiblePartInfo, partIndex)
+	// 根据后台已选择的分轨筛选出能切换的声轨
 	state.partListNames = partListNames;
 	if (visiblePartInfo) {
 		const id = visiblePartInfo.getAttribute("id");
@@ -794,7 +795,6 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 			if (metronomeNoteIndex !== 0 && metronomeNoteIndex > si) {
 				measureSpeed = allNotes[allNotes.length - 1]?.speed || 100;
 			}
-
 			const activeVerticalMeasureList = [note.sourceMeasure.verticalMeasureList?.[0]] || [];
 			const { realValue } = iterator.currentTimeStamp;
 			const { RealValue: vRealValue, Denominator: vDenominator } = formatDuration(
@@ -997,6 +997,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
 				osdmContext: osmd,
 				speedbeatUnit: beatUnit,
 				multipleRestMeasures: multipleRestMeasures,
+				measureSpeed,  // 小节速度
 			};
 			nodeDetail.realKey = formatRealKey(note.halfTone - fixedKey * 12, nodeDetail);
 			nodeDetail.duration = nodeDetail.endtime - nodeDetail.time;

+ 5 - 1
src/page-instrument/header-top/index.tsx

@@ -41,6 +41,9 @@ export const headTopData = reactive({
     if (value === 'follow' && metronomeData.cursorMode === 2) {
       metronomeData.cursorMode = 1
     }
+    if (value === 'practise') {
+      state.playIngSpeed = state.speed
+    }
     if (value === "evaluating") {
       // 如果是pc端, 评测模式暂不可用
       if (state.platform === IPlatform.PC) {
@@ -52,6 +55,7 @@ export const headTopData = reactive({
         });
         return;
       }
+      state.playIngSpeed = state.originSpeed
       handleStartEvaluat();
     } else if (value === "follow") {
       toggleFollow();
@@ -416,7 +420,7 @@ export default defineComponent({
                       headData.speedShow = !headData.speedShow;
                     }}
                   >
-                    <Badge class={styles.badge} content={state.speed}>
+                    <Badge class={styles.badge} content={state.playState === "play" ? state.playIngSpeed : state.speed}>
                       <img class={styles.iconBtn} src={headImg("icon_speed.svg")} />
                     </Badge>
                     <span>速度</span>

+ 1 - 1
src/page-instrument/view-detail/index.tsx

@@ -360,7 +360,7 @@ export default defineComponent({
             {/* 作业 */}
             {query.workRecord && <WorkIndex />}
             {/* 曲谱列表 */}
-            {state.playState == "play" || followData.start || evaluatingData.startBegin || query.workRecord || query.modelType || state.platform === IPlatform.PC ? null : <TheMusicList />}
+            {state.playState == "play" || followData.start || evaluatingData.startBegin || query.workRecord || query.modelType || state.platform === IPlatform.PC || query.isCbs ? null : <TheMusicList />}
           </>
         )}
 

+ 17 - 7
src/state.ts

@@ -175,6 +175,8 @@ const state = reactive({
   speed: 0,
   /** 曲谱音频正常的速度 */
   originSpeed: 0,
+  /** 播放过程中显示的速度 */
+  playIngSpeed: 0,
   /** 分轨名称 */
   track: "",
   /** 当前显示声部索引 */
@@ -275,9 +277,11 @@ const state = reactive({
   /** 重播小节集合信息 */
   repeatInfo: [],  
   /** 多分轨的曲子,可支持筛选的分轨 */
-  canSelectTracks: "",
+  canSelectTracks: [] as any,
   /** 声部codeId,用于匹配乐器指法、声部转调、特殊声部处理等 */
   subjectCodeId: 0 as number,
+  /** 合奏曲目是否合并展示 */
+  isCombineRender: false,
 });
 const browserInfo = browser();
 let offset_duration = 0;
@@ -352,6 +356,11 @@ const handlePlaying = () => {
   state.playProgress = (currentTime / duration) * 100;
   let item = getNote(currentTime);
   // console.log(11111,currentTime,duration,state.playSource, item.i)
+  // console.log(item.i,item.noteId,item.measureSpeed)
+  // 练习模式下,实时刷新小节速度
+  if (state.modeType === "practise" && state.playState === "play" && item.measureSpeed && item.measureSpeed !== state.playIngSpeed) {
+    state.playIngSpeed = item.measureSpeed
+  }
   if (item) {
     // 选段状态下
     if (state.sectionStatus && state.section.length === 2) {
@@ -756,7 +765,6 @@ const getMusicInfo = (res: any) => {
   };
   console.log("🚀 ~ musicInfo:", musicInfo);
   setState(musicInfo, index);
-  setCustom();
 };
 
 const setState = (data: any, index: number) => {
@@ -775,6 +783,8 @@ const setState = (data: any, index: number) => {
   state.examSongId = data.id + "";
   state.examSongName = data.name;
   state.coverImg = data.musicCover ?? "";
+  state.isCombineRender = data.musicSheetType === "SINGLE" && data.musicSheetSoundList?.length > 1
+  setCustom(state.isCombineRender ? data.musicSheetSoundList?.length : 0);
   // 解析扩展字段
   if (data.extConfigJson) {
     try {
@@ -796,9 +806,9 @@ const setState = (data: any, index: number) => {
   state.originSpeed = state.speed = data.playSpeed;
   const track = data.code || data.track;
   state.track = track ? track.replace(/ /g, "").toLocaleLowerCase() : "";
-  state.enableNotation = data.isConvertibleScore ? true : false;
+  state.enableNotation = data.isConvertibleScore === null ? true : data.isConvertibleScore;
   state.isConcert = data.musicSheetType === "CONCERT" ? true : false;
-  state.canSelectTracks = data.multiTracksSelection;
+  state.canSelectTracks = data.multiTracksSelection?.split(',');
   // 开启预备小节
   state.isOpenPrepare = true;
   state.extStyleConfigJson = data.extStyleConfigJson || {}
@@ -840,8 +850,8 @@ const setState = (data: any, index: number) => {
   console.log("state对象", state);
 };
 
-const setCustom = () => {
-  if (state.extConfigJson.multitrack) {
-    setGlobalData("multitrack", state.extConfigJson.multitrack);
+const setCustom = (trackNum?: number) => {
+  if (trackNum || state.extConfigJson.multitrack) {
+    setGlobalData("multitrack", trackNum || state.extConfigJson.multitrack);
   }
 };

+ 1 - 1
src/view/music-score/index.tsx

@@ -58,7 +58,7 @@ export default defineComponent({
 		const getXML = async () => {
 			const res = await fetch(state.xmlUrl).then((response) => response.text());
 			const xml = formatXML(res);
-			musicData.score = onlyVisible(xml, state.partIndex);
+			musicData.score = state.isCombineRender ? xml : onlyVisible(xml, state.partIndex);
 			if (state.gradualTimes) {
 				state.gradual = getGradualLengthByXml(xml);
 			}

+ 1 - 1
src/view/plugins/toggleMusicSheet/choosePartName/index.tsx

@@ -21,7 +21,7 @@ export default defineComponent({
     const columns = computed(() => {
       return partListNames.value
     })
-    // console.log(partListNames.value, partIndex.value, selectIndex.value, columns.value, 999999)
+    console.log(partListNames.value, partIndex.value, selectIndex.value, columns.value, 999999)
     /**
      * 默认选中的
      * picker组件,3.x的版本可以使用defaultIndex,4.x的版本只能使用v-model传递

+ 4 - 1
src/view/plugins/toggleMusicSheet/index.tsx

@@ -23,12 +23,15 @@ export default defineComponent({
       let partList = state.partListNames || []
       partList = partList.filter((item: any) => !item?.toLocaleUpperCase()?.includes('COMMON'))
       return partList.map((item: any, index: number) => {
+        // 该声轨能否被选
+        const canselect = state.canSelectTracks.includes(item) ? true : false
         const instrumentName = getInstrumentName(item)
         return {
           text: item + (instrumentName ? `(${instrumentName})` : ''),
           value: index,
+          canselect
         }
-      }).filter(Boolean)
+      }).filter((item: any) => item.canselect)
     })
 
     const switchMusic = (index: number) => {