almost working with dissonance. Strange lag happening now
parent
d8ae888fb3
commit
bbbfd7afb0
|
|
@ -104,9 +104,12 @@ public class NetworkPlayer : MonoBehaviour
|
||||||
case "2": //audio data
|
case "2": //audio data
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (isSpeaking)
|
||||||
|
{
|
||||||
byte[] data = Convert.FromBase64String(sections[1]);
|
byte[] data = Convert.FromBase64String(sections[1]);
|
||||||
uint sequenceNumber = uint.Parse(sections[2]);
|
uint sequenceNumber = uint.Parse(sections[2]);
|
||||||
commsNetwork.voiceReceived(dissonanceID, data, sequenceNumber);
|
commsNetwork.voiceReceived(dissonanceID, data, sequenceNumber);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -124,12 +127,15 @@ public class NetworkPlayer : MonoBehaviour
|
||||||
{
|
{
|
||||||
if(sections[1] == "0")
|
if(sections[1] == "0")
|
||||||
{
|
{
|
||||||
commsNetwork.playedStoppedSpeaking(dissonanceID);
|
commsNetwork.playerStoppedSpeaking(dissonanceID);
|
||||||
lastAudioId = 0;
|
lastAudioId = 0;
|
||||||
|
isSpeaking = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
commsNetwork.playerStartedSpeaking(dissonanceID);
|
commsNetwork.playerStartedSpeaking(dissonanceID);
|
||||||
|
lastAudioId = 0;
|
||||||
|
isSpeaking = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -153,7 +159,7 @@ public class NetworkPlayer : MonoBehaviour
|
||||||
public void sendAudioData(ArraySegment<byte> data)
|
public void sendAudioData(ArraySegment<byte> data)
|
||||||
{
|
{
|
||||||
string b64_data = Convert.ToBase64String(data.Array,data.Offset,data.Count);
|
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)
|
public void setDissonanceID(string id)
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ namespace Dissonance
|
||||||
|
|
||||||
public void voiceReceived(string sender,byte[] data,uint sequenceNumber)
|
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);
|
VoicePacketReceived(vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,16 +107,13 @@ namespace Dissonance
|
||||||
public void playerStartedSpeaking(string id)
|
public void playerStartedSpeaking(string id)
|
||||||
{
|
{
|
||||||
PlayerStartedSpeaking(id);
|
PlayerStartedSpeaking(id);
|
||||||
|
Debug.Log("player " + id + " started speaking");
|
||||||
}
|
}
|
||||||
public void playedStoppedSpeaking(string id)
|
public void playerStoppedSpeaking(string id)
|
||||||
{
|
{
|
||||||
PlayerStoppedSpeaking(id);
|
PlayerStoppedSpeaking(id);
|
||||||
|
Debug.Log("player " + id + " stopped speaking");
|
||||||
}
|
}
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,8 @@
|
||||||
EditorBuildSettings:
|
EditorBuildSettings:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Scenes: []
|
m_Scenes:
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/test.unity
|
||||||
|
guid: e4e43899246c941c78acfc59ce2f664a
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue