public final void processNotes(NoteList in) {
    in.sort();
    Note temp;
    int size = in.size();
    temp = in.getNote(in.size() - 1);
    float totalTime = temp.getStartTime() + temp.getSubjectiveDuration();

    for (int i = 0; i < size; i++) {
      temp = in.getNote(i);
      // System.out.println("obj: " + temp.getObjectiveDuration() + "
      // subj: " + temp.getSubjectiveDuration());
      temp.setStartTime(totalTime - (temp.getStartTime() + temp.getSubjectiveDuration()));
    }
  }
Beispiel #2
0
  public float[] getValue(CybilNoteList cybilNoteList) {
    String ranType = (String) args.get(0);
    boolean isInteger = ranType.equals("i");

    float startMin = getFloatValue(args.get(1));
    float startMax = getFloatValue(args.get(2));
    float endMin = getFloatValue(args.get(3));
    float endMax = getFloatValue(args.get(4));

    float minDiff = endMin - startMin;
    float maxDiff = endMax - startMax;

    float timeValue = getTimeValue(args.get(5));
    boolean isTime = isTime(args.get(5));

    NoteList notes = cybilNoteList.notes;

    if (cybilNoteList.pfield == 2) {
      if (isTime) {

      } else {

      }
    } else {
      if (isTime) {
        Note currentNote = notes.getNote(cybilNoteList.index);
        float startTime = currentNote.getStartTime();
        float endTime = startTime + timeValue;

        int count = getCount(notes, cybilNoteList.index, endTime);

        for (int i = 0; i < count; i++) {

          float x = (currentNote.getStartTime() - startTime) / timeValue;

          float min = (minDiff * x) + startMin;
          float max = (maxDiff * x) + startMax;
          float diff = max - min;

          double val = (float) (Math.random() * diff) + min;

          String strVal = isInteger ? Integer.toString((int) val) : Double.toString(val);

          currentNote.setPField(strVal, cybilNoteList.pfield);

          cybilNoteList.index++;

          if (cybilNoteList.index >= notes.size()) {
            break;
          }
          currentNote = notes.getNote(cybilNoteList.index);
        }

      } else {
        for (int i = 0; i < timeValue; i++) {
          float x = i / timeValue;

          float min = (minDiff * x) + startMin;
          float max = (maxDiff * x) + startMax;
          float diff = max - min;

          double val = (Math.random() * diff) + min;

          String strVal = isInteger ? Integer.toString((int) val) : Double.toString(val);

          Note currentNote = notes.getNote(cybilNoteList.index);
          currentNote.setPField(strVal, cybilNoteList.pfield);
          cybilNoteList.index++;

          if (cybilNoteList.index >= notes.size()) {
            break;
          }
        }
      }
    }

    return null;
  }