Пример #1
0
        private static void CreateWatermark(ITrackContainer tracks, string imageName, double duration)
        {
            var videoTrack = tracks.AddTrack();
            var clip       = videoTrack.AddImage(imageName, 0, duration);

            clip.AddEffect(0, duration, StandardEffects.CreateAlphaSetterRamp(0.5));

            videoTrack.AddTransition(0, duration,
                                     StandardTransitions.CreateKey(KeyTransitionType.Rgb, null, null, null, 0x00FFFFFF, null),
                                     false);
        }
Пример #2
0
        /// <summary>
        /// Adds the voice track
        /// </summary>
        /// <param name="tracks">The track container that will hold the new track</param>
        /// <param name="text">The text that will be converted to speech</param>
        /// <returns>The new text-to-speech track</returns>
        private ITrack AddVoiceTrack(ITrackContainer tracks, string text)
        {
            var audioTrack = tracks.AddTrack();

            var audioFileName = Path.Combine(workArea, "voice.wav");
            var voice         = CreateVoice();

            CreateAudioFile(audioFileName, voice, text);

            audioTrack.AddAudio(audioFileName);

            return(audioTrack);
        }
Пример #3
0
        /// <summary>
        /// Adds the sound files in a random order
        /// </summary>
        /// <param name="tracks">The track container that will hold the new track</param>
        /// <param name="soundFiles">The list of sound files to add</param>
        /// <param name="duration"></param>
        /// <returns>The new track</returns>
        private ITrack AddBackgroundMusic(ITrackContainer tracks, IList <string> soundFiles, double duration)
        {
            var audioTrack = tracks.AddTrack();

            if (soundFiles.Any())
            {
                var shuffled = shuffler.Shuffle(soundFiles);
                foreach (var soundFile in shuffled)
                {
                    audioTrack.AddAudio(soundFile, 0, duration);
                }
                audioTrack.AddEffect(0, audioTrack.Duration, StandardEffects.CreateAudioEnvelope(0.05));
            }

            return(audioTrack);
        }