• 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.

Door sounds

Messages
26
Country
australia
Trying to make custom sounds for each of the four doors. Using the code below works on the main door using the shift+E.

Just wondering if there is any way to select or specify a door with the "TOGGLE_AIRCRAFT_EXIT"?

<Gauge Name="KeyEvent_Door_Sounds.xml" Version="1.0">

<Comment>
</Comment>

<Update Frequency="7"/>

<Keys>
<On Event="TOGGLE_AIRCRAFT_EXIT">
1 (&gt;L:Cargo_Door,number)
</On>

</Keys>

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

</Gauge>
 
You could adapt an old file , written by Mr. Rob Barendregt, 2005.

Name is rcbse-10-Select-Eng.zip. Should be found at avsim .....
 
Hi,

I would suggest a different approach, by using the Exit Avars instead of detecting the events.
Much easier, and more accurate because the duration of the sound is actually synchronised with an "exit" door moving.
(as specified in the aircraft.cfg)

Like in:
Code:
<Element>
   <Select>
     <Value>
         (A:EXIT OPEN:0,percent) 1 &gt;  (A:EXIT OPEN:0,percent) 99 &lt; &amp;&amp;
         if{ 2 } els{ 0 } (&gt;L:Door1,enum)
         (A:EXIT OPEN:1,percent) 1 &gt;  (A:EXIT OPEN:1,percent) 99 &lt; &amp;&amp;
         if{ 2 } els{ 0 } (&gt;L:Door2,enum)
         (A:EXIT OPEN:2,percent) 1 &gt;  (A:EXIT OPEN:2,percent) 99 &lt; &amp;&amp;
         if{ 2 } els{ 0 } (&gt;L:Door3,enum)
         (A:EXIT OPEN:3,percent) 1 &gt;  (A:EXIT OPEN:3,percent) 99 &lt; &amp;&amp;
         if{ 2 } els{ 0 } (&gt;L:Door4,enum)
     </Value>
   </Select>
 </Element>
where DoorX are the Lvars you specify in the XMLsound ini file.

Rob
 
Hi,

I would suggest a different approach, by using the Exit Avars instead of detecting the events.
Much easier, and more accurate because the duration of the sound is actually synchronised with an "exit" door moving.
(as specified in the aircraft.cfg)

Like in:
Code:
<Element>
   <Select>
     <Value>
         (A:EXIT OPEN:0,percent) 1 &gt;  (A:EXIT OPEN:0,percent) 99 &lt; &amp;&amp;
         if{ 2 } els{ 0 } (&gt;L:Door1,enum)
         (A:EXIT OPEN:1,percent) 1 &gt;  (A:EXIT OPEN:1,percent) 99 &lt; &amp;&amp;
         if{ 2 } els{ 0 } (&gt;L:Door2,enum)
         (A:EXIT OPEN:2,percent) 1 &gt;  (A:EXIT OPEN:2,percent) 99 &lt; &amp;&amp;
         if{ 2 } els{ 0 } (&gt;L:Door3,enum)
         (A:EXIT OPEN:3,percent) 1 &gt;  (A:EXIT OPEN:3,percent) 99 &lt; &amp;&amp;
         if{ 2 } els{ 0 } (&gt;L:Door4,enum)
     </Value>
   </Select>
</Element>
where DoorX are the Lvars you specify in the XMLsound ini file.

Rob
Rob that worked awesome!

Can the code be modded to add a separate door closed sound as well?

Thanks!
 
Yes, no problem.

But then you have to specify exactly what you would like it to do.
Do you want a different sound to be played when the door is closing (opposed to opening) , or play another sound after a door is fully closed (after closing it ) ?

What you need to consider:
To have a perfect alignment between the visual closing of a door and it's closing / closed (safety bolts locking in place) sound, there are two ways to code it.

1. Use one sound file.
Advantage: simple code.
Disadvantage: the soundfile duration has to be matched exactly with the visual aspect (determined by the Exit opening/closing time in the aircraft.cfg)

2. Use a short, closing sound (played repetitively while the visual door is closing), followed by a sound (played once) when the door is closed (so when the Exit opening percentage goes from 1 to 0).
Advantage: makes it independant from the time specified in the aircraft.cfg, for each door.
Disadvantage: more complex to code it.

Rob
 
Yes, different sound for both opening and closing.

Updated the exit rates to match the length of play for each door. So now the doors and audio clip time well together.

Happens pretty quick that visually/audibly doesn't seem to be a big disconnect with the unlatching and latching of the door handle.
So something like 1 that incorporates the latching and unlatching sound effects would work.
 
Just realise that Method-1 has another disadvantage: when you toggle a door again while it's not fully opened or closed yet, the sound is out-of-sync with the visual opening.
Because the sound is always started at the beginning.
But if that's acceptable:

What the code needs to do then to have different opening and closing sounds, is determine the direction in which the door is moving:

Like in: (example for Exit0, just copy/edit for other 3 Exits):
Code:
<Element>
  <Select>
    <Value>
       (A:EXIT OPEN:0,percent) 0.1 &gt; (L:Exit0Previous,number) 0.1 &lt; &amp;&amp;
       if{ 1 (&gt;L:Door1Opening,enum) }
       (A:EXIT OPEN:0,percent) 99.9 &lt; (L:Exit0Previous,number) 99.9 &gt; &amp;&amp;
       if{ 1 (&gt;L:Door1Closing,enum) }
       (A:EXIT OPEN:0,percent) (&gt;L:Exit0Previous,number)
    </Value>
  </Select>
</Element>
Meaning that the opening/closing sound is triggered once (and played fully), when the door is being opened/closed.

But again, this only works properly if you do not give a ToggleExit command for that door, while a door is still in motion.
If you want to make it perfect, then you need to split each open/close sound 3-ways (start, moving, end), which a lot of addtional control code.

Rob
 
Last edited:
Just for the sake of argument ...LoL .... the code below addresses the reverse-direction issue, and gives you full flexibility and independancy of the aircraft.cfg-defined opening/closing times.
Using 6 different sounds for one door.

XML:
<Element>
   <Select>
      <Value>
         (* Determine door state *)
         (A:EXIT OPEN:0,percent) 0.1 &lt;
         if{ 0 }        (* Closed *)
         els{
            (A:EXIT OPEN:0,percent) 99.9 &gt;
            if{ 3 }      (* Open *)
            els{
               (A:EXIT OPEN:0,percent) (L:Exit0Previous,number) &gt;
               if{ 1 }    (* Opening *)
               els{ 2 }   (* Closing *)
            }
         }
         (&gt;L:Door1State,enum)

         (* Stop repetitive opening sound *)
         (L:Door1State,enum) 1 !=
         if{
            0 (&gt;L:Door1IsOpeningSound,enum)
         }

         (* Stop repetitive closing sound *)
         (L:Door1State,enum) 2 !=
         if{
            0 (&gt;L:Door1IsClosingSound,enum)
         }

         (* Play UnlockToOpen sound once, followed by repetitive opening sound *)
         (L:Door1State,enum) 1 ==
         if{
            (L:Door1StatePrevious,enum) 0 ==
            if{ 1 (&gt;L:Door1UnlockToOpenSound,enum) }
            (L:Door1UnlockToOpenSound,enum) 0 ==
            if{ 2 (&gt;L:Door1IsOpeningSound,enum) }
         }

         (* Play open sound once when door fully open *)
         (L:Door1State,enum) 3 == (L:Door1StatePrevious,enum) 1 == &amp;&amp;
         if{ 1 (&gt;L:Door1OpenAndLockedSound,enum) }

         (* Play UnlockToClose sound once, followed by repetitive closing sound *)
         (L:Door1State,enum) 2 ==
         if{
            (L:Door1StatePrevious,enum) 3 ==
            if{ 1 (&gt;L:Door1UnlockToCloseSound,enum) }
            (L:Door1UnlockToCloseSound,enum) 0 ==
            if{ 2 (&gt;L:Door1IsClosingSound,enum) }
         }

         (* Play lock sound once when door fully closed *)
         (L:Door1State,enum) 0 == (L:Door1StatePrevious,enum) 2 == &amp;&amp;
         if{ 1 (&gt;L:Door1ClosedAndLockedSound,enum) }

         (* Save current states *)
         (A:EXIT OPEN:0,percent) (&gt;L:Exit0Previous,number)
         (L:Door1State,enum) (&gt;L:Door1StatePrevious,enum)
      </Value>
   </Select>
</Element>

Cheers, Rob
 
Rob this works great and works even better with the visual model!

Opening phase order works perfectly for this model.

Is there a way to rearrange the code for the looping order of closing phase?

The door uses a gas strut. So on the way down, hear the gas strut first before the thud of the door closing, then the latch and lock.

Could the first sound (gas strut) be the one that loops and the second sound upon closing is the door settling into place (which think would be equivalent to the unlock to close) before the latch and lock sound?
 
Sorry, I don't understand what you mean for the sounds when closing a door.
What is it different then when you open a door ??

As for opening the door, the whole closing sound sequence is split three-ways.
Reason for that is, that if you close a door again before it's fully opened, with one combined sound the timing of the sound gets out-of-sync resp. you won't hear the last past of the sound.
So :
1. A short, initial sound (Door1UnlockToCloseSound) which is only played fully once if the Exit percentage transitions from > 99.9% to < 99.9 %
2. After this sound has finished playing, the Door1IsClosingSound is played repetitively as long as the door keeps closing (so if you toggle the door open again before it's fully closed, it stops too) until the Exit var transitions from > 0.1% to < 0.1%.
3. At that point, the Door1ClosedAndLockedSound is played once fully. This sound would comprise the door settling into place, plus locking it. There is no reason to split this sound.

From what I understand, you would like to start the closing process with step-2. So omit Step-1.
If so:
Just remove the lines
XML:
            (L:Door1StatePrevious,enum) 3 ==
            if{ 1 (&gt;L:Door1UnlockToCloseSound,enum) }
from the code.

If not, I don't understand what you want to do.
Please define the sequence of sounds then in terms of Exit percentage then (like I specified above).

Rob
 
Yes, it is slightly different when opening.

Opening sequence is: Door Latch unlocked -> Gas Strut -> Door fully open sounds

Closing sequence is: Gas Strut -> Door closed sound -> Door Latch locked

Your explanation makes sense and is a good idea. I can rework the audio files with maybe a slight creak or something as an initial sound followed by the gas strut - which think should be the one looping.
Then could incorporate the door closed sound with the latched and locked sound.

Thanks for the help with this; really appreciate it!
 
Yes, that would be the best approach.

Note that (if you like) you can use simular code for all four Exits ; and use a seperate soundset for each door in the ini file.
After all, a passenger door/stairway sounds a lot different then a sliding bagage door ...LoL
Just copy the code in post#9 in other elements, replacing the A:Exit Open:x vars and the number "1" in all the Lvars "2,3,4")

Rob
 
Hi Rob, this worked great. All set and thanks for the help!

Was trying to make a gauge to open a cockpit view based on the position of the door being open or close. Will use this to control the interior or exterior sound set. Tried this and manage to get the view to open, but it constantly fires and FSX crashes. Any ideas on how to get it to only open 1 panel or fire once?

<Gauge Name="Canopy Door Cockpit Panel" Version="1.0">
<Element>
<Select>
<Value>
(A:CANOPY OPEN, percent) 40 &gt; if{ 1 (&gt;K:NEW_VIEW) }
</Value>
</Select>
</Element>
</Gauge>
 
To trigger the event only once, you need detect the transition from <40 to > 40., by comparing the current value with the previous value.
Like in:

XML:
(A:EXIT OPEN:0, percent) 40 &gt;=
(L:ExitOpenPrevious:0, number) 40 &lt; &amp;&amp;
if{ 1 (&gt;K:NEW_VIEW) }
(A:EXIT OPEN:0,percent) (&gt;L:ExitOpenPrevious:0, number)
Rob

PS:
I suggest you don't use Avar CANOPY OPEN (very ancient) anymore, but the (compatible) EXIT OPEN:0
 
Hi Rob,

This worked great. Just reworked it so the cockpit view opens when the door closes and the internal sound engine plays.
Then when the door is opened, the cockpit view panel is closed so the external sound engine plays.

<Gauge Name="Canopy Door Cockpit Panel" Version="1.0">
<Element>
<Select>
<Value>
(A:EXIT OPEN:0, percent) 30 &lt;=
(L:ExitOpenPrevious:0, number) 30 &gt; &amp;&amp;
if{ 0 (&gt;K:NEW_VIEW) }
(A:EXIT OPEN:0,percent) (&gt;L:ExitOpenPrevious:0, number)
</Value>
</Select>
</Element>

<Element>
<Select>
<Value>
(A:EXIT OPEN:0, percent) 30 &gt;=
(L:ExitClosePrevious:0, number) 30 &lt; &amp;&amp;
if{ 1 (&gt;K:CLOSE_VIEW) }
(A:EXIT OPEN:0,percent) (&gt;L:ExitClosePrevious:0, number)
</Value>
</Select>
</Element>

</Gauge>

Only trouble I've found is if the door is opened and closed multiple times, when the panel reopens it is back to the default size - which is quite large and hard to hide.
Was hoping that if the window was scaled down and tucked away out of sight it would reappear the same size and position.

Tried adding this gauge to the panel.cfg to see if set size parameters could be used via this path.
No luck so far, don't know if anyone has any ideas or if there is a way to control the size of a new window when it is opened?
 
Sorry, I have no idea if it's possible to define the size and screen location when you open a new camera view.
I looked in the fsx.cfg file and camera.cfg file, but could find nothing.

Alternative, you could use a 2D window for the gauge (instead of a new camera view).
Then size and location can be defined anyway you want.

Rob
 
Back
Top