diff --git a/TestVelGameServer/Assets/NetworkPlayer.cs b/TestVelGameServer/Assets/NetworkPlayer.cs index 58922ea..d8500a4 100644 --- a/TestVelGameServer/Assets/NetworkPlayer.cs +++ b/TestVelGameServer/Assets/NetworkPlayer.cs @@ -103,10 +103,13 @@ public class NetworkPlayer : MonoBehaviour } case "2": //audio data { - - byte[] data = Convert.FromBase64String(sections[1]); - uint sequenceNumber = uint.Parse(sections[2]); - commsNetwork.voiceReceived(dissonanceID,data,sequenceNumber); + + if (isSpeaking) + { + byte[] data = Convert.FromBase64String(sections[1]); + uint sequenceNumber = uint.Parse(sections[2]); + commsNetwork.voiceReceived(dissonanceID, data, sequenceNumber); + } break; } @@ -124,12 +127,15 @@ public class NetworkPlayer : MonoBehaviour { if(sections[1] == "0") { - commsNetwork.playedStoppedSpeaking(dissonanceID); + commsNetwork.playerStoppedSpeaking(dissonanceID); lastAudioId = 0; + isSpeaking = false; } else { commsNetwork.playerStartedSpeaking(dissonanceID); + lastAudioId = 0; + isSpeaking = true; } break; } @@ -153,7 +159,7 @@ public class NetworkPlayer : MonoBehaviour public void sendAudioData(ArraySegment data) { string b64_data = Convert.ToBase64String(data.Array,data.Offset,data.Count); - manager.sendTo(0, "2,"+b64_data + ","+lastAudioId +";"); + manager.sendTo(0, "2,"+b64_data + ","+lastAudioId++ +";"); } public void setDissonanceID(string id) diff --git a/TestVelGameServer/Assets/VelCommsNetwork.cs b/TestVelGameServer/Assets/VelCommsNetwork.cs index dd9e575..ec33476 100644 --- a/TestVelGameServer/Assets/VelCommsNetwork.cs +++ b/TestVelGameServer/Assets/VelCommsNetwork.cs @@ -70,7 +70,7 @@ namespace Dissonance public void voiceReceived(string sender,byte[] data,uint sequenceNumber) { - VoicePacket vp = new VoicePacket(sender, ChannelPriority.Default, 1, true, new ArraySegment(data), sequenceNumber); + VoicePacket vp = new VoicePacket(sender, ChannelPriority.Default, 1, false, new ArraySegment(data), sequenceNumber); VoicePacketReceived(vp); } @@ -107,16 +107,13 @@ namespace Dissonance public void playerStartedSpeaking(string id) { PlayerStartedSpeaking(id); + Debug.Log("player " + id + " started speaking"); } - public void playedStoppedSpeaking(string id) + public void playerStoppedSpeaking(string id) { PlayerStoppedSpeaking(id); + Debug.Log("player " + id + " stopped speaking"); } - // Update is called once per frame - void Update() - { - - - } + } } diff --git a/TestVelGameServer/ProjectSettings/EditorBuildSettings.asset b/TestVelGameServer/ProjectSettings/EditorBuildSettings.asset index 0147887..9cb489c 100644 --- a/TestVelGameServer/ProjectSettings/EditorBuildSettings.asset +++ b/TestVelGameServer/ProjectSettings/EditorBuildSettings.asset @@ -4,5 +4,8 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 - m_Scenes: [] + m_Scenes: + - enabled: 1 + path: Assets/test.unity + guid: e4e43899246c941c78acfc59ce2f664a m_configObjects: {}