FS2004 Gauges to trigger playing sounds

#41
Now I want the gauge to play a message to turn off the seat belt sign before reaching or at cruise level altitude. Is there a way for an XML gauge to get it from the flight plan? Or at least to detect an airplane does not climb for a few minutes.

The next step would be a descent...
 
#44
Maybe it could be in connection with (A:Radio Height, feet) and (C:fs9gps:FlightPlanCruisingAltitude, meters) ... maybe something like deduction - compared to zero 0
 
Last edited:
#46
Yes something I learned here is always good thing to check conditions first to avoid overloading the cpu..
Basically a simple way to achieve your objective, is to check wether you're about to reach the cruising altitude by subtracting your plane altitude from the cruising altitude and checking the result against an altitude offset. Like say if your cruisalt=15000 ft and you want to play the sound at 200 ft before reaching cruisalt, you could take:
cruisealt - plane alt =>alt delta and then compare alt delta with 200ft. if it is the same or less you play the seatbelt sound and then reset all conditions. You will have to do some trial and error, there are several other more clever ways in doing the same thing just keep trying you will be ok, it is fun!;)
 
#47
Another possibility could be to use the A:var

VELOCITY BODY Y True vertical speed, relative to aircraft axis Feet per second

Like when that slows below a certain point, play the seat belt sound. You'd have to test to make sure that it was positive, so that it would only play the sound when slowing down in an upward direction, you see? You wouldn't want the seat belt sound to play just before you landed, after all ;)

Just a thought. I get so few of them...:scratchch
Pat☺
 
#48
Thanks, guys! Done! Didn't check if it's Active Flight Plan though. Now gonna work with descent & approach.

Done so far and planned / in progress:
  1. Embarking / Disembarking Pax
  2. Boarding Music - in progress ...
  3. F/A Welcome message (while pax boarding) - planned ...
  4. F/A Doors to Armed and Cross Check (boarding done) - planned ...
  5. F/A Welcome message (boarding done) - planned ...
  6. F/A Safety message (start taxiing) - planned ...
  7. F/A message Aircraft ready for Takeoff (hold short line) - planned ...
  8. FO or Cpt. 'Prepare for Takeoff' message - planned ...
  9. F/A Message 'Remain seated' (or whatever, at 3,000 ft )
  10. F/A Meal Service (at 10, 000 ft)
  11. F/A Unfasten seat belts (before reaching cruising altitude)
  12. F/A Fasten seat belts (descent) - planned ....
  13. F/A Aircraft ready to land (final) - planned ...
  14. FO or Cpt. 'Prepare for Landing' message - planned ...
  15. F/A Landing message - planned ...
  16. F/A Message 'Remain seated' (stop during taxi)
  17. F/A Message 'Doors to Manual' (gate arrival)
Optionally would like to add Apply Brakes sound. I guess Rob has done it perfectly, will add it if he allows me to. Messages 7,8 and 13,14 could be combined in one sound file each pair.

And the Turbulence 'Seat Belts ON/OFF' messages are still an open question.

Would appreciate any suggestions or comments
 
Last edited:
#49
I need a timer to delay playing a certain sound when triggered. I used the following:

XML:
    (A:SOME EVENT,bool)
    if{ 1 (>L:ARMED1,bool) }
    (A:SOME EVENT2,bool) (L:ARMED1,bool) &&
       if{
     (L:Timer,number) 0 ==
     if{
     (E:ABSOLUTE TIME,seconds) (>L:Timer,number)
        1 (>L:ARMED2,bool)  <!-- Trigger Timer -->
        }
     (E:ABSOLUTE TIME,seconds) (L:Timer,number)  5 + &gt;
     (L:ARMED2,bool) &amp;&amp;          <!-- delay 5 sec -->
    if{
               1 (>L:PlaySound,number)
               0 (>L:ARMED2,bool)               
               0 (>L:ARMED1,bool)
               0 (>L:Timer,number)
            }
    
    }
Yet it plays with no delay. Any clues?
 

rcbarend

Resource contributor
#50
I can think of several reasons why the sound won't play at all (like when SOME EVENT2 becomes false again BEFORE the 5 seconds elapse), but I can see NO way how it could play without the delay.

Maybe post the REAL code you use since (A:SOME EVENT,bool) etc. has no meaning and you may have coded something wrong in the real conditions you use.
Also: you ARE sure, that the used Lvars aren't used in any other part of the gauge (or in any other gauge in that panel) ???

Last note: if you copy code samples, make sure the indentation makes sence ...LoL
I had a hard time trying to figure out to which "if" clause the } characters where ment.

Rob
 
#51
figure out to which "if" clause the } characters where ment.
Now it's fine, thanks! It was too much IF's :)

Well now I need to play boarding music, it should stop say in 2 minutes, then the welcome message is played, and then the music resumes playing. All that should be in a loop until the doors are closed.

The simple way is to have it played in one sound file but I'm wondering if it is possible to play a sequence of 3 sound files in a loop - boarding music 1st part, the welcome message, the 2nd part.

I guess a sound file could not be resumed from where it stopped using Doug's XML Sound Gauge. So I decided to make the sequence. Is it possible?

Thanks
 

rcbarend

Resource contributor
#52
Yes, possible.
But if you really want to play 3 files in sequence and then repeat this sequence untill you explicitely stop it, it's easier to make one sound file with the three files concatenated.

- You cannot resume a stopped file.
- To start one file when a previous one has finished: just check if the Lvar of the previous file goes from 1 to 0 n … (The Soundgauge resets an Lvar when the sound has finished)

Rob
 

ddawson

Resource contributor
#53
...
- You cannot resume a stopped file.
- To start one file when a previous one has finished: just check if the Lvar of the previous file goes from 1 to 0 n … (The Soundgauge resets an Lvar when the sound has finished)
Rob
That is actually a feature that would be easy to add - DirectSound has the option to reset the position or not. I'll just add another possible value for the control var.
 
#56
Done so far and planned / in progress:

  1. Embarking / Disembarking Pax
  2. Boarding Music
  3. F/A Welcome message (while pax boarding)
  4. F/A Doors to Armed and Cross Check (boarding done)
  5. F/A Welcome message (boarding done)
  6. F/A Safety message (start taxiing)
  7. F/A message Aircraft ready for Takeoff (hold short line) - planned ...
  8. FO or Cpt. 'Prepare for Takeoff' message - planned ...
  9. F/A Message 'Remain seated' (or whatever, at 3,000 ft )
  10. F/A Meal Service (at 10, 000 ft)
  11. F/A Unfasten seat belts (before reaching cruising altitude)
  12. F/A Fasten seat belts (descent) - planned ....
  13. F/A Aircraft ready to land (final) - planned ...
  14. FO or Cpt. 'Prepare for Landing' message - planned ...
  15. F/A Landing message - planned ...
  16. F/A Message 'Remain seated' (stop during taxi)
  17. F/A Message 'Doors to Manual' (gate arrival)
What do you suggest is the best condition to trigger 7-8? Any Variable for approaching an active runway takeoff area?
 

ddawson

Resource contributor
#58
Well...
Through the GPS interface, you can get the lat, lon, length, width and direction of a given runway.
With this information, you can work out where the four corners of the runway are.
If you are between the two ends of the runway, the shortest distance to the runway will be a line perpendicular to the direction of the runway.
If this distance is less than a value you select, you could play the sounds desired.
It's enough to make you wish you had been paying more attention in math class when trigonometry was covered. :yikes:
 
#59
It's enough to make you wish you had been paying more attention in math class when trigonometry was covered. :yikes:
Honestly, I'm lucky. I aced math in High School, all the way up through calculous. Including Trig.
All it is, really, is knowing/learning things about right triangles. 3 sides, 3 angles is all there are. What could be simpler??
The HARD part of it, back when I was in school, was trying memorize the three main tables, but now, the calculators have ALL the tables built in. Huge difference after learning using trig tables and a slide rule, believe me. o_O

Pat☺
 
Top