Minim Loop when If(true)

edited October 2016 in Library Questions
import ddf.minim.*;

Minim minim;
AudioPlayer player;

void setup() {
  minim = new Minim(this);
  player = minim.loadFile("alert.mp3");
}

void draw() {
  if (true) {
    player.loop();
  }
}

I want to do when If statement is true let the song loop. But, It always stay at first second, don't go around.

I have tried rewind + play, it has same problem. I want to loop, when If is true.

help me...

Tagged:

Answers

  • Answer ✓

    I already solved it.

    import ddf.minim.*;
    
    Minim minim;
    AudioPlayer player;
    boolean a = true;
    
    void setup() {
      minim = new Minim(this);
      player = minim.loadFile("alert.mp3");
    }
    
    void draw() {
      if (true) {
        player.play();
        if (player.position()>=player.length()) {
          player.rewind();
        }
      }
    }
    
Sign In or Register to comment.