/** * Returns a copy of the Score. * * @return Score a copy of the Score */ public Score copy() { // Trace.log(2, "copying Score of size " + size()); Score newScore = new Score(title, tempo); newScore.setMetre(metre[0], metre[1]); PartList newPartList = new PartList(partList.size()); ListIterator<MelodyPart> i = partList.listIterator(); while (i.hasNext()) newPartList.add(i.next().copy()); newScore.partList = newPartList; newScore.chordProg = chordProg.copy(); newScore.setChordInstrument(getChordInstrument()); newScore.setBassInstrument(getBassInstrument()); newScore.setBassMuted(getBassMuted()); newScore.setDrumMuted(getDrumMuted()); newScore.setChordMuted(getChordMuted()); newScore.setMelodyMuted(getMelodyMuted()); newScore.setMasterVolumeMuted(getMasterVolumeMuted()); newScore.setBassVolume(getBassVolume()); newScore.setDrumVolume(getDrumVolume()); newScore.setChordVolume(getChordVolume()); newScore.setMelodyVolume(getMelodyVolume()); newScore.setMasterVolume(getMasterVolume()); newScore.countInProg = countInProg == null ? null : countInProg.copy(); return newScore; }
/** * Adds the specified number of empty Parts to the Score. * * @param parts the number of Parts to add */ public void addParts(int parts) { // Trace.log(0, "adding " + parts + " new parts to score"); for (int i = 0; i < parts; i++) { MelodyPart mp = new MelodyPart(length); if (partList.size() > 0) { mp.setInstrument(partList.get(0).getInstrument()); } partList.add(mp); } }
public int size() { checkLength(); return partList.size(); }
public int getTotalLength() { return length * partList.size(); }
/** * Clear all melody parts in the score * * @param index the index of the Part to delete */ public void clearParts() { int numberParts = partList.size(); partList = new PartList(numberParts); addParts(numberParts); }
/** * Deletes the part at the specified index * * @param index the index of the Part to delete */ public void delPart(int index) { if (index >= 0 && index < partList.size()) partList.remove(index); }