@@ -14,6 +14,7 @@ public class SoundFile implements SoundObject {
1414 float m_add =0 ;
1515 int m_cue =0 ;
1616 float m_pos =0 ;
17+ boolean m_loop ;
1718
1819
1920 public SoundFile (PApplet theParent , String path ) {
@@ -43,6 +44,7 @@ public float duration(){
4344 }
4445
4546 public void play (){
47+ m_loop =false ;
4648 if (this .channels () == 1 ){
4749 m_nodeId = methCla .soundFilePlayMono (m_rate , m_pos , m_amp , m_add , false , m_filePath , this .duration ()*(1 /m_rate ), m_cue );
4850 }
@@ -77,6 +79,7 @@ public void play(float rate){
7779 }
7880
7981 public void loop (){
82+ m_loop =true ;
8083 if (this .channels () < 2 ){
8184 m_nodeId = methCla .soundFilePlayMono (m_rate , m_pos , m_amp , m_add , true , m_filePath , this .duration ()*(1 /m_rate ), m_cue );
8285 }
@@ -118,12 +121,24 @@ public void jump(float time){
118121
119122 m_cue = (int )time * m_info [1 ];
120123
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- }
124+ if (m_loop == true ) {
125+ if (this .channels () < 2 ){
126+ m_nodeId = methCla .soundFilePlayMono (m_rate , m_pos , m_amp , m_add , true , m_filePath , this .duration ()*(1 /m_rate ), m_cue );
127+ }
128+ else if (this .channels () == 2 ){
129+ m_nodeId = methCla .soundFilePlayMulti (m_rate , m_amp , m_add , true , m_filePath , this .duration ()*(1 /m_rate ), m_cue );
130+ }
131+ }
132+ else {
133+ if (this .channels () < 2 ){
134+ m_nodeId = methCla .soundFilePlayMono (m_rate , m_pos , m_amp , m_add , false , m_filePath , this .duration ()*(1 /m_rate ), m_cue );
135+ }
136+ else if (this .channels () == 2 ){
137+ m_nodeId = methCla .soundFilePlayMulti (m_rate , m_amp , m_add , false , m_filePath , this .duration ()*(1 /m_rate ), m_cue );
138+ }
139+ }
140+
141+ m_cue = 0 ;
127142 }
128143
129144 public void cue (float time ){
0 commit comments