- Messages
- 4
- Country

Hello, working on trying to identify which player in a multiplayer session is talking, either on their own freq or broadcasting on all.. The code below successfully identifies both events, however only when they occur from the computer running the application, when network multiplayer pilots talk either on a single freq or broadcast the app fails to identify either event. Any ideas how I should change this to identify a) the MP_VOICE_CAPTURE_START and MP_BROADCAST_VOICE_CAPTURE_START events from anyone connected to the session and b)who it is (by dwObjectId perhaps)?
Private Sub initializeDefinitionsAndEvents()
AddHandler fsxconnect.OnRecvEvent, New SimConnect.RecvEventEventHandler(AddressOf RecvEvent)
AddHandler fsxconnect.OnRecvOpen, New SimConnect.RecvOpenEventHandler(AddressOf SimConnectRecvOpen)
AddHandler fsxconnect.OnRecvQuit, New SimConnect.RecvQuitEventHandler(AddressOf SimConnectRecvQuit)
AddHandler fsxconnect.OnRecvEventMultiplayerServerStarted, New SimConnect.RecvEventMultiplayerServerStartedEventHandler(AddressOf MultiPlayerStarted)
AddHandler fsxconnect.OnRecvEventMultiplayerSessionEnded, New SimConnect.RecvEventMultiplayerSessionEndedEventHandler(AddressOf MultiPlayerEnded)
AddHandler fsxconnect.OnRecvEventObjectAddremove, New SimConnect.RecvEventObjectAddremoveEventHandler(AddressOf AddRemoveSimConnectObject)
AddHandler fsxconnect.OnRecvException, New SimConnect.RecvExceptionEventHandler(AddressOf SimConnectException)
fsxconnect.SubscribeToSystemEvent(EventIDs.EVENT_AddObject, "ObjectAdded")
fsxconnect.SubscribeToSystemEvent(EventIDs.EVENT_RemoveObject, "ObjectRemoved")
fsxconnect.SubscribeToSystemEvent(EventIDs.EVENT_MultiplayerServerStarted, "MultiplayerServerStarted")
fsxconnect.SubscribeToSystemEvent(EventIDs.EVENT_MultiplayerSessionEnded, "MultiplayerSessionEnded")
fsxconnect.MapClientEventToSimEvent(EventIDs.EVENT_MPVoiceCaptureStart, "MP_VOICE_CAPTURE_START")
fsxconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUP.COMMS, EventIDs.EVENT_MPVoiceCaptureStart, False)
fsxconnect.MapClientEventToSimEvent(EventIDs.EVENT_MPBroadcastVoiceCaptureStart, "MP_BROADCAST_VOICE_CAPTURE_START")
fsxconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUP.COMMS, EventIDs.EVENT_MPBroadcastVoiceCaptureStart, False)
fsxconnect.SetNotificationGroupPriority(NOTIFICATION_GROUP.COMMS, SimConnect.SIMCONNECT_GROUP_PRIORITY_DEFAULT)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "Title", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING256, 0, 0)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC Type", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING32, 0, 1)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC Model", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING32, 0, 2)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC ID", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING32, 0, 3)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC Airline", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING64, 0, 4)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC Flight Number", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING8, 0, 5)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "Plane Latitude", "degrees", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT64, 0, 6)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "Plane Longitude", "degrees", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT64, 0, 7)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "Plane Altitude", "feet", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT64, 0, 8)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "SIM On Ground", "Bool", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT32, 0, 9)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "COM ACTIVE FREQUENCY:1", "MHz", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT32, 0, 10)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "COM ACTIVE FREQUENCY:2", "MHz", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT32, 0, 11)
' IMPORTANT: register it with the simconnect managed wrapper marshallergg
' if you skip this step, you will only receive an int in the .dwData field.
fsxconnect.RegisterDataDefineStruct(Of StructMultiplayerAircraft)(DEFINITIONS.StructMultiplayerAircraft)
AddHandler fsxconnect.OnRecvSimobjectDataBytype, New SimConnect.RecvSimobjectDataBytypeEventHandler(AddressOf RecvSimobjectDataBytype)
End Sub
..
..
..
Private Sub RecvEvent(ByVal sender As SimConnect, ByVal data As SIMCONNECT_RECV_EVENT)
Select Case data.uEventID
Case EventIDs.EVENT_MPVoiceCaptureStart
Debug.Print("##-->TALKING")
fsxconnect.Text(SIMCONNECT_TEXT_TYPE.PRINT_RED, 3.0F, RequestID.DisplaySetData, "TALKING!")
Case EventIDs.EVENT_MPBroadcastVoiceCaptureStart
Debug.Print("#########> ALL FREQ BROADCASTING!")
End Select
End Sub
Private Sub initializeDefinitionsAndEvents()
AddHandler fsxconnect.OnRecvEvent, New SimConnect.RecvEventEventHandler(AddressOf RecvEvent)
AddHandler fsxconnect.OnRecvOpen, New SimConnect.RecvOpenEventHandler(AddressOf SimConnectRecvOpen)
AddHandler fsxconnect.OnRecvQuit, New SimConnect.RecvQuitEventHandler(AddressOf SimConnectRecvQuit)
AddHandler fsxconnect.OnRecvEventMultiplayerServerStarted, New SimConnect.RecvEventMultiplayerServerStartedEventHandler(AddressOf MultiPlayerStarted)
AddHandler fsxconnect.OnRecvEventMultiplayerSessionEnded, New SimConnect.RecvEventMultiplayerSessionEndedEventHandler(AddressOf MultiPlayerEnded)
AddHandler fsxconnect.OnRecvEventObjectAddremove, New SimConnect.RecvEventObjectAddremoveEventHandler(AddressOf AddRemoveSimConnectObject)
AddHandler fsxconnect.OnRecvException, New SimConnect.RecvExceptionEventHandler(AddressOf SimConnectException)
fsxconnect.SubscribeToSystemEvent(EventIDs.EVENT_AddObject, "ObjectAdded")
fsxconnect.SubscribeToSystemEvent(EventIDs.EVENT_RemoveObject, "ObjectRemoved")
fsxconnect.SubscribeToSystemEvent(EventIDs.EVENT_MultiplayerServerStarted, "MultiplayerServerStarted")
fsxconnect.SubscribeToSystemEvent(EventIDs.EVENT_MultiplayerSessionEnded, "MultiplayerSessionEnded")
fsxconnect.MapClientEventToSimEvent(EventIDs.EVENT_MPVoiceCaptureStart, "MP_VOICE_CAPTURE_START")
fsxconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUP.COMMS, EventIDs.EVENT_MPVoiceCaptureStart, False)
fsxconnect.MapClientEventToSimEvent(EventIDs.EVENT_MPBroadcastVoiceCaptureStart, "MP_BROADCAST_VOICE_CAPTURE_START")
fsxconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUP.COMMS, EventIDs.EVENT_MPBroadcastVoiceCaptureStart, False)
fsxconnect.SetNotificationGroupPriority(NOTIFICATION_GROUP.COMMS, SimConnect.SIMCONNECT_GROUP_PRIORITY_DEFAULT)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "Title", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING256, 0, 0)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC Type", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING32, 0, 1)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC Model", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING32, 0, 2)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC ID", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING32, 0, 3)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC Airline", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING64, 0, 4)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "ATC Flight Number", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.STRING8, 0, 5)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "Plane Latitude", "degrees", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT64, 0, 6)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "Plane Longitude", "degrees", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT64, 0, 7)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "Plane Altitude", "feet", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT64, 0, 8)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "SIM On Ground", "Bool", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT32, 0, 9)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "COM ACTIVE FREQUENCY:1", "MHz", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT32, 0, 10)
fsxconnect.AddToDataDefinition(DEFINITIONS.StructMultiplayerAircraft, "COM ACTIVE FREQUENCY:2", "MHz", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT32, 0, 11)
' IMPORTANT: register it with the simconnect managed wrapper marshallergg
' if you skip this step, you will only receive an int in the .dwData field.
fsxconnect.RegisterDataDefineStruct(Of StructMultiplayerAircraft)(DEFINITIONS.StructMultiplayerAircraft)
AddHandler fsxconnect.OnRecvSimobjectDataBytype, New SimConnect.RecvSimobjectDataBytypeEventHandler(AddressOf RecvSimobjectDataBytype)
End Sub
..
..
..
Private Sub RecvEvent(ByVal sender As SimConnect, ByVal data As SIMCONNECT_RECV_EVENT)
Select Case data.uEventID
Case EventIDs.EVENT_MPVoiceCaptureStart
Debug.Print("##-->TALKING")
fsxconnect.Text(SIMCONNECT_TEXT_TYPE.PRINT_RED, 3.0F, RequestID.DisplaySetData, "TALKING!")
Case EventIDs.EVENT_MPBroadcastVoiceCaptureStart
Debug.Print("#########> ALL FREQ BROADCASTING!")
End Select
End Sub
Last edited: