ModelViewer.Sound.SoundManager.DecoderThread C# (CSharp) Method

DecoderThread() private method

private DecoderThread ( object wave ) : void
wave object
return void
        private void DecoderThread(object wave)
        {
            IPlayableStream stream = wave as IPlayableStream;

            lock (mutex)
            {
                while (true)
                {
                    if (current != wave)
                    {
                        return;
                    }

                    // Fill any unfilled buffers
                    for (var i = 0; i < bufferStatus.Count; i++)
                    {
                        if (bufferStatus.Get(i) == false)
                        {
                            bool isDone = FillBuffer(i, stream);
                            if (isDone)
                            {
                                return;
                            }
                        }
                    }

                    // Wait to be signalled that a buffer is empty
                    System.Threading.Monitor.Wait(mutex);
                }
            }
        }