Ordering Inserted Tracks

2G wrote on 10/4/2005, 2:17 PM
I need to create several pairs of audio/video tracks. I want them to be video/audio/video/audio/video/audio just as would be typical for any multicam project. The problem is video tracks always add as the first track and audio tracks always add as the last track. So what I end up with is:

3Video
2Video
1Video
1Audio
2Audio
3Audio

I can't seem to find a way in the API to order tracks or to insert them at a certain index. I tried the "Insert" method (on the baselist class) which has an index parm. But I get an "unsupported method" error. So all I can do is the Add method and get the above ordering.

Am I missing something? Is there a way to get the new tracks ordered the way I want?

Thanks.

2G

Comments

jetdv wrote on 10/4/2005, 2:25 PM
Yes, you can specify an index value when adding via the API. For example, this line will add a video track just above the "current" track.

trackIndex = MyTrack.Index;
Mtrack = new VideoTrack(trackIndex, "Vid1");
2G wrote on 10/4/2005, 3:12 PM
Thanks. I'm glad to see the capability is there. But I never even thought to look in the constructor. Seems kinda strange to be inserting the track into the tracks list as part of the constructor. It seems to go against their normal OO programming model of "create an object" and then "insert it in a list".

Oh, well. I'll try to remember to look closer at constructor methods next time.

Thanks again.

2G