Esempio n. 1
0
  public long lastNoteEndTick(boolean accountForSustain) {
    long endTick = Long.MIN_VALUE;

    // The last note to start playing isn't necessarily the last note to end.
    // Check the last several notes to find the one that ends last.
    int notesToCheck = 1000;

    for (int t = 0; t < getTrackCount(); t++) {
      if (isTrackEnabled(t)) {
        List<NoteEvent> evts = getTrackEvents(t);
        ListIterator<NoteEvent> iter = evts.listIterator(evts.size());
        while (iter.hasPrevious()) {
          NoteEvent ne = iter.previous();
          if (mapNote(t, ne.note.id) != null) {
            long noteEndTick;
            if (!accountForSustain || instrument.isSustainable(ne.note.id))
              noteEndTick = ne.getEndTick();
            else {
              ITempoCache tc = ne.getTempoCache();
              noteEndTick =
                  tc.microsToTick(
                      tc.tickToMicros(ne.getStartTick()) + TimingInfo.ONE_SECOND_MICROS);
            }

            if (noteEndTick > endTick) endTick = noteEndTick;

            if (--notesToCheck <= 0) break;
          }
        }
      }
    }

    return endTick;
  }
Esempio n. 2
0
 public LotroInstrument[] getSupportedInstruments() {
   // return LotroInstrument.getNonDrumInstruments();
   return LotroInstrument.values();
 }