1 package org.herac.tuxguitar.song.models.effects;
2 
3 import org.herac.tuxguitar.song.factory.TGFactory;
4 
5 public abstract class TGEffectHarmonic {
6 	public static final String KEY_NATURAL = "N.H";
7 
8 	public static final String KEY_ARTIFICIAL = "A.H";
9 
10 	public static final String KEY_TAPPED = "T.H";
11 
12 	public static final String KEY_PINCH = "P.H";
13 
14 	public static final String KEY_SEMI = "S.H";
15 
16 	public static final int TYPE_NATURAL = 1;
17 
18 	public static final int TYPE_ARTIFICIAL = 2;
19 
20 	public static final int TYPE_TAPPED = 3;
21 
22 	public static final int TYPE_PINCH = 4;
23 
24 	public static final int TYPE_SEMI = 5;
25 
26 	public static final int MIN_ARTIFICIAL_OFFSET = -24;
27 
28 	public static final int MAX_ARTIFICIAL_OFFSET = 24;
29 
30 	public static final int MAX_TAPPED_OFFSET = 24;
31 
32 	public static final int NATURAL_FREQUENCIES[][] = {
33 		{12, 12}, //AH12 (+12 frets)
34 		{9 , 28}, //AH9 (+28 frets)
35 		{5 , 24}, //AH5 (+24 frets)
36 		{7 , 19}, //AH7 (+19 frets)
37 		{4 , 28}, //AH4 (+28 frets)
38 		{3 , 31}  //AH3 (+31 frets)
39 	};
40 
41 	private int type;
42 
43 	private int data;
44 
TGEffectHarmonic()45 	public TGEffectHarmonic(){
46 		this.type = 0;
47 		this.data = 0;
48 	}
49 
getData()50 	public int getData() {
51 		return this.data;
52 	}
53 
setData(int data)54 	public void setData(int data) {
55 		this.data = data;
56 	}
57 
getType()58 	public int getType() {
59 		return this.type;
60 	}
61 
setType(int type)62 	public void setType(int type) {
63 		this.type = type;
64 	}
65 
isNatural()66 	public boolean isNatural(){
67 		return (this.type == TYPE_NATURAL);
68 	}
69 
isArtificial()70 	public boolean isArtificial(){
71 		return (this.type == TYPE_ARTIFICIAL);
72 	}
73 
isTapped()74 	public boolean isTapped(){
75 		return (this.type == TYPE_TAPPED);
76 	}
77 
isPinch()78 	public boolean isPinch(){
79 		return (this.type == TYPE_PINCH);
80 	}
81 
isSemi()82 	public boolean isSemi(){
83 		return (this.type == TYPE_SEMI);
84 	}
85 
clone(TGFactory factory)86 	public TGEffectHarmonic clone(TGFactory factory){
87 		TGEffectHarmonic effect = factory.newEffectHarmonic();
88 		effect.setType(getType());
89 		effect.setData(getData());
90 		return effect;
91 	}
92 
93 }
94