瀏覽代碼

SourceStaffEntry: add hasOnlyRests() getter

sschmid 4 年之前
父節點
當前提交
85be243e8f
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/MusicalScore/VoiceData/SourceStaffEntry.ts

+ 11 - 0
src/MusicalScore/VoiceData/SourceStaffEntry.ts

@@ -266,4 +266,15 @@ export class SourceStaffEntry {
             }
         }
     }
+
+    public get hasOnlyRests(): boolean {
+        for (const voiceEntry of this.voiceEntries) {
+            for (const note of voiceEntry.Notes) {
+                if (!note.isRest) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
 }