Playing unique blade array audio idents on live array switching

The idea is just to cycle → next array → next array yes?
Then plays the appropriate arrayN.wav once switched?

Well I got something working, even though despite many attempts to have it work in conjunction with BLADE_ID_SCAN_MILLIS active, it seems that’s just not going to happen. If the scan result is different than a manually set blade array, it either just takes over or freezes the board :grimacing:

That said, I got it to work.

  • disable #define BLADE_ID_SCAN_MILLIS in the config file.

  • optional - add array.wavs to the font or a common folder, and EFFECT(array) to the prop

  • I ended up making a “FakeFindBladeAgain” that does what normally happens minus the part about getting the best_config. It just uses the manually set current_config.

  • This method totally disregards the resistance argument in the blade arrays. It just strictly cycles through them sequentially.

Here’s what I got in the prop file:


  void NextBladeArray() {
    current_config = blades + (current_config - blades + 1) % NELEM(blades);
    FakeFindBladeAgain();
    // option if no array.wavs used, play font.wav instead
    //  SaberBase::DoNewFont();
    SFX_array.Select(current_config - blades);
    hybrid_font.PlayCommon(&SFX_array);
  }

  // Manual Blade Array Selection version of FindBladeAgain()
  void FakeFindBladeAgain() {
    // Do everything FindBladeAgain() and FindBlade() do, except for recalculating best_config
    ONCEPERBLADE(UNSET_BLADE_STYLE)

#undef DEACTIVATE
#define DEACTIVATE(N) do {                      \
    if (current_config->blade##N)               \
      current_config->blade##N->Deactivate();   \
  } while(0);

    ONCEPERBLADE(DEACTIVATE);
    SaveVolumeIfNeeded();

#undef ACTIVATE
#define ACTIVATE(N) do {                        \
    if (!current_config->blade##N) {            \
      goto bad_blade;                           \
    }                                           \
    current_config->blade##N->Activate(N);      \
  } while(0);

    ONCEPERBLADE(ACTIVATE);
    RestoreGlobalState();

#ifdef SAVE_PRESET
    ResumePreset();
#else
    SetPreset(0, false);
#endif // SAVE_PRESET
    return;

#if NUM_BLADES != 0
  bad_blade:
    ProffieOSErrors::error_in_blade_array();
#endif
  }

Then you just call NextBladeArray() with your button event.
I didn’t bother with a reverse direction. Are there really going to be so many that just cycling through forwards isn’t good enough? Maybe, but I already spent too much overnight playing with this :slight_smile:

Anyway, that was fun.

1 Like