|
@@ -791,7 +791,22 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
|
|
|
let repeatIdx = 0; // 循环的次数
|
|
|
while (!iterator.EndReached) {
|
|
|
// console.log({ ...iterator });
|
|
|
- const voiceEntries = iterator.CurrentVoiceEntries?.[0] ? [iterator.CurrentVoiceEntries?.[0]] : [];
|
|
|
+ /** 多声轨合并显示,当前音符的时值取所有声轨中的最小值 */
|
|
|
+ let minIndex = 0, elRealValue = 0
|
|
|
+ for (let index = 0; index < iterator.currentVoiceEntries.length; index++) {
|
|
|
+ const element = iterator.currentVoiceEntries[index];
|
|
|
+ if (element.isGrace) {
|
|
|
+ if (minIndex == index && minIndex == 0) {
|
|
|
+ minIndex = iterator.currentVoiceEntries.length > 1 ? 1 : 0
|
|
|
+ }
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if (element.notes[0].length.realValue < elRealValue) {
|
|
|
+ minIndex = index
|
|
|
+ }
|
|
|
+ elRealValue = element.notes[0].length.realValue
|
|
|
+ }
|
|
|
+ const voiceEntries = iterator.currentVoiceEntries?.[minIndex] ? [iterator.currentVoiceEntries?.[minIndex]] : [];
|
|
|
|
|
|
let currentVoiceEntries: any[] = [];
|
|
|
// 多分轨,当前小节最大音符数量
|
|
@@ -817,6 +832,7 @@ export const formateTimes = (osmd: OpenSheetMusicDisplay) => {
|
|
|
notes.push(...n.Notes);
|
|
|
return notes;
|
|
|
}, [] as any);
|
|
|
+ voiceNotes = voiceNotes.filter((note: any) => !note.IsGraceNote)
|
|
|
voiceNotes = voiceNotes.sort((a: any, b: any) => a?.length?.realValue - b?.length?.realValue);
|
|
|
currentTime = voiceNotes?.[0]?.length?.realValue || 0;
|
|
|
|