private void ReceiveAudio(AudioPacket packet, DhtClient client) { if (!RemoteVoices.ContainsKey(client.UserID)) { RemoteVoices[client.UserID] = new RemoteVoice(); } RemoteVoice user = RemoteVoices[client.UserID]; if (!user.Streams.ContainsKey(client.RoutingID)) { user.Streams[client.RoutingID] = new PlayAudio(this, packet.FrameSize, user); Players.SafeAdd(user.Streams[client.RoutingID]); } PlayAudio stream = user.Streams[client.RoutingID]; // reset if user changed quality setting if (stream.FrameSize != packet.FrameSize) { stream.Dispose(); user.Streams[client.RoutingID] = new PlayAudio(this, packet.FrameSize, user); Players.SafeAdd(user.Streams[client.RoutingID]); stream = user.Streams[client.RoutingID]; } StartAudioThread(false); stream.Receive_AudioData(packet.Audio); UpdateVolume(); }
public void AddMember(ulong user) { if (!Members.SafeContains(user)) { Members.SafeAdd(user); } }
public void StartInstance(string path) { SimInstance instance = new SimInstance(this, InstanceCount++); instance.Context = new DeOpsContext(instance, StartupPath, DefaultIcon); // ip byte[] ipbytes = new byte[4] { (byte)RndGen.Next(99), (byte)RndGen.Next(99), (byte)RndGen.Next(99), (byte)RndGen.Next(99) }; if (LAN) { ipbytes[0] = 10; } else if (Utilities.IsLocalIP(new IPAddress(ipbytes))) { ipbytes[0] = (byte)RndGen.Next(30, 70); // make non lan ip } instance.RealIP = new IPAddress(ipbytes); // firewall instance.RealFirewall = FirewallType.Open; int num = RndGen.Next(100); if (num < PercentBlocked) { instance.RealFirewall = FirewallType.Blocked; } else if (num < PercentBlocked + PercentNAT) { instance.RealFirewall = FirewallType.NAT; } // processor instance.ThreadIndex = NextAffinity++; if (NextAffinity >= Environment.ProcessorCount) { NextAffinity = 0; } // hook instance into maps SimMap[instance.RealIP] = instance; if (LoadOnline) { Login(instance, path); } Instances.SafeAdd(instance); InstanceChange(instance, InstanceChangeType.Add); }
private void UpdateLog(UpnpLogType type, string message) { if (type == UpnpLogType.Other || type == UpnpLogType.Error) { Network.UpdateLog("UPnP", message); } if (!Logging) { return; } if (type == UpnpLogType.In || type == UpnpLogType.Out) { message = FormatXml(message); } Log.SafeAdd(new Tuple <UpnpLogType, string>(type, message)); }
public uint CreateProject(string name) { uint id = (uint)Core.RndGen.Next(); ProjectNames.SafeAdd(id, name); LocalTrust.AddProject(id, true); ThreadedList<OpLink> roots = new ThreadedList<OpLink>(); roots.SafeAdd(LocalTrust.GetLink(id)); ProjectRoots.SafeAdd(id, roots); SaveLocal(); return id; }