Skip to content

Commit 731db63

Browse files
committed
added .jump() for SoundFile
1 parent 402e324 commit 731db63

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed
46 Bytes
Binary file not shown.

java/libraries/sound/src/processing/sound/SoundFile.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,25 @@ public void loop(float rate){
109109
m_rate=rate;
110110
this.loop();
111111
}
112+
113+
public void jump(float time){
114+
115+
if(m_nodeId[0]>(-1)){
116+
this.stop();
117+
}
118+
119+
m_cue = (int)time * m_info[1];
120+
121+
if(this.channels() < 2){
122+
m_nodeId = methCla.soundFilePlayMono(m_rate, m_pos, m_amp, m_add, false, m_filePath, this.duration()*(1/m_rate), m_cue);
123+
}
124+
else if(this.channels() == 2){
125+
m_nodeId = methCla.soundFilePlayMulti(m_rate, m_amp, m_add, false, m_filePath, this.duration()*(1/m_rate), m_cue);
126+
}
127+
}
112128

113-
public void cue(int cue){
114-
m_cue = (int)cue * m_info[1];
129+
public void cue(float time){
130+
m_cue = (int)time * m_info[1];
115131
}
116132

117133
private void set(){

0 commit comments

Comments
 (0)