コード例 #1
0
 public PlaybackPool(CodecSettings codecSettings, IPriorityManager priority, IVolumeProvider volume)
 {
     _codecSettings = codecSettings;
     _priority      = priority;
     _volume        = volume;
     _pool          = new Pool <VoicePlayback>(6, CreatePlayback);
 }
コード例 #2
0
ファイル: DissonanceComms.cs プロジェクト: KarmaPenny/Hanabi
        private void Net_PlayerJoined([NotNull] string playerId, CodecSettings codecSettings)
        {
            // ReSharper disable once ConditionIsAlwaysTrueOrFalse (Justification: Sanity check against network system returning incorrect values)
            // ReSharper disable once HeuristicUnreachableCode
            if (Log.AssertAndLogError(playerId != null, "86074592-4BAD-4DF5-9B2C-1DF42A68FAF8", "Received a player-joined event for a null player ID"))
            {
                return;
            }

            if (playerId == LocalPlayerName)
            {
                return;
            }

            //Get a playback component for this player
            var playback = _playbackPool.Get(playerId);

            playback.CodecSettings = codecSettings;

            //Create the state object for this player
            var state = new RemoteVoicePlayerState(playback);

            _players.Add(state);

            //Associate state with the position tracker for this player (if there is one)
            _playerTrackers.AddPlayer(state);

            //Now we've set everything up activate the playback
            playback.gameObject.SetActive(true);

            if (OnPlayerJoinedSession != null)
            {
                OnPlayerJoinedSession(state);
            }
        }
コード例 #3
0
        private void GenerateSettings()
        {
            if (!_started)
            {
                throw Log.CreatePossibleBugException("Attempted to use codec settings before codec settings loaded", "9D4F1C1E-9C09-424A-86F7-B633E71EF100");
            }

            if (!_settingsReady)
            {
                lock (_settingsWriteLock)
                {
                    if (!_settingsReady)
                    {
                        _config        = GetEncoderSettings(_codec, _encoderQuality, _encoderFrameSize);
                        _settingsReady = true;
                    }
                }
            }
        }
コード例 #4
0
        private void Generate()
        {
            if (!_started)
            {
                throw Log.CreatePossibleBugException("Attempted to use codec settings before codec settings loaded", "9D4F1C1E-9C09-424A-86F7-B633E71EF100");
            }

            if (!_settingsReady)
            {
                lock (_settingsWriteLock)
                {
                    if (!_settingsReady)
                    {
                        //Create and destroy an encoder to determine the decoder settings to use
                        var encoder = CreateEncoder(_encoderQuality, _encoderFrameSize);
                        _config = new CodecSettings(_codec, (uint)encoder.FrameSize, encoder.SampleRate);
                        encoder.Dispose();

                        _settingsReady = true;
                    }
                }
            }
        }