Thank you for your time, I really would like a script as I have a large volume to create.
I could not find a way to “reverse” a clip using script so currently I am trying to put a velocity envelope on every other clip and set it to -100.
This is what I have so far. It does get the selected clip and then paste it end to end x times, but I get the error;
“TrackEvent’ does not contain a definition for ‘Envelopes'”
when trying to add the velocity envelopes. Isnt each clip in a track a “trackevent”?
using System;
using System.Windows.Forms;
using Sony.Vegas;
public class EntryPoint
{
Vegas myVegas; //The vegas instance
TrackEvent initialEvent;
TrackEvent currentEvent;
Timecode endTime;
int totalClips = 4;
public void FromVegas(Vegas vegas)
{
myVegas = vegas;
initialEvent = FindSelectedEvent(vegas);
if (initialEvent != null)
{
endTime = initialEvent.Length;
for (int i = 1; i < totalClips; i++)
{
currentEvent = initialEvent.Copy(initialEvent.Track, endTime); // create a copy on the same track at endTime
endTime += initialEvent.Length; // add length offset
if(currentEvent.Index % 2 !=0) // if it is odd, it needs to play in reverse
{
// Add velocity envelope and set at -100
Envelope VolEnv = new Envelope(EnvelopeType.Velocity);
currentEvent.Envelopes.Add(VolEnv);
}
}
}
// FUNCTIONS
public TrackEvent FindSelectedEvent(Vegas vegas)
{
foreach (Track track in vegas.Project.Tracks)
{
foreach (TrackEvent trackEvent in track.Events)
{
if (trackEvent.Selected && trackEvent.Index == 0) // clip must be selected and the first one on the track
{
return trackEvent;
}
}
}
return null;
}
}