2
* Created on 26-dic-2005
4
* TODO To change the template for this generated file go to
5
* Window - Preferences - Java - Code Style - Code Templates
7
package org.herac.tuxguitar.song.models.effects;
9
import java.util.ArrayList;
10
import java.util.Iterator;
11
import java.util.List;
16
* TODO To change the template for this generated type comment go to
17
* Window - Preferences - Java - Code Style - Code Templates
19
public class BendEffect {
20
public static final int SEMITONE_LENGTH = 2;
21
public static final int MAX_POSITION_LENGTH = 12;
22
public static final int MAX_VALUE_LENGTH = (SEMITONE_LENGTH * 6);
26
private BendEffect(List points){
31
this(new ArrayList());
34
public void addPoint(int position,int value){
35
this.points.add(new BendPoint(position,value));
38
public List getPoints(){
42
public Object clone(){
43
List points = new ArrayList();
44
Iterator it = getPoints().iterator();
46
BendPoint point = (BendPoint)it.next();
47
points.add(point.clone());
50
return new BendEffect(points);
53
public class BendPoint{
57
public BendPoint(int position,int value){
58
this.position = position;
62
public int getPosition() {
66
public int getValue() {
70
public long getTime(long duration){
71
return (duration * getPosition() / MAX_POSITION_LENGTH);
74
public Object clone(){
75
return new BendPoint(getPosition(),getValue());