예제 #1
0
 internal PlayerChannel(ushort subscriptionId, string playerId, PlayerChannels channels, ChannelProperties properties)
 {
     _subscriptionId = subscriptionId;
     _playerId       = playerId;
     _channels       = channels;
     _properties     = properties;
 }
예제 #2
0
        // ReSharper restore EventNeverSubscribedTo.Global
        #endregion

        public DissonanceComms()
        {
            _playbackPool    = new Pool <VoicePlayback>(6, CreatePlayback);
            _rooms           = new Rooms();
            _playerChannels  = new PlayerChannels(this);
            _roomChannels    = new RoomChannels(this);
            _text            = new TextChat(() => _net);
            _players         = new List <VoicePlayerState>();
            _playersReadOnly = new ReadOnlyCollection <VoicePlayerState>(_players);
            _playersLookup   = new Dictionary <string, VoicePlayerState>();

            _rooms.JoinedRoom += name => Log.Debug("Joined chat room '{0}'", name);
            _rooms.LeftRoom   += name => Log.Debug("Left chat room '{0}'", name);

            _playerChannels.OpenedChannel += OnChannelOpenedOrClosed;
            _roomChannels.OpenedChannel   += OnChannelOpenedOrClosed;
            _playerChannels.ClosedChannel += OnChannelOpenedOrClosed;
            _roomChannels.ClosedChannel   += OnChannelOpenedOrClosed;

            _playerChannels.OpenedChannel += (id, _) => {
                Log.Debug("Opened channel to player '{0}'", id);
            };

            _playerChannels.ClosedChannel += (id, _) => {
                Log.Debug("Closed channel to player '{0}'", id);
            };

            _roomChannels.OpenedChannel += (id, _) => {
                Log.Debug("Opened channel to room '{0}'", id);
            };

            _roomChannels.ClosedChannel += (id, _) => {
                Log.Debug("Closed channel to room '{0}'", id);
            };
        }
예제 #3
0
        // ReSharper restore EventNeverSubscribedTo.Global
        #endregion

        public DissonanceComms()
        {
            _playbackPool            = new PlaybackPool(_codecSettings, (IPriorityManager)this, (IVolumeProvider)this);
            _playerChannels          = new PlayerChannels((IChannelPriorityProvider)this);
            _roomChannels            = new RoomChannels((IChannelPriorityProvider)this);
            _text                    = new TextChat(() => _net);
            _autoChannelDuck         = new OpenChannelVolumeDuck(_roomChannels, _playerChannels);
            _playerTrackers          = new PlayerTrackerManager(_players);
            _playbackPriorityManager = new PriorityManager(_players);
            _capture                 = new CapturePipelineManager(_codecSettings, _roomChannels, _playerChannels, Players);
        }
예제 #4
0
        public LocalVoicePlayerState(string name, [NotNull] IAmplitudeProvider micAmplitude, [NotNull] Rooms rooms, [NotNull] RoomChannels roomChannels, [NotNull] PlayerChannels playerChannels)
            : base(name)
        {
            _rooms          = rooms;
            _micAmplitude   = micAmplitude;
            _roomChannels   = roomChannels;
            _playerChannels = playerChannels;

            rooms.JoinedRoom             += OnLocallyEnteredRoom;
            rooms.LeftRoom               += OnLocallyExitedRoom;
            roomChannels.OpenedChannel   += OnChannelOpened;
            roomChannels.ClosedChannel   += OnChannelClosed;
            playerChannels.OpenedChannel += OnChannelOpened;
            playerChannels.ClosedChannel += OnChannelClosed;
        }
예제 #5
0
        public LocalVoicePlayerState(string name, [NotNull] IAmplitudeProvider micAmplitude, [NotNull] Rooms rooms, [NotNull] RoomChannels roomChannels, [NotNull] PlayerChannels playerChannels, [NotNull] ILossEstimator loss, [NotNull] ICommsNetwork network)
            : base(name)
        {
            _rooms          = rooms;
            _micAmplitude   = micAmplitude;
            _roomChannels   = roomChannels;
            _playerChannels = playerChannels;
            _loss           = loss;
            _network        = network;

            rooms.JoinedRoom             += OnLocallyEnteredRoom;
            rooms.LeftRoom               += OnLocallyExitedRoom;
            roomChannels.OpenedChannel   += OnChannelOpened;
            roomChannels.ClosedChannel   += OnChannelClosed;
            playerChannels.OpenedChannel += OnChannelOpened;
            playerChannels.ClosedChannel += OnChannelClosed;
        }
예제 #6
0
        public void Start([NotNull] string name, [NotNull] IAmplitudeProvider micAmplitude, [NotNull] Rooms rooms, [NotNull] RoomChannels roomChannels, [NotNull] PlayerChannels playerChannels, [NotNull] ILossEstimator loss)
        {
            if (name == null)
            {
                throw new ArgumentException("name");
            }
            if (micAmplitude == null)
            {
                throw new ArgumentException("micProvider");
            }
            if (rooms == null)
            {
                throw new ArgumentNullException("rooms");
            }
            if (roomChannels == null)
            {
                throw new ArgumentException("roomChannels");
            }
            if (playerChannels == null)
            {
                throw new ArgumentException("playerChannels");
            }
            if (loss == null)
            {
                throw new ArgumentException("playerChannels");
            }

            Local = new LocalVoicePlayerState(name, micAmplitude, rooms, roomChannels, playerChannels, loss);

            Add(Local);
        }