how to start audioloop synced to one playing

hi there!

imagine one audioloop playing. now we want to start another loop in sync to the one allready playing. best would be to wait until loop1.timeSamples == 0 again - but how to recognize this?

or is it possible to start another loop from a specific sample?

thx!

Assuming your two audio clips are recorded in sync, you can just start your second audio loop at the same .time that your current audio loop is at.

private AudioSource soundOne;
private AudioSource soundTwo;

Start() {
  soundOne.Play();
}

private void startLoopTwo() {
  if(soundOne.isPlaying){
    soundTwo.time = soundOne.time;
    soundTwo.Play();
  }
}

If you need more precision, you can use time samples...

I haven't actually done this, but this seems to be the way to go about it via: http://unity3d.com/support/documentation/ScriptReference/AudioSource-timeSamples.html

and

http://unity3d.com/support/documentation/ScriptReference/AudioSource.Play.html