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

MSFS How to write a 'RANGE' setting for Backwards?

Messages
10,088
Country
us-arizona
Hello all,

I have had zero success in writing Range settings that work. I wanted a custom sound to fire at the Key Frame point of 10 or less then, out of 100 Key Frames on the 'Backward' trek.

How might that be written? Here is a for-instance...

<Sound WwiseData="false" WwiseEvent="custom_sound_01" FileName="window_sliding_open" LocalVar="SLIDING_DOOR" Continuous="false" ViewPoint="Inside" Direction="Backward" ChangedOnly="false"> <Range LowerBound="0.1"/> </Sound>

From the Samples in the SDK, nothing worked for me. The sounds always fired at KF 1 going forwards and backwards, first point zones. On Backwards, it fired at KF 100, going 100 to 0.

Bill
LHC
 
Messages
1,049
Country
australia
The only time I've used forward/backward is in the behavior XML itself rather than in the sound.xml.

behavior file:
Code:
        <AnimationTriggers Animation="a582_Starter">           
            <EventTrigger Frame="1" Direction="Forward">
                <SoundEvent WwiseEvent="Starter_Key_1" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="11" Direction="Forward">
                <SoundEvent WwiseEvent="Starter_Key_1" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="19" Direction="Backward">
                <SoundEvent WwiseEvent="Starter_Key_2" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="9" Direction="Backward">
                <SoundEvent WwiseEvent="Starter_Key_2" Action="Play"/>
            </EventTrigger>
        </AnimationTriggers>

sound file
Code:
<AnimationSounds>
    <!--This sound will play every time the event "MySound" is sent through the animation-->
    <Sound WwiseData="true" WwiseEvent="fuel_switch" NodeName="Cockpit_fuses" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="12v_switch" NodeName="12V power" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="Starter_Key_1" NodeName="Gauges_Starter_Base" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="Starter_Key_2" NodeName="Gauges_Starter_Base" ViewPoint="Inside"/>
</AnimationSounds>

I don't see how your code will use keyframes as there is no reference to an animation, just an L var and as the L var does not contain keyframe information where do you expect the keyframe data to come from? In my example you can that the animation is referenced (a582_starter) and the key frame comes from that animation.
 
Messages
10,088
Country
us-arizona
The only time I've used forward/backward is in the behavior XML itself rather than in the sound.xml.

behavior file:
Code:
        <AnimationTriggers Animation="a582_Starter">          
            <EventTrigger Frame="1" Direction="Forward">
                <SoundEvent WwiseEvent="Starter_Key_1" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="11" Direction="Forward">
                <SoundEvent WwiseEvent="Starter_Key_1" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="19" Direction="Backward">
                <SoundEvent WwiseEvent="Starter_Key_2" Action="Play"/>
            </EventTrigger>
            <EventTrigger Frame="9" Direction="Backward">
                <SoundEvent WwiseEvent="Starter_Key_2" Action="Play"/>
            </EventTrigger>
        </AnimationTriggers>

sound file
Code:
<AnimationSounds>
    <!--This sound will play every time the event "MySound" is sent through the animation-->
    <Sound WwiseData="true" WwiseEvent="fuel_switch" NodeName="Cockpit_fuses" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="12v_switch" NodeName="12V power" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="Starter_Key_1" NodeName="Gauges_Starter_Base" ViewPoint="Inside"/>
    <Sound WwiseData="true" WwiseEvent="Starter_Key_2" NodeName="Gauges_Starter_Base" ViewPoint="Inside"/>
</AnimationSounds>

I don't see how your code will use keyframes as there is no reference to an animation, just an L var and as the L var does not contain keyframe information where do you expect the keyframe data to come from? In my example you can that the animation is referenced (a582_starter) and the key frame comes from that animation.

Whoa... So you use 'Frame' in these Triggers... Interesting. Many thanks for that, Anthony.
I was using Percent per some of the Aosbo code I had seen, and 'number' instead of Bool as that was used much in the past and supposedly works again with Asobo Local Var coding, though it might be SU10 Beta that its working in presently and not in SU9. I am SU9 right now.

Man, linking to a 'Key Frame' would work well. Thanks again.

I did get mine working by just stretching the animation to be blank while the door is closing and the 'clunk sound' at the end. Then I ran it off of a separate Local Var, so it played on that trigger. But will note this for the future.

Bill
 
Messages
244
Country
unitedkingdom
like Anthony I've done this in the model xml, but explictly programming the forwards/backwards logic and just toggling an L var to trigger the sound.

The forwards/backards code is really simple, e.g to trigger a sound at frame 90:

say the animation is keyed on var ANIM 0..100

use a bool var FORWARD to indicate forward movement of the animation:

if ANIM == 0 : set FORWARD = TRUE

if ANIM > 90 && FORWARD == true:
toggle simvar for sound One
set FORWARD = false.

if ANIM < 10 && FORWARD == false:
toggle simvar for sound Two
set FORWARD = true

all in RPN of course..
 
Messages
1,049
Country
australia
Whoa... So you use 'Frame' in these Triggers... Interesting. Many thanks for that, Anthony.
I was using Percent per some of the Aosbo code I had seen, and 'number' instead of Bool as that was used much in the past and supposedly works again with Asobo Local Var coding, though it might be SU10 Beta that its working in presently and not in SU9. I am SU9 right now.

Man, linking to a 'Key Frame' would work well. Thanks again.

I did get mine working by just stretching the animation to be blank while the door is closing and the 'clunk sound' at the end. Then I ran it off of a separate Local Var, so it played on that trigger. But will note this for the future.

Bill
I just saw this in the SU10 release notes:

"Animation Position can now be used in the sound.xml file to trigger sounds and for RTPCs"

This may be of use to you (although you will probably have to wait for the SDK documentation to be updated before we find out what it means).
 
Top