コード例 #1
0
ファイル: MusicReader.java プロジェクト: rdp/zong
 /** Reads the given measure element. */
 private static MusicReaderContext readMeasure(
     MusicReaderContext context, MxlMeasure mxlMeasure, int measureIndex) {
   // begin a new measure
   context = context.beginNewMeasure(measureIndex);
   // list all elements
   PVector<MxlMusicDataContent> content = mxlMeasure.getMusicData().getContent();
   for (int i = 0; i < content.size(); i++) {
     MxlMusicDataContent mxlMDC = content.get(i);
     switch (mxlMDC.getMusicDataContentType()) {
       case Note:
         {
           // collect all directly following notes with have a chord-element
           PVector<MxlNote> mxlNotes = pvec((MxlNote) mxlMDC);
           for (int i2 = i + 1; i2 < content.size(); i2++) {
             boolean found = false;
             MxlMusicDataContent mxlMDC2 = content.get(i2);
             if (mxlMDC2.getMusicDataContentType() == MxlMusicDataContentType.Note) {
               MxlNote mxlNote2 = (MxlNote) mxlMDC2;
               if (mxlNote2.getContent().getNoteContentType() == MxlNoteContentType.Normal) {
                 if (((MxlNormalNote) mxlNote2.getContent()).getFullNote().isChord()) {
                   mxlNotes = mxlNotes.plus(mxlNote2);
                   i++;
                   found = true;
                 }
               }
             }
             if (!found) break;
           }
           context = readChord(context, mxlNotes);
           break;
         }
       case Attributes:
         context = readAttributes(context, (MxlAttributes) mxlMDC);
         break;
       case Backup:
         context = readBackup(context, (MxlBackup) mxlMDC);
         break;
       case Forward:
         context = readForward(context, (MxlForward) mxlMDC);
         break;
       case Print:
         context = readPrint(context, (MxlPrint) mxlMDC);
         break;
       case Direction:
         context = readDirection(context, (MxlDirection) mxlMDC);
         break;
       case Barline:
         context = readBarline(context, (MxlBarline) mxlMDC);
         break;
     }
   }
   return context;
 }
コード例 #2
0
ファイル: FrameArrangement.java プロジェクト: rdp/zong
 /** Gets the index of the last measure, or -1 if there are no measures. */
 public int getEndMeasureIndex() {
   if (systems.size() == 0) return -1;
   else return systems.getLast().getEndMeasureIndex();
 }
コード例 #3
0
ファイル: FrameArrangement.java プロジェクト: rdp/zong
 /** Gets the index of the first measure, or -1 if there are no measures. */
 public int getStartMeasureIndex() {
   if (systems.size() == 0) return -1;
   else return systems.getFirst().getStartMeasureIndex();
 }