Add pan effect
This commit is contained in:
52
src/uk/co/majenko/audiobookrecorder/Pan.java
Normal file
52
src/uk/co/majenko/audiobookrecorder/Pan.java
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
package uk.co.majenko.audiobookrecorder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Pan implements Effect {
|
||||||
|
double pan;
|
||||||
|
public Pan() {
|
||||||
|
pan = 0.0d;
|
||||||
|
}
|
||||||
|
public Pan(double p) {
|
||||||
|
pan = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "Pan (" + pan + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Effect> getChildEffects() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(Sample[] samples) {
|
||||||
|
for (Sample sample : samples) {
|
||||||
|
if (pan < 0) {
|
||||||
|
double p = 1 + pan;
|
||||||
|
sample.right *= p;
|
||||||
|
} else {
|
||||||
|
double p = 1 - pan;
|
||||||
|
sample.left *= p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPan() {
|
||||||
|
return pan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPan(double p) {
|
||||||
|
pan = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
System.out.println(toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(double sf) {
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user