How do you iterate through the CDTracks collection?

roger_74 wrote on 1/25/2003, 7:40 AM
I'm trying this:
------------------------------------------------------------

import System.Windows.Forms;
import SonicFoundry.Vegas.Script;

var markerEnum = new Enumerator(Vegas.Project.CDTracks);

if (markerEnum.atEnd())
{
MessageBox.Show("There are no markers in this project.");
}
else
{
while (!markerEnum.atEnd())
{
var marker = markerEnum.item();

var output = "";
output += "Marker Index:\t" + marker.Index + "\n";
output += "Label:\t\t" + marker.Label + "\n";
output += "Position:\t\t" + marker.Position + "\n";
MessageBox.Show(output);

markerEnum.moveNext();
}
}

-----------------------------------------------------------------

But I only get the properties for the first track. If I have two tracks it shows the first track two times.

If I change this line
var markerEnum = new Enumerator(Vegas.Project.CDTracks);

to
var markerEnum = new Enumerator(Vegas.Project.Markers);

I can iterate through all the markers without a problem.

Any ideas on how to get all the track markers?

Comments

murk wrote on 1/25/2003, 1:39 PM
Your script seems fine, but your are right, it does not work. Mayhaps you have discovered a bug? It iterates though the CDTracks collection the correct number of times, but always displays the first CDTrack info.
SonyPJM wrote on 1/26/2003, 12:54 PM

Yes, you discovered a bug. Sorry about that. But the good news is
that I revamped markers a couple days ago and your script works fine
now. The other good thing (that comes as a result of my revamp) is
that scripts can now work with command markers.
roger_74 wrote on 1/26/2003, 1:40 PM
Sounds good... :-)

I have another question. Can I import my own (managed) dll into a script?

I tried:
import MyNamespace;

But it seems like the compiler doesn't automatically locate MyNamespace.dll at runtime. So that raises another question. Can I compile the js-file with jsc so that I can tell the compiler to look for MyNamespace.dll and the SonicFoundry dll with the /reference-option? I tried it a couple of different ways by referencing SonicFoundry.ScriptHost.dll but that didn't seem to have the correct namespace/classes.
SonyPJM wrote on 1/27/2003, 9:25 AM
I was hoping this question would come up... didn't have to wait long ;-)

You can reference your own assemblies in scripts by creating an XML
script configuration file with the same name as the script (except it
should have the .xml extension instead of .js or .vb). See the
PlaylistToProject sample script for an example.

The inner text of each AssemblyReference tag in the XML configuration
file identifies extra assemblies that the script references. For
assemblies not in the GAC, the AssemblyReference element text should
have the full path of the assembly dll. For cases where you want to
distribute the assembly with the script, install the assembly in the
GAC or in the same directory as the script and give the
AssemblyReference tag the attribute IsLocal="true". The IsLocal
attribute instructs the Vegas script host to look in the same
directory as the script.
roger_74 wrote on 1/27/2003, 10:18 AM
This is so cool.

Expect to see a .cue-file exporter from me in the near future. This will enable us to burn CD-Text songtitles collected from CDTracks markers...

Or will Vegas 4 support CD-Text natively? It was hinted at earlier: http://www.sonicfoundry.com/forums/ShowMessage.asp?MessageID=106037&Page=0
SonyPJM wrote on 1/27/2003, 11:19 AM

The ISRC field(s) for CD track markers is not accessible via script
yet... I'll do my best to get it in before we release.
roger_74 wrote on 1/27/2003, 11:25 AM
But I can get the names of the CDTrack-markers and output a .cue-file with CD-Text data inserted from the markers. Then burn with any software compatible with cue-files.
SonyPJM wrote on 1/27/2003, 11:27 AM
I should point out that Vegas 4 still does not write CD-Text though... just ISRC codes.
SonyPJM wrote on 1/27/2003, 11:28 AM
Right... sounds cool!
roger_74 wrote on 1/27/2003, 11:31 AM
"I should point out that Vegas 4 still does not write CD-Text though... just ISRC codes."

Which is exactly why I want to make a cue-file. English isn't my first language so I'm probably not explaining it clear enough... But I think you got it in your other post.
roger_74 wrote on 2/3/2003, 4:46 AM
As soon as Vegas is released I'll upload my Cue Sheet Exporter. It collects track titles and performers from the CD track markers in Vegas. This will allow you to burn CD's with CD-Text (you can't do the actual burning in Vegas though).

Here's a screenshot: cuesheetexporter.gif