Adding Envelopes to VideoTrack EVENT!

lnetzel wrote on 7/14/2003, 4:28 PM
I just read this

http://www.ayizwe.net/VegasScripts/FAQ.html#3.2

And it says you can add an Envelope to a track (Volume on Audiotrack in the example) OR EVENT by doing this:

var volumeEnvelope = new Envelope(EnvelopeType.Volume);
audioTrack.Envelopes.Add(volumeEnvelope);

I did try this, but with a VelocityEnvelope on a VideoTrack Event and I really can't find the Envelopes collection on the Event... I guess there are none!

So how do I do this (I work with VB.NET)?
---------------------------------------------
While EventEnum.MoveNext 'Loop through Events
Dim TrackEvent As SonicFoundry.Vegas.TrackEvent
TrackEvent = CType(EventEnum.Current, SonicFoundry.Vegas.TrackEvent)
If TrackEvent.Selected Then
Dim VelEnv As New Envelope(EnvelopeType.Velocity)
TrackEvent.???????????NEED HELP RIGHT HERE

End If
End While
-------------------------------------------------

Thanks

Comments

jetdv wrote on 7/14/2003, 10:22 PM
Here's an example for adding a velocity envelope to an event in JScript:



var vevnt : VideoEvent = VideoEvent(evnt);

// Find the volume envelope on the music track - add if needed
var VelEnv : Envelope = FindVEEnvelope(vevnt, EnvelopeType.Velocity);
if (null == VelEnv) {
VelEnv = new Envelope(EnvelopeType.Velocity);
vevnt.Envelopes.Add(VelEnv);
}



Note: FindVEEnvelope is a function that looks to see if the velocity envelope is already on this event and is not shown here.


So, I'm guessing your code would be:

TrackEvent.Envelopes.Add(VelEnv)
lnetzel wrote on 7/15/2003, 2:21 AM
Yes and no! I had a TrackEvent and there are no Envelopes on TrackEvents... I Declared my event as VieoEvent instead as you did, and now it works!

Thank you!