Exemple #1
0
    public static ProcessResult <Clip[]> Apply(PaddingOptions options, params Clip[] clips)
    {
        var processedClips = new Clip[clips.Length];

        for (var i = 0; i < clips.Length; i++)
        {
            var clip      = new Clip(clips[i]);
            var padAmount = options.PadAmount;
            if (options.Length > 0)
            {
                if (options.Length > clip.Length)
                {
                    padAmount = options.Length - clip.Length;
                }
                else
                {
                    processedClips[i] = Crop.CropClip(clip, 0, options.Length);
                    continue;
                }
            }

            clip.Length += padAmount;
            if (!options.Post)
            {
                foreach (var noteEvent in clip.Notes)
                {
                    noteEvent.Start += padAmount;
                }
            }

            processedClips[i] = clip;
        }

        return(new ProcessResult <Clip[]>(processedClips));
    }