     retrigger = true;
 }
 
+void switch_isr()
+{
+  if(millis() - debounce > DEBOUNCE_MS)
+  {
+    selected_env++;
+    selected_env %= 2;
+    debounce = millis();
+  }
+}
+
 void setup()
 {
-  gate = 0;
+  gate = retrigger = false;
+  selected_env = 0;
+  debounce = 0;
 
   function = new DU_ADSR_Function();
   interface = new DU_ADSR_Interface();

      }
    }

    if(display_changed)
    {
      display->display_all();
      display_changed = false;
    }
  }

 private:
  uint8_t selected;
  int8_t v[4], v_last[4];
  bool display_changed;
  bool saving;
};

DU_ADSR_Function * function;

    else if(gate)
    {
      gate_time = millis()
          - (unsigned long)(-float(adsr_values[env].A) * log(1 - (cv_current / (ENV_PEAK * ENV_SATURATION))));
    }
  }

 private:
  uint8_t env;
  unsigned long gate_time;
  unsigned long release_time;
  float cv_current;
