FS2004 Gauges to trigger playing sounds

#21
Rob, thanks a lot!

Is it correct that I just add a copy of the code above between <Element> ... </Element> with new LVars - in this case L:ARMED**, L:Altitude**, L:FAMessages** if I want to add some more altitude callouts like 'seat belt sign off', food service onboard, etc?

Well it's a simple logic so is there a way to do it depending on the assigned cruise level? For example the 'seat belt sign off' callout around 5,000-7,000 feet to the cruise level altitude? And food service starts around 5 minutes after reaching cruise altitude?
 

rcbarend

Resource contributor
#22
Yes, that's correct.
Just make sure the Lvars in each section remain unique (where needed).

As to adding other cruise level - derived sounds:
You have the basics working now, so for other callouts I suggest you first do some digging and trial-and-error yourself.
Like there are many threads on how to use timers in XML.

I'm Always willing to help further if you are running into troubles, but you need to get through the learning-curve yourself.
Programming this is just trial-and-error once you understand the basics.
That's how we all learned it …. LoL

Best regards, Rob
 
#23
Programming this is just trial-and-error once you understand the basics.
That's how we all learned it …. LoL
Boy, is that ever right, Rob! :rolleyes:

I've been working on integrating a new TacPack missile onto a plane. Just ONE kind of missile! I've been at it for a few weeks now, and I'm just getting to the "testable" point. This is giving me a splitting headache, too o_O
It seems like every <element.../element> I add to a single gauge doesn't work right the first time. Or maybe the 5th time...

But I am learning XML programming and plane gauges. Steep learning curve, for me, but I'm getting it!
Long, slow, process, but immensely rewarding when I finally get an Element to work correctly. It's a really awesome feeling :cool:

Just wanted to throw that in. Sorry to have intruded.
Pat☺
 
#24
Thanks, guys! Now trying to detect turbulence for a callout 'fasten seat belts' when the seat belt signs are assumed to be off and then to unfasten when the turbulence ends.

It's not 'fool-proof' since I'm trying to link it with an altitude above 10,000 feet during climb or at cursing altitude when the seat belt signs have been already turned off.

Anyway have taken part of the code by Heretic in this thread::
https://www.fsdeveloper.com/forum/threads/any-variable-or-similar-for-turbulence.437593/
XML:
<Element>
    <Select>
      <Value>

      
(E:Absolute Time, seconds) (L:Wind Change Start Time, seconds) - 1 &gt;
if{ (E:Absolute Time, seconds) (>L:Wind Change Start Time, seconds)
(A:AIRSPEED INDICATED, knots) (>L:Airspeed Delayed, number)
(A:VERTICAL SPEED, feet per minute) (>L:Vertical Speed Delayed, number)
}

(A:AIRSPEED INDICATED, knots) (L:Airspeed Delayed, number) - abs 15 &gt;
(A:VERTICAL SPEED, feet per minute) (L:Vertical Speed Delayed, number) - abs 500 &gt;
if{ 1 (>L:TurbulenceON, number)

}


      </Value>
    </Select>
</Element>
Yet it keeps activating L:TurbulenceON again and again. Is there any way to have it play only once and only above 10,000 feet and also play L:TurbulenceOFF when the turbulence stops?

Tried to add (A:Radio Height, feet) 10000 &gt;= to the code and triggers similar to the previous gauge logic but it didn't work.

Any help would be appreciated.
 
#25
Playing triggered sounds is incredible , it's quite neat the effect that can be achieved .

This is just for an example of what can be done , it might be of interest to some to listen to an audio example .
The audio is about 2.5 minutes long of GCA approach guidance triggered from the Synthetic ILS instrument that I created a while ago .

Link is ,
https://www.flightsim.com/vbfs/show...-instrument-For-every-Runway-at-every-Airport

Relevant replies at that thread are ,
Reply # 39 - discusses examples of proposed audio text that might be used .
Reply # 47 - series of screenshots of auto approach control linked to Synthetic ILS instrument .
Reply # 56 - provides a link to the 2.5 min audio .

In my opinion it is rather impressive .

Cheers
Karol
 
#27
Looks like adding the height variable just triggers the sound above 10,000 feet no matter if there is turbulence or not... Well detecting turbulence is way beyond my knowledge so giving it up.
 

ddawson

Resource contributor
#28
Looks like adding the height variable just triggers the sound above 10,000 feet no matter if there is turbulence or not... Well detecting turbulence is way beyond my knowledge so giving it up.
If you've ever taken a statistics course...
If you are in level flight, your average vertical speed will be zero. The standard deviation will also be at or near zero.
In turbulent conditions, your average vertical speed will still be zero, but the standard deviation will be non-zero.
Capturing that in an xml gauge is probably not for the faint of heart...
 
#29
Thanks, Doug! The code above by Heretic looks like really detecting turbulence but I could not have it work for me...

Well decided to make a gauge that will trigger playing boarding/unboarding pax sounds. The idea was that when opening the doors at gate there could heard boarding pax sound looped (and unboarding on arrival) that stops when closed. Then all reset for the next or return flight.

Used some logic Rob suggested for triggering 'Doors to manual'. Will this work:
XML:
<Element>
    <Select>
      <Value>
      
            (* Arming for unboarding on arrival *)
            (A:GROUND VELOCITY,knots) 80 &lt; (L:PREVIOUS GROUND VELOCITY,knots) 80 &gt;=  &amp;&amp;
            if{ 1 (>L:UNBOARDARMED,bool) }
           (A:GROUND VELOCITY,knots) (>L:PREVIOUS GROUND VELOCITY,knots)
    
    (* EXIT Open *)
    (A:EXIT OPEN:0,bool) (A:CIRCUIT AVIONICS ON,bool) &amp;&amp; (L:UNBOARDARMED,bool) &amp;&amp;
    (A:Brake parking position,bool)  &amp;&amp; (L:PlayUnboard,bool) ! &amp;&amp;
    if{ 2 (>L:UnboardSound,number) 1 (>L:PlayUnboard,bool)
    
    } (* play loop until closed *)
    (* EXIT Closed *)
    (A:EXIT OPEN:0,bool) ! (L:UNBOARDARMED,bool) &amp;&amp;
    (A:Brake parking position,bool)  &amp;&amp; (L:PlayUnboard,bool) &amp;&amp;
    if{ 0 (>L:UnboardSound,number) 0 (>L:PlayUnboard,bool)
               0 (>L:UNBOARDARMED,bool)                 (* Unboard reset *)   
    } (* Stop sound *)
      
             (* Arming for boarding *)
             (A:SIM ON GROUND,bool) (A:Brake parking position,bool) &amp;&amp;
             if{ 1 (>L:BOARDARMED,bool) }

    (* EXIT Open *)
    (A:EXIT OPEN:0,bool) (A:CIRCUIT AVIONICS ON,bool) &amp;&amp; (L:BOARDARMED,bool) &amp;&amp;
    (L:PlayBoard,bool) ! &amp;&amp; (L:UNBOARDARMED,bool) ! &amp;&amp;
    if{ 2 (>L:BoardSound,number) 1 (>L:PlayBoard,bool)
    
    } (* play loop until closed *)
    (* EXIT Closed *) 
    (A:EXIT OPEN:0,bool) ! (L:UNBOARDARMED,bool) ! &amp;&amp;
    (L:PlayBoard,bool) &amp;&amp; (L:UNBOARDARMED,bool) ! &amp;&amp;
    if{ 0 (>L:BoardSound,number) 0 (>L:PlayBoard,bool)
               0 (>L:BOARDARMED,bool)                 (* Board reset *)   
    } (* Stop sound *)
      
 
      </Value>
    </Select>
</Element>
 

rcbarend

Resource contributor
#30
You're making this way too complex IMO ...LoL
Not sure why you would use two sounds for board and unboard (noise of footsteps, etc are the same for board and unboard ??) , but a few tips:

The Avar for EXIT OPEN:0 isn't a boolean, but a number varying between 0 and 1 (any value between 0 and 1 , depending on the state of the animation).
Or use percent.
Also, for playing a sound repeatedly, you don't need build in a protection against playing once. Just keep writing the Lvar to 2 at every schedule while the condition is true, and write 0 when false.

So simply use:
Code:
(A:EXIT OPEN:0,percent) 99 &gt;
(A:CIRCUIT AVIONICS ON,bool) &amp;&amp;
(A:Brake parking position,bool)  &amp;&amp;
if{ 2 } els{ 0 } (>L:PaxSound,number)
Rob
 
Last edited:
Top