How to iterate through all tracks from a specific track group

marcel-gielen wrote on 2/3/2023, 2:43 PM

I use Vegas pro mainly for holiday movies and like to use 5.1 audio (prefer 9.1 actually). It seems, unfortunately that Vegas (which started as an audio application from Sonic Foundry) is abandoning audio. All kinds of online video features are added, while audio features are removed (e.g. AC3 rendering)
Currently, If want to render 5.1, I create a BluRay disk image and extract the streams. What else to expect from a $300+ application ?

An "audio bus" (which is a nice feature to process audio tracks simultaneously), is not usable for 5.1 input and surround panning. So Vegas for surround editing, is unfortunately @#$%! and seems not to improve. Audio related functionality is removed, not improved or added. Probably after a couple of years we can only render in mono 😡 and in 2025 Vegas will support only "Silent Film" 😁

So far my rant, maybe it triggers somebody 😇 The video editing and the UI I are great, stability is reasonable and since I neglect subscription based software, the alternatives are limited. For this reason I decided to take a look at the C# scripting options to see if I can work around some surround editing limitations.

What I basically like to achieve, is to copy the volume envelopes (from selected events) from the first audio track in a track group, to the other tracks in the same group.
Basically very simple. but based on the API I can not find how to relate the track group to a track (or vice versa)

How to get all tracks from a ScriptPortal.Vegas.Trackgroup or in case if it works the other way around: how to get the Trackgroup to which a ScriptPortal.Vegas.track belongs ?

I know there is a groupId and a TrackId, but I did not find the functions to relate to each other. It is not obvious from the c# definition, nor from the API, but I expect I am just overlooking something.

Anyone who knows how to iterate through all tracks from a track group ?


 

Comments

marcel-gielen wrote on 2/4/2023, 3:32 AM

It turned out to be quite simple, in case someone needs it:

 

            foreach (TrackGroup grp in vegas.Project.TrackGroups)
            {
                foreach (Track track in grp)
                {
                    if (track.MediaType == MediaType.Audio)
                    {
                        track.Selected = true;
                    }
                }
            }

 

jetdv wrote on 2/4/2023, 8:38 AM

That's the way I would have done it! Have you gone through my tutorials? (Although I haven't referenced that specific task)

https://www.youtube.com/@JetDVScripts/videos

marcel-gielen wrote on 2/13/2023, 1:55 PM

I have seen some of your tutorials, they were helpful, thanks 😀