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

MSFS20 Sounds in MSFS Gauges

Messages
497
Country
unitedstates
Anyone know how to make the gps : layInstrumentSound ("tone_caution") etc, work in MSFS
Must be more than just putting that single line in the gauge ???
 
Last edited:
Can anyone point me in the right direction to get default Instrument gauge sounds (alarms etc) working in a custom js gauge ??
 
Haven't made any sounds yet but just looking at Sounds in the SDK it looks like you define your sounds in the sound.xml. You define the conditions that sound the play in sound.xml and not in your gauge. For example, from the SDK "SimVarSounds - Sounds in this category check the value of a simulation variable and play either when the variable changes, or when it reaches an specified interval."

Looking through the A320 sound.xml I can see a few entries for LocalVar so I guess you can set a local variable in your gauge and get that to trigger the sound in sound.xml.

But I don't know what gps : layInstrumentSound ("tone_caution") is or what context you are using it in so I'm just giving suggestions blind here.
 
gps: playInstrumentSound ("tone_caution") is something I spotted in an Asobo File, so I am assuming there is an gps : function, and that with , for example gps: layInstrumentSound ("tone_caution"), "sound_caution" is a MSFS sound that can be referenced by name.

Unfortunately, when I put gps : playInstrumentSound ("tone_caution") into my js gauge, that would get called under a specific condition, nothing happens, so it looks like its not that simple .
 
Which Asobo File? I still think you need to look at the sound.xml for that Asobo aircraft and see if there is a matching tone_caution entry because it looks to me like the sound.xml is where all the sounds are defined.
 
Necro alert, but I've just got around to worrying about Sound in the plane I'm working on, so looking at this.

Main comment: recommended starting point for fundamental HTML/JS questions is asobo-vcockpits-instruments/html_ui/Pages/VCockpit/Instruments/Shared/BaseInstrument.js (which is the parent you sub-class to create your own HTML/JS instrument. Along with all the other fundamental methods such as Update() and onInteractionEvent(_args) it has:

Code:
    playInstrumentSound(soundId) {
        if (this.isElectricityAvailable() && this.getGameState() == GameState.ingame) {
            Coherent.call("PLAY_INSTRUMENT_SOUND", soundId);
            return true;
        }
        return false;
    }

and

Code:
    onSoundEnd(_event) {
    }

I'm assuming the soundId has to match a <Sound> entry in sound/sound.xml.

So you could test this either with Coherent.call directly, or (my preference) use playInstrumentSound(soundId). You can override isElectricityAvailable() { return true; } if that's a possible issue.
 
I join this interesting discussion for another question: I could successfully play a sound from my instrument as soon as it was defined as an avionic sound (in the <AvionicSound> section of the sound.xml file).
But there are other sounds I would like to play and they are not defined as avionic sounds. For example, the A320 PTU sound (WwiseEvent="ptu_on"). When I try to play it nothing happens. I tried to modify the sound.xml and move this sound in the avionic section but it didn't work... Any idea to make this work?
 
Eric sorry to necro this thread but can you paste the actual code from your gauge and the sound XML file where you "successfully play a sound from my instrument"?

Can you use the <AvionicSound> section without creating your own WWise soundbank or importing the entire multi-MB soundbank.PCK from another plane into your project?
 
Hello,
Sorry for the late reply, I didn't get any notification and I see your question only now.
If it is still useful, here is my code, very simple:

Code:
this.parentInstrument.playInstrumentSound("tone_caution");

where 'this.parentInstrument' is a sub-class of BaseAirliners.

Obviously, it works because this "tone_caution" is defined in sound.xml:

Code:
<!-- AvionicSounds ========================================================================================== -->
 
  <AvionicSounds>
    <Sound WwiseData="true" WwiseEvent="tone_caution" ViewPoint="Inside" NodeName="Screen_MFD_L"/>
    <Sound WwiseData="true" WwiseEvent="tone_warning" ViewPoint="Inside" NodeName="Screen_MFD_L"/>
    <Sound WwiseData="true" WwiseEvent="tone_altitude_alert_default" ViewPoint="Inside" NodeName="Screen_MFD_L" />     

[...]

It works in the A320. I tried to do the same in my won aircraft that uses the standard 747 sound set and it doesn't work. I don't know why...

Hope this helps.
 
Back
Top