Пример #1
0
    public void setLineList(LineList lines) {
      this.lines = lines;

      if (lines.size() > 0 && !lines.contains(currentLine)) {
        currentLine = (Line) lines.get(0);
        updateLabel();
      }
    }
Пример #2
0
  public void setLineList(LineList lines) {
    lineObj.setLines(lines);
    lineCanvas.setLineList(lines);
    lineSelector.setLineList(lines);

    if (lines.size() > 0) {
      lineCanvas.setSelectedLine(lines.getLine(0));
    }
  }
Пример #3
0
  public Element saveAsXML(Map<Object, String> objRefMap) {
    Element retVal = SoundObjectUtilities.getBasicXML(this);

    for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
      Line line = (Line) iter.next();
      retVal.addElement(line.saveAsXML());
    }

    return retVal;
  }
Пример #4
0
    private void previousLine() {
      if (lines == null || currentLine == null) {
        return;
      }

      int index = lines.indexOf(currentLine);

      if (index == -1) {
        return;
      }

      index--;

      if (index < 0) {
        index = lines.size() - 1;
      }

      currentLine = (Line) lines.get(index);
      updateLabel();
      fireLineSelection();
    }
Пример #5
0
    private void nextLine() {
      if (lines == null || currentLine == null) {
        return;
      }

      int index = lines.indexOf(currentLine);

      if (index == -1) {
        return;
      }

      index++;

      if (index >= lines.size()) {
        index = 0;
      }

      currentLine = (Line) lines.get(index);
      updateLabel();
      fireLineSelection();
    }
Пример #6
0
  @Override
  public NoteList generateForCSD(CompileData compileData, float startTime, float endTime) {

    Integer[] instrLineArray = new Integer[lines.size() * 2];
    HashMap ftableNumMap = new HashMap();

    generateFTables(compileData, ftableNumMap);
    generateInstruments(compileData, instrLineArray, ftableNumMap);

    try {
      return generateNotes(instrLineArray, startTime, endTime);
    } catch (SoundObjectException ex) {
      throw new RuntimeException(ex);
    }
  }
Пример #7
0
  public void generateFTables(CompileData compileData, HashMap ftableNumMap) {

    StringBuilder buffer = new StringBuilder();

    // TODO - need to grab from tables in static var

    Object obj = compileData.getCompilationVariable(LINE_OBJECT_CACHE);

    if (obj == null) {
      HashMap map = new HashMap();
      compileData.setCompilationVariable(LINE_OBJECT_CACHE, map);
      obj = map;
    }

    HashMap stringTables = (HashMap) obj;

    for (Iterator iter = lines.iterator(); iter.hasNext(); ) {

      Line line = (Line) iter.next();
      String table = createTable(line);

      int tableNum;

      if (stringTables.containsKey(table)) {
        tableNum = ((Integer) stringTables.get(table)).intValue();
      } else {
        tableNum = compileData.getOpenFTableNumber();
        stringTables.put(table, new Integer(tableNum));
        buffer.append("f").append(tableNum);
        buffer.append(table).append("\n");
      }

      ftableNumMap.put(line.getUniqueID(), new Integer(tableNum));
    }

    compileData.appendTables(buffer.toString());
  }
Пример #8
0
  public void generateInstruments(
      CompileData compileData, Integer[] instrLineArray, HashMap ftableNumMap) {
    int i = 0;

    for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
      Line line = (Line) iter.next();

      String lineName;

      if (line.isZak()) {
        lineName = "zak" + line.getChannel();
      } else {
        lineName = line.getVarName();
      }

      String lineId = line.getUniqueID();
      String key = "AbstractLineObject." + lineName;
      Object val = compileData.getCompilationVariable(key);
      int instrNum = -1;
      Integer lineNum = (Integer) ftableNumMap.get(lineId);

      if (val == null) {

        String instrText = generateLineInstrument(line);
        GenericInstrument instr = new GenericInstrument();
        instr.setText(instrText);
        instrNum = compileData.addInstrument(instr);
        compileData.setCompilationVariable(key, new Integer(instrNum));
      } else {
        instrNum = ((Integer) val).intValue();
      }

      instrLineArray[i++] = new Integer(instrNum);
      instrLineArray[i++] = lineNum;
    }
  }