コード例 #1
0
        private void AddDecodingBuffer(UserState userState)
        {
            // Make sure we don't double add
            if (_audioDecodingBuffers.ContainsKey(userState.Session))
            {
                return;
            }
            //Debug.Log("Adding : " + userState.Name + " #" + userState.Session);
            //Debug.Log("Adding decoder session #" + userState.Session);
            DecodedAudioBuffer buffer = _decodingBufferPool.GetDecodingBuffer();

            buffer.Init(userState.Name, userState.Session);
            _audioDecodingBuffers.Add(userState.Session, buffer);
            EventProcessor.Instance.QueueEvent(() =>
            {
                //Debug.Log("Adding audioPlayer session #" + userState.Session);
                // We also create a new audio player for the user
                MumbleAudioPlayer newPlayer = _audioPlayerCreator(userState.Name, userState.Session);
                _mumbleAudioPlayers.Add(userState.Session, newPlayer);
                newPlayer.Initialize(this, userState.Session);
            });
            if (OnNewDecodeBufferThreaded != null)
            {
                OnNewDecodeBufferThreaded(userState.Session);
            }
        }
コード例 #2
0
 // Dispose of all buffers that are currently in use
 public void Dispose()
 {
     while (_audioDecodingBuffers.Count != 0)
     {
         DecodedAudioBuffer decodingBuffer = _audioDecodingBuffers.Pop();
         decodingBuffer.Dispose();
     }
 }
コード例 #3
0
        public DecodedAudioBuffer GetDecodingBuffer()
        {
            DecodedAudioBuffer decodingBuffer;

            if (_audioDecodingBuffers.Count != 0)
            {
                decodingBuffer = _audioDecodingBuffers.Pop();
            }
            else
            {
                decodingBuffer = new DecodedAudioBuffer(_audioDecodeThread);
            }
            return(decodingBuffer);
        }
コード例 #4
0
 public void ReturnDecodingBuffer(DecodedAudioBuffer decodingBuffer)
 {
     decodingBuffer.Reset();
     _audioDecodingBuffers.Push(decodingBuffer);
 }