DragonflightDesign
Resource contributor
- Messages
- 1,371
- Country

Is there any way of easily detecting whether the simulator sound is on or off (key Q by default)? I thought there was at one time, but I can't find anything relevant in the simvars.
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.

Should be in SimConnect somewhere, since Dougs XMLSound gauge make this state available in an Lvar (FSSoundIsOn).Is there any way of easily detecting whether the simulator sound is on or off (key Q by default)? I thought there was at one time, but I can't find anything relevant in the simvars.

GAUGE_KEY_EVENT_HANDLER FSAPI SoundTrap ( ID32 event, UINT32 evdata, PVOID userdata )
{
switch( event )
{
case KEY_SOUND_TOGGLE:
{
SoundIsOn = 1 - SoundIsOn;
FSSoundStatus.SetLVar( (double)SoundIsOn );
}
break;
case KEY_SOUND_SET:
{
SoundIsOn = evdata;
FSSoundStatus.SetLVar( (double)SoundIsOn );
}
break;
case KEY_SOUND_ON:
{
SoundIsOn = 1;
FSSoundStatus.SetLVar( (double)SoundIsOn );
}
break;
case KEY_SOUND_OFF:
{
SoundIsOn = 0;
FSSoundStatus.SetLVar( (double)SoundIsOn );
}
break;
}
return 0;
};
Hmm.. interresting ....It's not quite what you think, Rob/Tom.
It's reporting the key_events, not the actual state of the sim sound. If someone hits the 'Q' key, I want to silence my whole cockpit.Code:GAUGE_KEY_EVENT_HANDLER FSAPI SoundTrap ( ID32 event, UINT32 evdata, PVOID userdata ) { switch( event ) { case KEY_SOUND_TOGGLE: { SoundIsOn = 1 - SoundIsOn; FSSoundStatus.SetLVar( (double)SoundIsOn ); } break; case KEY_SOUND_SET: { SoundIsOn = evdata; FSSoundStatus.SetLVar( (double)SoundIsOn ); } break; case KEY_SOUND_ON: { SoundIsOn = 1; FSSoundStatus.SetLVar( (double)SoundIsOn ); } break; case KEY_SOUND_OFF: { SoundIsOn = 0; FSSoundStatus.SetLVar( (double)SoundIsOn ); } break; } return 0; };


hr = SimConnect_SubscribeToSystemEvent(hSimConnect, EVENT_SOUND_STATE, "Sound");
switch (pEvent->uEventID)
{
case CLIENT_6HZ:
{
// Sound state
hr = SimConnect_RequestSystemState(hSimConnect, EVENT_SOUND_STATE, "Sound");
}
}
if (pData->dwRequestID)
{
switch (pData->dwRequestID)
{
case EVENT_SOUND_STATE:
// What do I do here?
break;
}
}


