|
@@ -787,6 +787,32 @@ export const formatXML = (xml: string, xmlUrl?: string): string => {
|
|
|
};
|
|
|
|
|
|
|
|
|
+/** 处理fine标记播放逻辑 */
|
|
|
+export const filterNoteByFine = (notes: any[]) => {
|
|
|
+ let filterNotes: any[] = [];
|
|
|
+ for (let idx = 0; idx < notes.length; idx++) {
|
|
|
+ const note = notes[idx]?.note;
|
|
|
+ const nextNote = notes[idx+1]?.note
|
|
|
+ const isFine = note.sourceMeasure.lastRepetitionInstructions?.findIndex((repeat: any) => repeat.type == 6) >= 0;
|
|
|
+ if (isFine) {
|
|
|
+ // 判断当前的fine音符是否是最后一遍循环
|
|
|
+ const rightIds = notes.slice(idx).map((right: any) => right.note?.NoteToGraphicalNoteObjectId)
|
|
|
+ let isLast = 0;
|
|
|
+ rightIds.forEach((num: any) => num === note.NoteToGraphicalNoteObjectId && (isLast+=1) )
|
|
|
+ // console.log(isLast,'last',rightIds,note.NoteToGraphicalNoteObjectId)
|
|
|
+ if (note?.sourceMeasure?.MeasureNumberXML !== nextNote?.sourceMeasure?.MeasureNumberXML && isLast == 1) {
|
|
|
+ filterNotes.push(notes[idx])
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ filterNotes.push(notes[idx])
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ filterNotes.push(notes[idx])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return filterNotes
|
|
|
+}
|
|
|
+
|
|
|
/** 获取所有音符的时值,以及格式化音符 */
|
|
|
export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
|
|
|
const customNoteRealValue = customData.customNoteRealValue;
|
|
@@ -852,7 +878,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
|
|
|
|
|
|
let preNoteMeasureNumber: any = null; // 上一个小节的number值
|
|
|
|
|
|
- const _notes = [] as any[];
|
|
|
+ let _notes = [] as any[];
|
|
|
if (state.gradualTimes) {
|
|
|
console.log("后台设置的渐慢小节时间", state.gradual, state.gradualTimes);
|
|
|
}
|
|
@@ -985,6 +1011,8 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
|
|
|
}
|
|
|
// 是否是变速的曲子
|
|
|
const hasVaryingSpeed = _notes.some((item: any) => item.measuresTempoInBPM !== _notes[0].measuresTempoInBPM)
|
|
|
+ // 循环时,遇到fine标记,最后一遍,需要立即结束
|
|
|
+ _notes = filterNoteByFine(_notes)
|
|
|
console.log('变速曲子',hasVaryingSpeed, _notes)
|
|
|
let noteIds: any = [];
|
|
|
// let voicesBBox: any = null;
|