Browse Source

优化节拍器 timeGap 合成

黄琪勇 2 months ago
parent
commit
cdf2d85000
3 changed files with 5 additions and 4 deletions
  1. 1 2
      src/helpers/formateMusic.ts
  2. 1 1
      src/page-instrument/view-detail/index.tsx
  3. 3 1
      src/state.ts

+ 1 - 2
src/helpers/formateMusic.ts

@@ -1641,9 +1641,8 @@ const analyzeEvxml = (xmlParse: any, xmlUrl?: string) => {
 		}
 		state.evXmlBeginTime = firstNoteBeginTime ? firstNoteBeginTime / 1000 : xmlNum ? 60 / state.originSpeed * xmlNum * 4/denNum : 0;
 		state.secondEvXmlBeginTime = firstNoteBeginTime ? 0 : xmlNum2 ? 60 / state.originSpeed * xmlNum2 * 4/denNum2 : 0;
-		const hasTimeGap = xmlParse.getElementsByTagName("timegap").length > 0;
+		const hasTimeGap = state.xmlHasTimeGap = xmlParse.getElementsByTagName("timegap").length > 0;
 		const hasTimes = xmlParse.getElementsByTagName("times").length > 0;
-
 		if (timeGaps && timeGaps.length && !firstNoteBeginTime) {
 			for (const timeGap of timeGaps) {
 				const num: any = timeGap?.getAttribute('num'), den: any = timeGap?.getAttribute('den');

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

@@ -281,7 +281,7 @@ export default defineComponent({
           });
           return beatTimeItem;
         });
-        const webApi_beatTimes = { beatTime, singBeatTime, mingBeatTime, isBeatTime:!state.evXmlBeginArr.length, isSingBeatTime:!state.evXmlBeginArr.length, isMingBeatTime:!state.evXmlBeginArr.length }
+        const webApi_beatTimes = { beatTime, singBeatTime, mingBeatTime, isBeatTime:!state.xmlHasTimeGap, isSingBeatTime:!state.xmlHasTimeGap, isMingBeatTime:!state.xmlHasTimeGap }
         console.log("webApi_beatTimes", webApi_beatTimes);
         window.parent.postMessage(
           {

+ 3 - 1
src/state.ts

@@ -441,7 +441,9 @@ const state = reactive({
   /** evxml等待播放的时间集合,多遍反复播放,会有多个timegap(前奏)时间 */
   evXmlBeginArr: [] as any,
   /** evxml的曲子是否有times */
-  xmlHasTimes: false,
+  xmlHasTimes: false,  
+  /** evxml的曲子是否有timeGap */
+  xmlHasTimeGap: false,
   /** 指法信息 */
   fingeringInfo: {} as IFingering,
   /** 滚动容器的ID */