Beispiel #1
0
 protected override void InitalizeConcreteAudioEffect()
 {
     AudioReverbEffect.ReverbEffectInit(
         (int)audioEffectParameters["Delay"],
         (float)audioEffectParameters["Decay"]
         );
 }
        private void ReverbEffectWorkHandler(object sender, DoWorkEventArgs e)
        {
            List <object> passedParams = e.Argument as List <object>;
            int           delay        = (int)passedParams[0];
            double        decay        = (double)passedParams[1];

            audioItem = AudioItemManager.GetAudioItem();

            if (audioItem != null)
            {
                SetMaxProgressBar();

                float[] samplesToProcess;
                long    beginIndex, endIndex;
                int     seconds, miliseconds, minutes;
                int     fullTime = 0;
                SetDataForProcessing(out samplesToProcess, out minutes, out beginIndex, out endIndex, out seconds, out miliseconds);

                AudioReverbEffect.ReverbEffectInit((short)delay, (float)decay);

                int begIndex = (int)beginIndex;
                int enIndex  = (int)endIndex;

                AudioReverbEffect.AddReverbEffect(ref samplesToProcess, begIndex, enIndex, ref fullTime);

                this.disp.Invoke(DispatcherPriority.Normal, new Action(delegate()
                {
                    MainWindow.progressBar.Value = 100; // Do all the ui thread updates here
                }));

                audioItem.ProcessedAudioBuffer = samplesToProcess;

                AudioItemManager.SetAudioItem(audioItem);

                ResetProgressBar();

                var milisecondsTime = (double)fullTime / 1000;

                e.Result = "Selection : " + minutes + ":" + AudioItemManager.Instance.GetBeginSpan().Seconds.ToString() + ":" + AudioItemManager.Instance.GetBeginSpan().Milliseconds.ToString() + " - " + AudioItemManager.Instance.GetEndSpan().Minutes.ToString() + ":" + AudioItemManager.Instance.GetEndSpan().Seconds.ToString() + ":" + AudioItemManager.Instance.GetEndSpan().Milliseconds.ToString() +
                           "  " + " -> Processed Reverb effect on audio sample!" + "\nProcessing range length: " + (endIndex - beginIndex).ToString() +
                           "\n" + dllType.ToString() + " library time elapsed: " + milisecondsTime.ToString() + " msec" + "\nThreads count: " + threadsValue.ToString();
            }
            else
            {
                e.Result = "Audio not loaded!";
            }
        }