コード例 #1
0
ファイル: SoundManager.cs プロジェクト: yuandev/Barotrauma
        private void ReleaseResources(bool keepSounds)
        {
            for (int i = 0; i < playingChannels.Length; i++)
            {
                lock (playingChannels[i])
                {
                    for (int j = 0; j < playingChannels[i].Length; j++)
                    {
                        if (playingChannels[i][j] != null)
                        {
                            playingChannels[i][j].Dispose();
                        }
                    }
                }
            }

            streamingThread?.Join();
            for (int i = loadedSounds.Count - 1; i >= 0; i--)
            {
                if (keepSounds)
                {
                    loadedSounds[i].DeleteALBuffers();
                }
                else
                {
                    loadedSounds[i].Dispose();
                }
            }
            sourcePools[(int)SourcePoolIndex.Default]?.Dispose();
            sourcePools[(int)SourcePoolIndex.Voice]?.Dispose();

            SoundBuffers.ClearPool();
        }
コード例 #2
0
 public virtual void InitializeALBuffers()
 {
     if (!Stream)
     {
         buffers = new SoundBuffers(this);
     }
     else
     {
         buffers = null;
     }
 }