           }
           else
           {
+            // release curve has finished; zero output and reset gate and release times
             cv_current_ = 0.0;
             release_time_ = 0;
             gate_time_ = 0;

    {
      if (gate_)
      {
        uint16_t elapsed = millis() - gate_time_;
        if (elapsed < adsr_values_[env_].A)
        {

  {
    if (retrigger_)
    {
      // update the currently selected envelope (we use the same envelope for the duration of a curve)
      env_ = selected_env_;

      // reset the gate and release times so that the curve logic can execute
      gate_time_ = 0;
      release_time_ = 0;

      // reset to wait for another retrigger
      retrigger_ = false;
    }

