Fixed loop jump() issue

This commit is contained in:
wirsing
2014-07-06 17:47:04 -07:00
parent 251e23dd63
commit a8337dfd13
2 changed files with 25 additions and 6 deletions

View File

@@ -17,6 +17,10 @@ public class Env {
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);

View File

@@ -14,6 +14,7 @@ public class SoundFile implements SoundObject {
float m_add=0;
int m_cue=0;
float m_pos=0;
boolean m_loop;
public SoundFile(PApplet theParent, String path) {
@@ -43,6 +44,7 @@ public class SoundFile implements SoundObject {
}
public void play(){
m_loop=false;
if(this.channels() == 1){
m_nodeId = methCla.soundFilePlayMono(m_rate, m_pos, m_amp, m_add, false, m_filePath, this.duration()*(1/m_rate), m_cue);
}
@@ -77,6 +79,7 @@ public class SoundFile implements SoundObject {
}
public void loop(){
m_loop=true;
if(this.channels() < 2){
m_nodeId = methCla.soundFilePlayMono(m_rate, m_pos, m_amp, m_add, true, m_filePath, this.duration()*(1/m_rate), m_cue);
}
@@ -118,12 +121,24 @@ public class SoundFile implements SoundObject {
m_cue = (int)time * m_info[1];
if(this.channels() < 2){
m_nodeId = methCla.soundFilePlayMono(m_rate, m_pos, m_amp, m_add, false, m_filePath, this.duration()*(1/m_rate), m_cue);
}
else if(this.channels() == 2){
m_nodeId = methCla.soundFilePlayMulti(m_rate, m_amp, m_add, false, m_filePath, this.duration()*(1/m_rate), m_cue);
}
if(m_loop == true) {
if(this.channels() < 2){
m_nodeId = methCla.soundFilePlayMono(m_rate, m_pos, m_amp, m_add, true, m_filePath, this.duration()*(1/m_rate), m_cue);
}
else if(this.channels() == 2){
m_nodeId = methCla.soundFilePlayMulti(m_rate, m_amp, m_add, true, m_filePath, this.duration()*(1/m_rate), m_cue);
}
}
else {
if(this.channels() < 2){
m_nodeId = methCla.soundFilePlayMono(m_rate, m_pos, m_amp, m_add, false, m_filePath, this.duration()*(1/m_rate), m_cue);
}
else if(this.channels() == 2){
m_nodeId = methCla.soundFilePlayMulti(m_rate, m_amp, m_add, false, m_filePath, this.duration()*(1/m_rate), m_cue);
}
}
m_cue = 0;
}
public void cue(float time){