Alt switching smoothswings delay

I am noticing that when switching alt folders containing smoothswing files, the change is not instantaneous due to the way new swing pairs are chosen.
If I follow correctly, hybrid_font updates current_alternative right away and restarts hum, so that changes just fine. But smooth_swing_v2 keeps the two swing loop players running and only re-picks/restarts when swinging is slow enough, plus it has a 1-second anti-repick guard. So during continuous motion, you can stay on old swing loops for a while even though alt already changed.

Adding an SB_EFFECT() override in smooth_swingv2 like this takes care of the issue

  void SB_Effect(EffectType effect, EffectLocation location) override {
    delegate_->SB_Effect(effect, location);
    if (effect == EFFECT_ALT_SOUND && on_) {
      A.Stop();
      B.Stop();
      last_random_ = 0;
      state_ = SwingState::OFF;
      PickRandomSwing();
    }
  }

Does this look ok, or might it cause a problem elsewhere that I’m not considering?

1 Like

I don’t think we want that.
Calling Stop() will make the smoothswing sound stop immediately, which would be pretty noticable I think.

We could make it switch at the next A<->B transition, which generally happens fairly quickly.

1 Like

Yes, that works well, thanks.
Incoming small PR.

1 Like