How can I switch between songs?

edited March 2016 in Library Questions

Hi!

I am currently trying to make a program when my phone moves, some songs will be played on the computer. The client-server thing was not really a problem, but switching between songs is. The idea is that the music will build up in layers and when there is not much movement (when the circle keeps shrinking and eventually has a radius/level of 0), a layer will be deleted again.

This is the part of the code that is not quite correct. The level is the radius of a circle that grows bigger when the phone is moved.

if ((level >= height)) {
    full = true;
  }

  if (full == true) {
    song = song + 1;
  }

  if (level == 0 && full == false) {
    song = song - 1;
  } // this one does not work..

  if (song == 0) {
    layer1.setGain(0);
  }

  if (song == 1 && full == true) {

    layer2.setGain(0);
    layer1.setGain(-500);
    resetCircle();
  }

  if (song == 2 && full == true) {
    layer3.setGain(0);
    layer2.setGain(-500);
    resetCircle();
  }

  time = millis() - minTime;

  if (time >= 80000) {
    layer1.rewind();
    layer2.rewind();
    layer3.rewind();
    minTime += 80000;
  }
}

void resetCircle() {
  level = 1;
  xLevel = 0;
  yLevel = 0;
  zLevel = 0;
  full = false;
}

Thank you in advance

Sign In or Register to comment.