• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Gauges to trigger playing sounds

Messages
98
Working on a panel that could trigger playing certain sounds automatically under certain aircraft conditions like flight attendant announcements before takeoff and after landing etc.

For example when parking brake is set and engines cut off it should be 'Doors to manual and cross check' etc.

I guess it could be done in connection with Doug Dawson's XML Sound Gauge. Should it be his freeware or payware version?

I'd appreciate if you could give me some leads on where to start.
 
Last edited:
Messages
98
Talk to Doug, but AFAIK if the panel is freeware then so is the sound gauge.

Yes, It would be freeware. Can anybody help me with the correct wording for adjusting the gauge to play an announcement 'Doors to Manual'.

Should I start with values (A:SIM ON GROUND,bool) (A:GROUND VELOCITY,knots)?

I'm not actually a programmer and sometimes XML wording and logic is difficult for me to understand.

That's why I'd appreciate your help.
 
Messages
913
Country
indonesia
show up your part of code that you working at, then some expert guys will correct it

note:
please use "insert Code" for code programming for easier when reading in this forum thread
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
And we would need to know exactly the conditions when you want the sound to play. On the ground and a specific velocity is not enough.
 
Messages
205
Country
netherlandsantilles
All said above is true, but it goes like this to start with:
Code:
(A:SIM ON GROUND,bool) (A:GROUND VELOCITY,knots) 0 == and if{play sound}

you set first your conditions (plane on ground, and standing still etc etc) and than you condition what will be done, in this case playing the sound you want.
But you need to learn some basic for coding in XML. Look for the tutorials wide available or search through the forum for a mine of code examples, that is how I started.
Best luck.
Adino
 
Messages
98
Thanks, guys!

Well the conditions are plane on ground, engines running, and parking brake set.

Is there a way to use the above only after landing? Is it possible to use them with Fuel Consumption or whatever so it will sound only if parking brake is set only after landing?

Anyway I started with the following:

Park_xml_sound.ini
Code:
[Config]
MaxSounds=1
GlobalCommands=DSDGlobals
ErrorFlag=0
LvarStop=SoundStop

[Sounds]
Sound00=Sound\Park\park.wav

[LVars]
Lvar00=Park

Park.xml
XML:
<Gauge Name="Park" Version="1.0">
<Element>
    <Select>
      <Value>
            (A:SIM ON GROUND,bool) (A:GROUND VELOCITY,knots) 0 &gt; &amp;&amp;
            (A:Brake parking position,Bool) (A:Master Ignition Switch,bool) || &amp;&amp;
          
            if{ (L:Park,number) 0 ==
              if{ 1 (>L:Park,number)
            }
            els{ 0 (>L:Park,number) }
      </Value>
    </Select>
</Element>
</Gauge>

and panel.cfg Window00 and VirtualCockpit00 entries:

Code:
gauge98=Park!Park, 2,2,2,2
gauge99=Park_xml_sound!Park_xml_sound, 2,2,3,3,./Sound/Park/Park_xml_sound.ini

Didn't test it yet, not sure if all is fine with wording, syntax, and logic also.
 
Last edited:

ddawson

Resource contributor
Messages
862
Country
canada
Park_xml_sound.ini
Code:
[Config]
MaxSounds=1
GlobalCommands=DSDGlobals
ErrorFlag=0
LvarStop=SoundStop
[Sounds]
Sound00=Sound\Park\park.wav

[LVars]
Lvar00=Park

and panel.cfg Window00 and VirtualCockpit00 entries:

Code:
gauge98=Park!Park, 2,2,2,2
gauge99=Park_xml_sound!Park_xml_sound, 2,2,3,3,./Sound/Park/Park_xml_sound.ini

Your path to the sound file is not the same as the path to the config file (no leading 'dot'). Is this what you intended?
Also, you can rename the sound gauge itself if you wish, but you can't change the internal gauge name (the part after the '!' character in the panel.cfg entry.
You will need:
gauge99=Park_xml_sound!sound, 2,2,3,3,./Sound/Park/Park_xml_sound.ini
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
Code:
<Gauge Name="Park" Version="1.0">
<Element>
    <Select>
      <Value>
            (A:SIM ON GROUND,bool) (A:GROUND VELOCITY,knots) 0 ">&gt; &amp;&amp;
            (A:Brake parking position,Bool) (A:Master Ignition Switch,bool) || &amp;&amp;
         
            if{ (L:Park,number) 0 ==
              if{ 1 (>L:Park,number)
            }
            els{ 0 (>L:Park,number) }
      </Value>
    </Select>
</Element>
</Gauge>
That doesn't work.

First, GroundVelocity > 0 and ParkingBrakes On are conflicting conditions. I assume you want the sound to be played when GroundVelocity = 0 ?
Secondly, the XML sound gauge automaticallyy set the Lvar Park to zero when the sound has finished playing.

You need to find a condition that plays the sound only once when the ParkingBrakes are being set, but ONLY after the aircraft has been moving and has stopped again.

So something like;
Code:
<Gauge Name="Park" Version="1.0">
<Element>
    <Select>
      <Value>
            (* Set the Lvar ARMED when the aircaft stops moving  *)
            (A:GROUND VELOCITY,knots) 0.1 &lt; (L:PREVIOUS GROUND VELOCITY,knots) 0.1 &gt;=  &amp;&amp;
            if{ 1 (>L:ARMED,bool) }
           (A:GROUND VELOCITY,knots)  (>L:PREVIOUS GROUND VELOCITY,knots)

            (* Play the sound when ARMED and ParkingBrakes are set *)
            (A:Brake parking position,bool)  (L:ARMED,bool)  &amp;&amp;
            if{
               1 (>L:Park,number)
               0 (>L:ARMED,bool)                 (* Resets the Lvar so the sound is played once Only untill is has moved again *)
            }
      </Value>
    </Select>
</Element>
</Gauge>
 
Messages
98
Doug, Rob, thank you guys for your help and corrections!

Tested it with the default b737 and it looks like Rob's version needs more instructions. It works when I load a saved flight with engines running and it doesn't when loading cold and dark.

Any clues?
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
Doug, Rob, thank you guys for your help and corrections!

Tested it with the default b737 and it looks like Rob's version needs more instructions. It works when I load a saved flight with engines running and it doesn't when loading cold and dark.

Any clues?
Are you sure the gauge is defined in a VCockpit section ???
Because when defined in a 2D Window section, the gauge won't be running untill the Window it's defined in, has been opened at least once.

There's nothing in the gauge that relates to the engines state.

Rob
 
Messages
98
Thanks, Rob!

Code:
gauge98=Park!Park, 2,2,2,2
gauge99=Park_xml_sound!sound, 2,2,3,3,./Sound/Park/Park_xml_sound.ini

That's what I added to both [Window00] and [Vcockpit01] sections of the default b737. Somehow it works only for the loaded saved flight.

Maybe the problem was that I loaded the 2D panel first. In my saved flight it is the VC. I'll try VC first.
 
Last edited:

rcbarend

Resource contributor
Messages
435
Country
netherlands
Thanks, Rob!

Code:
gauge98=Park!Park, 2,2,2,2
gauge99=Park_xml_sound!sound, 2,2,3,3,./Sound/Park/Park_xml_sound.ini

That's what I added to both [Window00] and [Vcockpit01] sections of the default b737. Somehow it works only for the loaded saved flight.

Maybe the problem was that I loaded the 2D panel first. In my saved flight it is the VC. I'll try VC first.
If this problem persists: sorry, no clue why.

That said: having the gauge (any non-bitmap XML gauge) defined in both a 2D and a VC window is pointless; Always define in a VC section for initial load reasons.
Although, as far as I know, double definition doesn't do any harm either since (guessing here) the gauge is loaded only once. That is, in FSX. Not sure about FS9.

Rob
 
Messages
98
Thank you, Rob! Well it works when I start in VC. When the 2D panel is loaded first it won't work neither in 2D nor in VC. However when in 2D I noticed there's something happening with the sound (sound is interrupted).

Also have to add some instructions to have it work only upon gate arrival since it now works after pushback and anytime parking brake is set before takeoff.

I don't know if a timer trigger would be a good idea with (P:local time, seconds) or (E:ABSOLUTE TIME. Seconds) so it would work only after a certain period of time during the flight...

Or I would better look into fuel consumption, any suggestions?
 

ddawson

Resource contributor
Messages
862
Country
canada
[QUOTE="Harrier Panels, post: 809380, member: 19838"
...
Or I would better look into fuel consumption, any suggestions?
[/QUOTE]
Your best bet for something like that is probably to measure if the aircraft has been in flight. Check your altitude above ground and if it exceeds, say, 1000 feet, set and enabling flag to true.
When the sound gets played, set the enabling flag back to false.
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
Your best bet for something like that is probably to measure if the aircraft has been in flight. Check your altitude above ground and if it exceeds, say, 1000 feet, set and enabling flag to true.
When the sound gets played, set the enabling flag back to false.
Hey Doug,
What about an aircraft that has to taxi back to the gate and offload the passengers ?? LoL

More seriously (to the OP):
If you want to perfect such a gauge to give such automated callouts only when needed, you first have to make a full specification of all possible ground movements and engine states, and decide when/when not to give the automated callout.
Programming the related conditions, using Avars and states, isn't the problem !!

By the way, you can solve the undesired callout because the sound is "armed" after a Pushback, by using e.g. 5 Knots as threshold instead of 0.1, or use (A:VELOCITY BODY Z,knots) instead of (A:GROUND VELOCITY,Knots).
Note: GROUND VELOCITY only gives a zero or positive number, whereas VELOCITY BODY Z gives the actual longitudinal speed relative to the earth surface (so can be negative, as in a Pushback).
But that won't work properly after an aircraft is towed with engines Off (although towing usually isn't done with passengers aboard).

And to elaborate further (just playing the devil's advocate here ...LoL): there's no point in an automated callout 'Doors to manual and cross check' if there hadn't been a callout 'Doors to automatic and cross check' (or alike) first.
You can make this as complex as you want, but I can assure you that you can never get this "fool-proof" .

Another suggestion: why not initiate such callouts manually (e.g. clicking a switch in a panel window) ??
After all, a callout like 'Doors to manual and cross check' isn't automated in real-life; it's the captain's/co-pilot intelligence (based on checklists and actual states) when such a callout is appropriate.

Hope you see my points ….

Cheers, Rob
 
Messages
98
Thanks, guys! Changed velocity to 80 and deleted entries from 2D panel. Probably they interfered with VC's. Now it works in both VC and 2D.
 
Messages
98
I also need a gauge to give callouts at a certain altitude. For example at around 2,000 feet to hear a flight attendant say something like 'It is now safe to use your electronic devices... etc'. Will this work:
XML:
<Element>
    <Select>
      <Value>
            (* Arming Lvar when reaching 2000 feet *)
            (A:Radio Height, feet) 2000 &gt; = (L:Altitude, number) 2000 &lt; &amp;&amp;
            if{ 1 (>L:ARMED,bool) }
           (A:Radio Height, feet)  (>L:Altitude, number)

            (* Play the sound when ARMED *)
            (L:ARMED,bool) 
            if{
               1 (>L:FAMessages,number)
               0 (>L:ARMED,bool)                 (* Lvar Reset *)
            }
      </Value>
    </Select>
</Element>
Could I combine it with the previous gauge or better make a separate?

Any help appreciated.
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
You would need to remove the space between &gt ; and the = sign (and no space between the t and the ; ).
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
I also need a gauge to give callouts at a certain altitude. For example at around 2,000 feet to hear a flight attendant say something like 'It is now safe to use your electronic devices... etc'. Will this work:
XML:
<Element>
    <Select>
      <Value>
            (* Arming Lvar when reaching 2000 feet *)
            (A:Radio Height, feet) 2000 &gt; = (L:Altitude, number) 2000 &lt; &amp;&amp;
            if{ 1 (>L:ARMED,bool) }
           (A:Radio Height, feet)  (>L:Altitude, number)

            (* Play the sound when ARMED *)
            (L:ARMED,bool)
            if{
               1 (>L:FAMessages,number)
               0 (>L:ARMED,bool)                 (* Lvar Reset *)
            }
      </Value>
    </Select>
</Element>
Could I combine it with the previous gauge or better make a separate?

Any help appreciated.
You don't need an ARMED state here, because you only play the sound once when you ascend through 2000 ft
So the code:
Code:
<Element>
    <Select>
      <Value>
            (* Play the sound when reaching 2000 feet *)
            (A:Radio Height, feet) 2000 &gt;= (L:Altitude, number) 2000 &lt; &amp;&amp;
            if{ 1 (>L:FAMessages,number) }
            (A:Radio Height, feet)  (>L:Altitude, number)

     </Value>
    </Select>
</Element>

Note on your code above: there should be NO spacecharacter in &gt;= ….. You used &gt;SPACE=
And Yes, just place all of such callouts it in the same gauge (that's what I would do anyway)

As a sidenote:
The code will work, but actually is too simple (as the other example):
- When you load a flight with the aircraft in the air above 2000 ft, the sound will play too (because the Lvar Altitude initially is 0
- When you are flying low over rough terrain during the ascend, you may hear the sound multiple times, because (even if you are in a climb), RA may drop below 2000 ft. Eg. because you climb out over a high, steep mountain.

But these problems could be solved again with another ARMED var, which is set when you are on the ground., and reset when the sound has been played once.
WIth code like:

Code:
<Element>
    <Select>
      <Value>
            (* Arming Lvar when on the ground *)
           (A:SIM ON GROUND,bool)
           if{ 1 (>L:ARMED1,bool) }

           (* Play sound once when armed and ascending through 2000 feet the first time *)
            (L:ARMED1,bool)  (A:Radio Height, feet) 2000 &gt;=  &amp;&amp;  (L:Altitude, number) 2000 &lt; &amp;&amp;
            if{
               1 (>L:FAMessages,number)
               0 (>L:ARMED1,bool)                 (* Lvar Reset *)
            }

            (* Save previous RadioHeight *)
            (A:Radio Height, feet)  (>L:Altitude, number)

     </Value>
    </Select>
</Element>

Again, like in the other Doors example, the trick is not to play a sound at the right moment in a simple flight procedure, but finding/programming the exceptions where it should NOT be played.
And if I would think about this more, I could probably find other exceptions where you don't want to play this sound.... LoL
It's just how far you want to go, and how much effort you want to spend in making it "fool-proof"

As an example: I once created a rather fancy, generic GPWS gauge, but it took me quite a few iterations to program even a simple, but fool-proof condition to establish if the aircraft (when flying) is in TakeOff mode, CruiseFLight mode or Approach/Land mode.
Using criteria like gear, flaps, thrust, altitude, Toga setting, etc... And I still know "holes" in that logic.
Almost as if are programming a FMC.

But if you are really serious about creating a lot of such automated cabin announcements: I think there are allready addons outthere that do exactly what you want.
Success with your codings ...

Cheers, Rob
 
Top