Jetpack prop update and questions

Good evening,

I finally started testing my jetpack_Oli_buttons.h
I found and corrected some bugs:

  • some were user errors: I was not doing the buttons sequences correctly.
  • some were in my soundfont: too many looping sounds options.
  • some were and more are in my code:
    • my looping sounds (idlemode and flightmode) don’t always stop when they should

So the sequence is: OFF (no sound), startidlemode, idlemode (looping), then

  • if you do nothing within 60 seconds of startidlemode, the jetpack is supposed to turn off. The blade turns off but idlemode keeps playing indefinitely until I hit the kill switch or change preset.
  • if you press pow button one more time, idlemode stops, startflightmode starts, plays flightmode (looping)
  • next pow press start stopflightmode and should (but doesn’t) stop flightmode (looping). idlemode should restart after stopflightmode but doesn’t.

The full sequence should be: off, startidlemode, idlemode (looping), startflightmode, flightmode (looping), stopflightmode, idlemode (looping), stopidlemode, off. The transitions start/stop…xyz…mode play when they should but don’t always stop the looping sounds from playing.

The question is: how can I stop a looping sound? Or how can I stop idlemode.wav & flightmode.wav?

Just in case one of you wants to try it:

1 Like

I remember that happening during development. Im not sure if you’ve kept up with the OS8 updates, but we ironed out a working "idle wav” that behaves as expected (including stopping when you want it to.
You can see how my prop calls it for inspiration.

Sounds like you can just utilize existing implementation for your idle sound and it sounds like flight mode works like hum.

You find the wav player that is is playing the sound, then call set_fade_time() on it, then call FadeAndStop() on it.

both idlemode and flightmode works like hum and I am 100% up to date with latest ProffieOS.

saber or blaster ? and what is “the tick sound” you speak of in your saber comments ?

Sorry @profezzorn, I don’t know how to do that. Where can I find an example of this?

This is why I said you could look through my prop. Yes I meant saber.

I did look, but I can’t see/find/understand where? You don’t have a set_fade_time or a FadeAndStop and when searching for idle in your saber, all I find is `hybrid_font.StopIdleSound().

If that is it, I don’t understand how to apply it to idlemode.wav or flightmode.wav ? Idle, in my jetpack case, is an engine power level, I could have called it “lowestpower” and flightmode can be called “highestpower”.

A saber idle is my “off state” (the cockpit is powered and humming but the engines are not running, just like a crystal chamber is on and low glow but the saber is off) and I have 2 “on state” on the jetpack, low and high (a jet engine has 100ish, well more like 75ish levels because off is 0% and idle power is around 25% and between 0 and 25% it is just engine starting).

Once I get my hands on a rotary encoder, I will try to code for as many “on state” as the rotary encoder can allow without having to count clicks between 25 and 100 because I doubt it would be a fun user experience.

My apologies, I feel frustrated at the moment. I have been working at this prop for months and I worry about the ProffieOS8.x.beta “window” closing before I can finish.

Don’t let a deadline frustrate you or cause you to rush coding (and understanding while doing it).
These things (especially with the size of what you’re building) take time. (some things have taken a year or more).

Well it’s in hybrid_font then.

Look:

  void StopIdleSound() {
#ifdef ENABLE_IDLE_SOUND
    RefPtr<BufferedWavPlayer> idlePlayer = GetWavPlayerPlaying(&SFX_idle);
    if (idlePlayer) {
      idlePlayer->set_fade_time(0.5);
      idlePlayer->FadeAndStop();
      idlePlayer.Free();
      PVLOG_NORMAL << "**** Stopped idle wav\n";
      }
#endif

So since that’s for your “off state”, you can use it as-is?

As far as the other states, it sounds like alt-sounds would be a way to handle those, no?

1 Like

off = idle.wav
startidlemode = alt000/out.wav
idlemode (looping) = alt000/hum
startflightmode = alt001/tr.wav or altchng.wav or chhum.wav
flightmode (looping) = alt001 hum.wav
stopflightmode = alt001 altchng.wav
idlemode (looping) = back to alt000/hum
stopidlemode = alt000/in.wav
off = idle.wav

That function in hybrid_font was very helpful to understand what I needed to do. Thank you very much. I adapted it to solve my non-stopping looping sounds.

I don’t think I want to go the alt-sounds route for different engine power levels. I would like to use the alt-sounds for different engine types (Paz-Visla, Bo-Katan, Mando,…). I know that is what presets are for but I would like to use the different presets for different ships type: jetpack, tie, xwing, millenium falcon, …

Maybe I am just over complicating this ? What do you guys think ?

Wouldn’t that just be different fonts?

That is what I meant on the next line:

I would like to keep some hierarchy in the “engines”:

  • presets/fonts for “ship type”
  • alt sounds for different characters with identical ships
  • category for different engine power settings.

I do not want to mix engine sound names with lightsaber sound names because I find that very confusing. I am sure many others will find it confusing too! And I know @profezzorn what you told me before:

But nobody thinks “why is he raising a faucet knob” when someone raises a lightsaber! :rofl:
A lightsaber is recognizable not matter what kind of (plumbing or other) parts you use.

But I can clearly visualize “Why is my jetpack making lightsaber sounds” and vice-versa when file names are “recycled”! I mean blasters have their own uniquely named sound effects, so does the detonator. So why can’t a jetpack (or other flying craft) have it’s own uniquely named sounds too?

Ultimately, I would like to code my jetpack prop to use a rotary encoder with up to 10 positions, from 0 to 9, where OFF state would be -1, lowest idle power would be 0, 9 would be max power and 1 to 8 everything in between just like a thrust lever does on jet engine. I am worried that using Alt-sounds might make that much harder or impossible to achieve?

In summary, I am worried about future backward compatibility issues that might get me stuck in a corner if I start using lightsabers Alt-sounds.

Yes it seems like a good enough solution for now with only two trust levels but will it stay that simple with 10ish trust levels ? And how would the transitions between two non-consecutive power levels work ? Like: say I want to go from 8 to 3 in one move with one transition. Will Alt-sounds be able to do that? I don’t think so, or am I wrong?

The style code can jump to any alt folder you want. There’s no need to go sequentially.
However, your rotary encoder would go sequentially though, so how would you plan to go from 8 to 3 without using the blade style?

I hadn’t thought that far yet, but I guess I would need to write code that would only play the “in-between” transitions without starting the looping sounds in between each transitions.

So from 8to3: transitions for 8to7, linked to 7to6, linked to 6to5, … all the way to 3.

Transitions would have to be short. A jet engine takes about 10 to 15 seconds to go from idle to takeoff power so I would need each transitions to be 1 to 1.5 sec long on average.

The slow power transitions (1 to 5) are usually longer and the higher ones (6 to 10) are much more reactive.

A jet engine takes 8 seconds to go from 30% (idle in flight) to 60%. That is why when an airplane lands, the engines must be at around 60% power so in case of go-around or low level wind-shear, the plane will start going back-up within a second or two instead of keep going down for 8 seconds.

You can do what you want of course, but let me give you my two cents, I would:

  1. use presets for both ship and character.
  2. use alt sounds for different modes, like flying, idling, fighting, whatever.
  3. Use file numbers for engine power settings (not sure if that’s what you meant by “category”)

Alternatively, if you don’t need different modes. (or on, off and lockup is enough), then you could use the alt mode for engine power.

  1. I am starting to get that.

    1. I would like to eventually have 7 to 10ish engine power levels (lets call them “modes” if you want) with the ability to go from non consecutive ones in a single “move” of a rotary encoder (just like a thrust lever would do on an airplane).

With that in mind, do you @profezzorn & @NoSloppy still believe that Alt-sounds is the right way to go for my project ? I can only see on having to count “clicks” and wait while going from +1 to the next +1 power level (or mode) rather than being able to do +3 or +5 or -8 in one move?

I haven’t thought about it in-depth, but alt sounds are generally best when it changes the whole operation of how the prop works, because alt sounds can potentially affect ALL the sounds.
A sound like engine power seems like it would just affect the hum sound to me, and you wouldn’t need an alt mode for that.

Exactly, I will need many “hums” and many more “transitions” between any combination of “hums” consecutive or not.

For 2 hums, I need 2 transitions (Alt mode can do that, no problem)
For 3 hums, I need 6 transitions
For 4 hums, I need 12 transitions
For 5 hums, I need 20 transitions

It is “exponential” and Alt mode is not the way to go. I will need to find a way to join the transitions together. 10 modes, 9 transitions up, 9 transitions down, and for going from mode2 to mode8 it would be mode2+6 ‘up’ transitions “stitched together” (gap-less), and for going from mode8 to mode4 it would be mode8-4 ‘down’ transitions, …

I will eventually figure it out but it would be an upgrade of my prop for POS9.x or 10.x! Hopefully.

square

Are you sure you need all those transitions though?
Wouldn’t it be enough to just fade out one hum and fade in another?

Alt mode can actually provide NxN transitions for the hum using the chhum sound: