Using millis instead of delay?

edited April 2014 in Questions about Code

I am trying to have two different delays at the beginning and the same delay between each sound on repeat for a project, there is no stop time in this. I tried using delay but it seems to just add the two delays instead of separating them, I was told to use millis(); function but am not sure how to implement this? Any help would be amazing!

import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;



import ddf.minim.*;

Minim minim;
AudioPlayer player;
AudioPlayer player2;

void setup()
{
  size(512, 200, P3D);

   minim = new Minim(this);

  player = minim.loadFile("clapping.mp3");
  player2 = minim.loadFile("bell.mp3");

}

void draw()
{
  background(0);
  stroke(255);

 player1delay();
 player2delay();

}

void delayatstart(){
  millis(4000);
}

void player1delay(){

  delayatstart();
  player.play();
  player.rewind();

}

void delayatstart2(){
 millis(10000); 
}

void player2delay(){

  delayatstart2();
  player2.play();
  player2.rewind();

}

Above is the code I'm trying to use, i replaced my delays with millis and have looked up forums but can't find one to match what I'm looking for!

Answers

Sign In or Register to comment.