forked from processing/processing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnv.java
More file actions
28 lines (22 loc) · 669 Bytes
/
Copy pathEnv.java
File metadata and controls
28 lines (22 loc) · 669 Bytes
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
package processing.sound;
import processing.core.*;
public class Env {
PApplet parent;
private Engine m_engine;
int[] m_nodeId = {-1, -1};
public Env (PApplet theParent) {
this.parent = theParent;
parent.registerMethod("dispose", this);
m_engine.setPreferences(theParent, 512, 44100);
m_engine.start();
}
public void play(SoundObject input, float attackTime, float sustainTime, float sustainLevel, float releaseTime){
m_nodeId = m_engine.envelopePlay(input.returnId(), attackTime, sustainTime, sustainLevel, releaseTime);
}
public int[] returnId(){
return m_nodeId;
}
public void dispose(){
m_engine.synthStop(m_nodeId);
}
};