View Full Version : SOUND_TOGGLE - knowing status of sounds ON/OFF?
With some great help on this site I have my gauge able to recognise when the SOUND_TOGGLE event is happening - on each event I then toggle my own variable between 1 and 0 and use that to enable/disable some sounds (using my own DLL). So my gauge responds to the 'q' key correctly.
I'm missing something though - how can I be sure I'm *always* toggling in the right direction? It seems the process is vulnerable to getting out of step (i.e. can you not fundamentally tell whether SOUND_TOGGLE is toggling the sound to ON, or to OFF?). It would be a damn sight easier if I was just reading a variable SOUND_STATUS instead of trying to create that myself.
Did I miss something?
09 Sep 2008, 07:41
You need to use the SimConnect function SimConnect_SubscribeToSystemEvent and subscribe to the Sound event. Everytime the user presses Q (or the matching menu option) an event will be generated and the specific state of the sound system is given.
You also need to turn your sounds off in dialogs. So subscribe to the Dialog mode event also.
Thanks Si - I've done a fair bit of simconnect programming and see the SimConnect_SubscribeToSystemEvent(..) call you're describing with the event "Sound": "Requests a notification when the master sound switch is changed. This request will also return the current state of the master sound switch immediately. A flag is returned in the dwData parameter, 0 if the switch is off". The provision of the actual *state* of the sound master switch is a significant addition in the simconnect api vs. the gauge.
09 Sep 2008, 14:53
Don't forget that you can actually use SimConnect in a C gauge.
If you're predominantly using XML gauges then you can export variables from your C to be visible in your XML gauges by:
void SetLVar32(SINT32 val,char *str)
where the string is the variable name of your choice and val is the value, i.e.
Will result in a variable called L:MySoundState,bool being available in XML and set to whatever the sound parameter is.
vBulletin® v3.8.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.