소스 검색

comments: prepare Instrument -> Part refactor. add MusicSheet.Parts getter

whole refactor is too big for now and would rename a lot of OSMD methods.
Simon Schmid 5 년 전
부모
커밋
448c63add1
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      src/MusicalScore/MusicSheet.ts

+ 7 - 2
src/MusicalScore/MusicSheet.ts

@@ -56,7 +56,8 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     private timestampSortedDynamicExpressionsList: DynamicsContainer[] = [];
     private timestampSortedDynamicExpressionsList: DynamicsContainer[] = [];
     private timestampSortedTempoExpressionsList: MultiTempoExpression[] = [];
     private timestampSortedTempoExpressionsList: MultiTempoExpression[] = [];
     private instrumentalGroups: InstrumentalGroup[] = [];
     private instrumentalGroups: InstrumentalGroup[] = [];
-    private instruments: Instrument[] = [];
+    /** The parts in the sheet, e.g. piano left hand, or piano right hand, or violin. */
+    private instruments: Instrument[] = []; // Should be renamed from instruments to parts and part, though this will be a big refactor
     private playbackSettings: PlaybackSettings;
     private playbackSettings: PlaybackSettings;
     private path: string;
     private path: string;
     private title: Label;
     private title: Label;
@@ -116,7 +117,11 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     public get InstrumentalGroups(): InstrumentalGroup[] {
     public get InstrumentalGroups(): InstrumentalGroup[] {
         return this.instrumentalGroups;
         return this.instrumentalGroups;
     }
     }
-    public get Instruments(): Instrument[] {
+    public get Parts(): Instrument[] { // Instrument should be renamed to Part
+        return this.instruments;
+    }
+    public get Instruments(): Instrument[] { // deprecated
+        // this method name should remain for a while to maintain compatibility even when Instrument is renamed to Part
         return this.instruments;
         return this.instruments;
     }
     }
      public get SheetPlaybackSetting(): PlaybackSettings {
      public get SheetPlaybackSetting(): PlaybackSettings {