Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Having trouble creating XML sound gauge for FSX

Featured Replies

  • Commercial Member

I have very little experience creating XML gauges and really I am just copying what I see in forums or from exisiting gauges without really understanding the code. Anyhow, I would like to create a gauge that will play a sound when the trim button is pressed. I am using the dsd_xml_sound3 gauge. This is what I have so far:from the panel.cfg file:gauge36=trim_sound!trim_sound, 2,2,1,1gauge37=dsd_xml_sound3!dsd_xml_sound3, 2,2,5,5, ./Gauges/trim_sound.iniI have the sound file trim_sound.wav in the main FSX sound folder.In the main FSX gauges folder I have the trim_sound.ini file as follows:[Config]MaxSounds=5LvarStop=dsd_stop_sounds[LVars]Lvar00=trim_sound[sounds]Sound00=./Sound/trim_sound.wavFinally, in the same gauges folder I have I have the dsd_xml_sound3.gau file and a file named trim_sound.xml with the following content<Gauge Name="trim_sound" Version="1.0"> <Keys> <On Event="KEY_ELEV_TRIM_UP">(L:trim_sound, number) 1 + (>L:trim_sound, number)</ </Keys> </Gauge>Obviously I will want to add something for elevator down trim as well, but the main thing is getting it to produce any sound at all, which it does not do so far. The key event code is something that I have cribbed from another post without really understanding what it does.Any help would be appreciated.

Michael Cependa

Developer Aerosoft DC-8

I have very little experience creating XML gauges and really I am just copying what I see in forums or from exisiting gauges without really understanding the code. Anyhow, I would like to create a gauge that will play a sound when the trim button is pressed. I am using the dsd_xml_sound3 gauge. This is what I have so far:from the panel.cfg file:gauge36=trim_sound!trim_sound, 2,2,1,1gauge37=dsd_xml_sound3!dsd_xml_sound3, 2,2,5,5, ./Gauges/trim_sound.iniI have the sound file trim_sound.wav in the main FSX sound folder.In the main FSX gauges folder I have the trim_sound.ini file as follows:[Config]MaxSounds=5LvarStop=dsd_stop_sounds[LVars]Lvar00=trim_sound[sounds]Sound00=./Sound/trim_sound.wavFinally, in the same gauges folder I have I have the dsd_xml_sound3.gau file and a file named trim_sound.xml with the following content<Gauge Name="trim_sound" Version="1.0"> <Keys> <On Event="KEY_ELEV_TRIM_UP">(L:trim_sound, number) 1 + (>L:trim_sound, number)</ </Keys> </Gauge>Obviously I will want to add something for elevator down trim as well, but the main thing is getting it to produce any sound at all, which it does not do so far. The key event code is something that I have cribbed from another post without really understanding what it does.Any help would be appreciated.
Hi, The first problem is your XML gauge definition in the panel.cfg:gauge36=trim_sound!trim_sound, 2,2,1,1This means that the gauge trim_sound.xml should either in folder "MainFSfolder"\Gauges\trim_sound\ or in folder "WhereYourPanel.cfgIs"\trim_sound\Iow: FS cannot find this trim_sound.xml gauge now.In general (when talking about an xml gauge) , if you define:gauge36=xxx!yyy, ....in the panel.cfg,FS tries to find the file yyy.xml in the following order:1. In folder "WhereYourPanel.cfgIs"\xxx\2. Within the file xxx.cab in folder "WhereYourPanel.cfgIs"\3. In folder "MainFSfolder"\Gauges\xxx\4. Within the file xxx.cab in folder "MainFSfolder"\Gauges\Clear ?(by the way: good practise is to only use 1. or .2, since it avoids cluttering up the main \gauges folder, or accidentally overwriting files of other designers (or even worse: original FS files) with the same filename )Secondly, using the OnEvent isn't the best way of doing this for what you want (in FSX). Since OnEvent only works if the window in which the gauge is defined, has "focus" (== is 'visible').Moreover, your code "increments" var (L:trim_sound, number) upon each trim-event. That's incorrect as well; you should set the var to 1 (single play) or 2 (repetitive play).Now, I assume what you want is some click sound playing while you keep giving trim events (via keyboard or controller buttons), right ?If so, I'll give you some code that does work .. (is it for FS9 or FSX ?? )Regards, Rob
  • Author
  • Commercial Member

Thanks so much for the reply. Yes, I would like the sound to play when either the trim key or joystick button is pressed. The sound should continue to play in a loop so long as the button/key is depressed. It's for a Boeing 727 which has a pretty noisy trim wheel. The only possible hitch with this is that the autopilot for the plane I am adding this to has the trim in more or less constant motion to maintain level flight(unlike the real aircraft) and as the trim wheel is quite loud, I would only like the sound to play for user input. If that's possible.It's for FSX and the aircraft has only a VC, which is "on" all the time in when in the cockpit. Is that "visible" enough, or does the notional panel location need to be actually in the field of view, assuming "on event" is used?I'm afraid I'm not clear on how to substitue "2" (repetitive play) for "incrementing".Based on your reply, I now have a new folder in the aircraft's panel folder called trim_sound and have put the trim_sound.xml file in it. I am now left in some doubt as to where trim_sound.ini and dsd_xml_sound3.gau ought to go, given what I have for gauge 37 in the config file.Any further direction or code you can give me would be great.Michael

Michael Cependa

Developer Aerosoft DC-8

Hi Michael,I'll cook up a gauge tonight, since I can use it myself as well in the aircraft I'm working on now.If you PM me your normal EMail addres, I'll send the stuff when ready. Together with some explanation on how to install it.And I'll include the latest version of Dougs sound gauge, which also allows you to set the volume of the sound in the sound.ini file (some older version has a small bug in it).Also, using OnEvent is quite good in this case, since you only have a VC and you probably don't want the sound if you fly in any other view than VC, right ?RobPS. One more question.Obviously you don't want the trim wheel sound when the AP is active; I assume AP trim setting is only done when AltHold on ??If so, the gauge can check for the AltHold variable to suppress the trimsound by the AP; that is, if this AP uses the standard events/variables of the FS AP (like AltHold). If not, this AP may use trim-axis events instead of trim up/down events, so we can distinguish weather the user or the AP is controlling trim. If that fails as well (your AP uses trim up/down events, AND has it's own private variable for AP-ALtHold) you're out of luck :(

  • Author
  • Commercial Member

Thanks again. I will send you a p.m. in just a moment.I would definitely want to supress the AP effect with alt hold on. I'm not sure whether it matters with AP on and alt hold off. With alt hold off, the AP maintains a pitch which is set incrementally up and down by the user. I think in that mode it leaves the trim alone after the pitch is set, or possibly changes it only infrequently, which would be ok in terms of having the sound play. I'll have to look at that.Michael

Michael Cependa

Developer Aerosoft DC-8

It would be great if you post it here also Rob, since I cannot get it to work either.i have in my panel.cfg

gauge41=RFPgauges!rfpsound, 1,1,1,1 ./rfpgauges/sound.inigauge42=RFPgauges!turbulence, 1,1,1,1

then in sound.ini, located in gauges\rfpgauges\sound.ini

[Config]MaxSounds=4   	[sounds]Sound00=./gauges/rfpgauges/Turbulence.wav  Sound01=./Sound/Vspeed/park_brake.wav,100	Sound02=./Sound/Vspeed/Turbulence3.wav,100                       	Sound03=./Sound/Vspeed/Turbulence4.wav,100         	[LVars]Lvar01=Sound1                                        	/ // added hereLvar02=Sound2                                      	// added hereLvar03=Turbulence3                                         	// added hereLvar04=Turbulence4 

and the xml, located in gauges\rfpgauges\turbulence.xml

<Gauge Name="turbulence" Version="1.0"><Element>  <Select>	<Value>   	(A:G FORCE, gforce) abs 2.0 <    	if{ 1 (>L:Sound1,number) } 	</Value>   </Select></Element></Gauge>

the 'abs 2.0' was to test that the sound almost always play.. but I hear nothing.Any idea?

Any idea?
Hi Johan,Yes, I do ... :( First, the definition of the sound gauge doesn't make sense.I assume you have renamed Doug's FS9 xmlsound .gau file to rfpsound.gau, right ?(for FSX: the .dll to rfpsound.dll).For FS9:Now, if you place rfpsound.gau in your panel folder or main Gauges folder, the panel.cfg def should be:
gauge41=rfpsound!dsd_xml_sound3, 1,1,1,1, ./Gauges/rfpgauges/sound.ini

Note:- the gaugename definition- you missed a , after the last 1- you missed the Gauges folder in the pathname of the ini file.Should you have rfpsound.gau in the rfpgauges subfolder:

gauge41=rfpgauges/rfpsound!dsd_xml_sound3, 1,1,1,1, ./Gauges/rfpgauges/sound.ini

Secondly, in the sound.ini you start the Lvar section with Lvar01 instead of Lvar00 !!Not completely sure if it matters, although I think Doug uses them as fixed tags.So tag Lvar00= corresponds with the soundfile defined in Sound00= ; irrespective of the order in which Soundxx and Lvarxx are defined. Hope you get it working now ......Cheers, Rob

AND YES!! we have a winner!It works!, the culprit was that when removing the // comments in the ini file it worked!And now my settings for the gauge are correct. I own you a beer Rob.Sorry for hijacking this thread, but seeing the xml-master here, I couldnt resist.I have another question, but will open a new thread.Johan

AND YES!! we have a winner!It works!, the culprit was that when removing the // comments in the ini file it worked!And now my settings for the gauge are correct. I own you a beer Rob.Sorry for hijacking this thread, but seeing the xml-master here, I couldnt resist.I have another question, but will open a new thread.Johan
Glad you got that sorted out :( And I think the OP will be satified as, so no worries about the hijack....I'll respond to the other thread as well...Cheers, Rob
  • Author
  • Commercial Member

No problem with the hijack -- Rob very generously provided me with the code I needed and it's working well.

Michael Cependa

Developer Aerosoft DC-8

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.