-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGensine.java
38 lines (31 loc) · 893 Bytes
/
Gensine.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
public class Gensine extends ModuleAbstract {
private double f;
private int indiceTemps ;
private double amp;
public Gensine(double f,double amp) {
super("Generateur sinusoidal",0,1);
this.indiceTemps=0;
this.f=f;
this.amp = amp;
}
@Override
public void exec() {
double e = (this.amp)*Math.sin((2*3.14*(this.f)*(this.indiceTemps))/(this.SAMPLE_FREQ));
super.setOutpuPortValue(0, e);
if(this.outputPorts[0].isConnected()) { /**Si port de sortie est connecte*/
CommunicationPorts PortModuleAval=this.outputPorts[0].getConnexion().getupModulePort();
PortModuleAval.setValue(e); /**Envoie valeur vers le port du module aval, a l'autre bout de la Connexion*/
}
this.indiceTemps+=1;
}
/**Accesseur*/
public double getFreq(){
return this.f;
}
public double getTime(){
return this.indiceTemps;
}
public double getAmp(){
return this.amp;
}
}