private void ThreadFunctionActionDecrypt(WavFormatManager wfm, String originalName)
        {
            WindowPasswordInput wpi = new WindowPasswordInput(WindowPasswordInput.ProcessType.DECRYPTION, originalName);

            if (wpi.ShowDialog() == true)
            {
                WavFormatManager encryptedSound = new WavFormatManager();
                encryptedSound.SetBitsPerSample(24);
                encryptedSound.SetSampleRate(wfm.GetSampleRate());

                if (wfm.GetNumberOfChannels() == 1)
                {
                    encryptedSound.SetChannelCount(1);

                    Complex[] frq = FourierTransform.FFT_segmented(wfm.ReadAudioMono());
                    CryptoFFT.Decrypt(frq, wpi.GetPassword());
                    encryptedSound.WriteAudioMono(FourierTransform.IFFT_segmented(frq));
                }
                else
                {
                    encryptedSound.SetChannelCount(2);

                    Complex[] frqLeft  = FourierTransform.FFT_segmented(wfm.ReadAudioLeft());
                    Complex[] frqRight = FourierTransform.FFT_segmented(wfm.ReadAudioRight());
                    CryptoFFT.Decrypt(frqLeft, wpi.GetPassword());
                    CryptoFFT.Decrypt(frqRight, wpi.GetPassword());
                    encryptedSound.WriteAudioLeft(FourierTransform.IFFT_segmented(frqLeft));
                    encryptedSound.WriteAudioRight(FourierTransform.IFFT_segmented(frqRight));
                }

                Dispatcher.Invoke(new AddSoundPanelDelegate(CommitProcessedSoundToInterface), encryptedSound, wpi.GetName());
            }
        }
        public WaveStreamProvider(WavFormatManager wfm, WindowMain.PlotGraphsDelegate plotDelegate, Window windowHandle)
        {
            this.plotMethod = plotDelegate;
            this.handle     = windowHandle;

            this.streamFormat = new WaveFormat((int)wfm.GetSampleRate(), 16, wfm.GetNumberOfChannels());

            if (this.streamFormat.Channels == 1)
            {
                this.bufferMono = wfm.ReadAudioMono();
            }
            else
            {
                this.bufferLeft  = wfm.ReadAudioLeft();
                this.bufferRight = wfm.ReadAudioRight();
            }

            currentBufferIndex = 0;

            this.stopThread    = false;
            this.plotterThread = new Thread(new ThreadStart(this.PlotterThreadFunction));
            this.plotterThread.Start();
        }