Limit range of random selected wavs?

I am looking at fine tuning the use of paired sounds, particularly preon->out.
My example is a Dooku font, with dialog from the fight with Anakin and Obi-wan.
I have
preon01.wav = “As you see bla bla bla, now, back down.”
out01.wav = ignition sound mixed with Obi-Wan’s reply " I don’t think so."

preon02.wav = " It is obvious bla bla bla knowledge of force…"
out02.wav = “…but with our skills with a lightsaber”

preon03 and 04 are just a short silence,
with the corresponding out03 and 04 just pure ignition sound.

It is super cool and really flows well.
So the trick now is to avoid any out.wav that contains dialog when using FastOn().

If it were just a single file that was dialog-free, I could just set that file to always be 01 and then add SFX_PREON.Select(0) to the case in the prop, but I’d like to keep the variety of 2 or 3 other ignitions for use with FastOn().

So the question is how could we allow for a range of files to be specified, something like SFX_EFFECT.Select(N1,N2,N3)
or
SFX_EFFECT.Select(N1) || SFX_EFFECT.Select(N2)
?

In my OS7 library you can do this by simply setting Special Ability (5 ~ 8) for “Play Sound > Ignite” then select “Specific Quote” and enter the number, you can also set a unique ignition animation/time to each, this way it’s controlled at the style level using quote instead of preon. It will require my prop but the Special Abilities were set up specifically for scenarios like above :wink:

How could it play quote for preon if the saber is not on yet? (granted, I’m asking this before looking at it)

That’s one of the many things Special Abilities enable via my prop :wink:. Special Ability 5 ~ 8 run while off.

Override FastOn() in your Prop, then call SFX_out.Select(random(2) + 2) ?

Cool that works, thanks for the syntax. Wouldn’t have guessed that more than a digit could go in there.
A couple of notes on this:

  • Doesn’t want override FastOn()' marked 'override', but does not override. Works without it though.
  • Needs to reset back to Select(-1) after calling TurnOn() else it messes up pairing.
  • Seems like NO_REPEAT_RANDOM doesn’t work for this method, getting many back-to-back repeats of the same sound.

Additionally, I used a font_config variable to set the values and that works well so it can be a per-font setting.

  void FastOn() {
    SFX_out.Select(random(font_config.ProffieOSNumRandomWavs) + font_config.ProffieOSRandomWavsStartingValue);
    SaberBase::TurnOn();
    SaberBase::DoEffect(EFFECT_FAST_ON, 0);
    SFX_out.Select(-1);
  }
# Useful for FastOn() calling silent out.wavs and using faston.wav instead.
# Or, when using pairing preon->out, then using matched dialog in preon and out
# files numbered lower than this number, with dialog-free out.wavs specified with this setting.
# Default is -1 so all randomly chosen.
# How many files to play randomly:
ProffieOSNumRandomWavs=3

# Sets which file number to start at for the set of randomly played sound selection set 
# with ProffieOSNumRandomWavs. Offset by -1.
ProffieOSRandomWavsStartingValue=3

# Examples:
# ProffieOSNumRandomWavs=1
# ProffieOSRandomWavsStartingValue=4
# Result: file 5 only used
#
# ProffieOSNumRandomWavs=2
# ProffieOSRandomWavsStartingValue=2
# Result: files 3 and 4 used
#
# ProffieOSNumRandomWavs=3
# ProffieOSRandomWavsStartingValue=4
# Result: files 5, 6, and 7 used

The key is that the Select() call has to happen every faston to pick a new random sound. If you put that somewhere that only gets executed once, then it won’t work, because it won’t actually be random.

You should probably mark FastOn() in prop_base.h as virtual

Guess you’ll need to override TurnOn() too then?

Yes, in this case, FastOn() is selecting which sound to play. If you don’t want it to be the same sound, you’ll need to keep track of the last one and avoid using it again.

Which is fine for personal use, but I don’t think we can check that in to the main branch.

1 Like