예제 #1
0
        private void MixWAVFiles()
        {
            this.CreateDirectoryIfNotExists(workingDir + "\\export\\total");

            while (true)
            {
                // Check if all threads need to be stopped
                if (StopCurrentThread())
                {
                    return;
                }

                if (fadeInOutWAV.Count == this.totalFragments && totalFragments > 0)
                {
                    break;
                }

                System.Threading.Thread.Sleep(1);
            }

            ActiveStatus = 1;

            List <WAVInputFile> files = new List <WAVInputFile>();

            for (int i = 0; i < fadeInOutWAV.Count; i++)
            {
                files.Add(new WAVInputFile(this.fadeInOutWAV[i], (fragmenten[i].FadeOut - new DateTime(2000, 1, 1)).TotalSeconds));
            }

            OnUpdated();

            try
            {
                WAVFile.MixAudioFiles(files.ToArray(), workingDir + "\\export\\total\\output.wav", workingDir + "\\export\\total\\temp");
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }

            ActiveStatus = 3;
            OnUpdated();
        }