almost working with dissonance. Strange lag happening now

handTracking
Kyle Johnsen 2022-01-03 02:13:54 -05:00
parent d8ae888fb3
commit bbbfd7afb0
3 changed files with 21 additions and 15 deletions

View File

@ -104,9 +104,12 @@ public class NetworkPlayer : MonoBehaviour
case "2": //audio data
{
if (isSpeaking)
{
byte[] data = Convert.FromBase64String(sections[1]);
uint sequenceNumber = uint.Parse(sections[2]);
commsNetwork.voiceReceived(dissonanceID,data,sequenceNumber);
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<byte> 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)

View File

@ -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<byte>(data), sequenceNumber);
VoicePacket vp = new VoicePacket(sender, ChannelPriority.Default, 1, false, new ArraySegment<byte>(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()
{
}
}
}

View File

@ -4,5 +4,8 @@
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
m_Scenes:
- enabled: 1
path: Assets/test.unity
guid: e4e43899246c941c78acfc59ce2f664a
m_configObjects: {}