Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CombTransition" /> class.
 /// </summary>
 /// <param name="duration">The duration.</param>
 /// <param name="effect">The effect.</param>
 public CombTransition(TimeSpan duration, EffectOptions effect)
     : base(duration)
 {
     this.segments     = 5;
     this.spriteBatch  = new SpriteBatch(this.graphicsDevice);
     this.effectOption = effect;
 }
Пример #2
0
 public EffectGeneratorService(IOptions <EffectOptions> effectOptions, IOptions <CaptchaOptions> captchaOptions)
 {
     _effectOptions  = effectOptions?.Value;
     _captchaOptions = captchaOptions?.Value;
     _effects        = new List <IEffect>()
     {
         new BlobEffect(_captchaOptions),
         new BoxEffect(_captchaOptions),
         new LineEffect(_captchaOptions),
         new NoiseEffect(_captchaOptions),
         new WaveEffect(_captchaOptions),
         new RippleEffect(_captchaOptions)
     };
     _effects = _effects.Where(e => _effectOptions.TryGetValue(e.GetType().Name, out bool enabled) ? enabled : false).ToList();
     _effects.Sort((a, b) => a.Order.CompareTo(b.Order));
 }
Пример #3
0
        private void CleanVinylRecording(string presetName, int noiseReductionPasses, SfAudioSelection noiseprintSelection)
        {
            SfAudioSelection selection = _fileTasks.SelectAll();

            _fileTasks.ApplyEffectPreset(App, selection, EffectNames.ClickAndCrackleRemoval, presetName, EffectOptions.EffectOnly, Output.ToScriptWindow);
            for (int i = 1; i <= noiseReductionPasses; i++)
            {
                Output.ToScriptWindow("Noise Reduction (pass #{0})", i);
                EffectOptions noiseReductionOption = EffectOptions.EffectOnly;
                //if (i == 1)
                //    noiseReductionOption = EffectOptions.DialogFirst;
                _fileTasks.CopySelectionToStart(App, noiseprintSelection);
                _fileTasks.ApplyEffectPreset(App, selection, EffectNames.NoiseReduction, presetName, noiseReductionOption, Output.ToScriptWindow);
                _file.Window.SetSelectionAndScroll(0, _noiseprintSelection.Length, DataWndScrollTo.NoMove);
                App.DoMenuAndWait("Edit.Delete", false);
            }
            Output.LineBreakToScriptWindow();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PushTransition" /> class.
 /// </summary>
 /// <param name="duration">The duration.</param>
 /// <param name="effect">The effect.</param>
 public PushTransition(TimeSpan duration, EffectOptions effect)
     : base(duration)
 {
     this.spriteBatch = new SpriteBatch(this.graphicsDevice);
     this.effectOption = effect;
 }
Пример #5
0
        public void ApplyEffectPreset(IScriptableApp app, SfAudioSelection selection, string effectName, string presetName, EffectOptions effectOption, OutputHelper.MessageLogger logger)
        {
            if (effectOption == EffectOptions.ReturnPreset || effectOption == EffectOptions.WaitForDoneOrCancel)
            {
                throw new ScriptAbortedException("Invalid EffectOptions option: " + effectOption);
            }

            ISfGenericEffect effect = app.FindEffect(effectName);

            if (effect == null)
            {
                throw new ScriptAbortedException(String.Format("Effect '{0}' was not found.", effectName));
            }

            ISfGenericPreset preset = effect.GetPreset(presetName);

            if (preset == null)
            {
                throw new ScriptAbortedException(String.Format("Preset '{0}' was not found for effect '{1}'.", presetName, effectName));
            }

            if (logger != null)
            {
                logger("Applying Effect '{0}', Preset '{1}'...", effect.Name, preset.Name);
            }

            _file.DoEffect(effectName, presetName, selection, effectOption | EffectOptions.WaitForDoneOrCancel | EffectOptions.ReturnPreset);
        }