forked from processing/processing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMix.java
More file actions
42 lines (33 loc) · 888 Bytes
/
Copy pathMix.java
File metadata and controls
42 lines (33 loc) · 888 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package processing.sound;
import processing.core.PApplet;
public class Mix implements SoundObject{
PApplet parent;
private Engine m_engine;
private int m_nodeId[] = {-1,-1};
private int[] m_nodeInIds;
private float[] m_amps;
public Mix(PApplet theParent) {
this.parent = theParent;
parent.registerMethod("dispose", this);
m_engine.setPreferences(theParent, 512, 44100);
m_engine.start();
}
public void play(SoundObject[] input, float[] amps){
m_amps=amps;
for (int i=0; i<input.length; i++) {
int[] returnId = input[i].returnId();
m_nodeInIds[i*2]=returnId[0];
m_nodeInIds[(i*2)+1]=returnId[1];
}
//m_nodeId = m_engine.mixPlay(input.length, m_nodeInIds, amps);
}
public int[] returnId(){
return m_nodeId;
}
public void stop(){
m_engine.synthStop(m_nodeId);
}
public void dispose() {
m_engine.synthStop(m_nodeId);
}
}