コード例 #1
0
 public void setStyle(Style s) {
   if (s == null) {
     System.out.println("null Style; should not happen");
     return;
   }
   records = new ArrayList<SectionRecord>();
   addSection(s.getName(), 0, false);
 }
コード例 #2
0
 public boolean setStyle(String name) {
   Style s = Style.getStyle(name);
   if (s == null) {
     return false;
   } else {
     setStyle(s);
     return true;
   }
 }
コード例 #3
0
  public long render(
      MidiSequence seq,
      long time,
      Track track,
      int transposition,
      boolean useDrums,
      int endLimitIndex,
      boolean constantBass)
      throws InvalidMidiDataException {
    // to trace sequencing info:
    // System.out.println("Sequencing SectionInfo time = "
    // + time + " endLimitIndex = " + endLimitIndex + " useDrums = " + useDrums);

    // Iterate over list of sections, each a Style

    int chordsSize = chords.size();

    int endIndex;

    // m is a second iterator intended to stay one step ahead of k
    // so as to get the start of the next section

    Style mostRecentStyle = new Style();

    ListIterator<SectionRecord> k = records.listIterator();
    ListIterator<SectionRecord> m = records.listIterator();
    if (m.hasNext()) {
      m.next();
    }

    while (k.hasNext()) // && (endLimitIndex == ENDSCORE || endIndex <= endLimitIndex) )
    {
      SectionRecord record = k.next();
      Style style;
      if (record.getUsePreviousStyle()) {
        style = mostRecentStyle;
        // System.out.println("using previous style " + style);
      } else {
        style = record.getStyle();
        mostRecentStyle = style;
      }

      int startIndex = record.getIndex();

      endIndex = m.hasNext() ? m.next().getIndex() : chordsSize;

      if (style != null) {
        time =
            style.render(
                seq,
                time,
                chords,
                startIndex,
                endIndex,
                transposition,
                useDrums,
                endLimitIndex,
                constantBass);
      }
    }
    return time;
  }
コード例 #4
0
 /**
  * getStyleAtSlot returns Style operative at a given slot in the ChordPart
  *
  * @param slot
  * @return
  */
 public Style getStyleAtSlot(int slot) {
   return Style.getStyle(getStyleNameAtSlot(slot));
 }