// You can also use rawMidi(byte[] data, String bus_name)

void rawMidi(byte[] data)
{
  int status, chan, value;
  
  println(data.length + " ");
  if (data.length == 3)
  {
      status = data[0];
      chan = data[1];
      value = data[2];
      if (status == -80 && chan == 64)
          master_control = 0;
      if (status == -79 && chan == 64)
          master_control = 1;
      if (status == -78 && chan == 64)
          master_control = 2;
      if (status == -77 && chan == 64)
          master_control = 3;
      if (status == -76 && chan == 64)
          master_control = 4;
      if (status == -75 && chan == 64)
          master_control = 5;
      if (status == -74 && chan == 64)
          intro = !intro;
      if (status == -73 && chan == 64)
      {
          player2.play();
          bruitage_count++;
          if (bruitage_count % 3 == 0)
          {
              player2 = minim.loadFile("decollage_bruitage.mp3");
              player2.setGain(0);
          }
          if (bruitage_count % 3 == 1)
          {
              player2 = minim.loadFile("hypervitesse_bruitage.mp3");
              player2.setGain(-6);
          }
          if (bruitage_count % 3 == 2)
          {
              player2 = minim.loadFile("moteur_shutdown_bruitage.mp3");
              player2.setGain(0);
          }
      }
      
    //if (master_control == 0 || master_control == 1)
        midi_terrain_generation(status, chan, value);
    //if (master_control == 2)
        midi_polyphonic_synth(status, chan, value);
    //if (master_control == 3)
        midi_monophonic_synth(status, chan, value);
    //if (master_control == 3)
    //    midi_newton_fractal(status, chan, value);
      
      println("status " + status + " chan " + chan + " value " + value);
  }
}
