Bin enumeration bug in Vegas 4.0b?

aboukirev wrote on 4/18/2003, 6:37 PM
It broke my script.
I'm enumerating subbins of RootBin in the search for one with specific name.
Vegas 4.0b always returns "Media Bins" (root bin) on first iteration and never returns actual first subbin.
Apparently that worked properly in original Vegas 4.0.

I'm not sure if I should report this to e-mail support.

Alexei

Comments

SonyPJM wrote on 4/21/2003, 8:28 AM
I have not been able to reproduce this... can you post a sample of your code?
aboukirev wrote on 4/21/2003, 9:49 AM
Create three bins "slides1", "slides2", "slides3" in that order.
Run the script with var binName set to each of these. "slides1" is not found.

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

var binName = "slides1";

var bin = FindMediaBin(Vegas.Project.MediaPool.RootMediaBin, binName);
if (bin == null) {
MessageBox.Show("Could not find '" + binName + "' bin in Media Pool.");
} else {
MessageBox.Show("Success!");
}

// Walk the bin tree recursively until the 'name' is found.
// If several bins on different levels have the same name, first one will be
// returned.
function FindMediaBin(parent: MediaBin, name: String): MediaBin {
if (String.Compare(parent.Name, name) == 0) {
return parent;
}
var binEnum = new Enumerator(parent);
while (!binEnum.atEnd()) {
var abin = binEnum.item();
if ((abin instanceof MediaBin) && (abin.Name != parent.Name)) {
// Recurse here.
abin = FindMediaBin(abin, name);
if (abin != null)
return abin;
}
binEnum.moveNext();
}
return null;
}

Alexei
SonyPJM wrote on 4/21/2003, 10:45 AM
I got "Success"... I'll have to roll back to the 4.0b build to make sure it hasn't been fixed since we released... that'll take some time.
SonyPJM wrote on 4/22/2003, 4:23 PM

I'm still not able to reproduce this bug. Any additional details
would be appreciated. Does it happen for every project you create or
just one particular project? Do the bins shown in the media pool
window look correct?
aboukirev wrote on 4/22/2003, 7:49 PM
Well, I did not find this problem myself, it was reported by a user of the script I wrote. I asked him to send me just veg file to experiment with. It seems that this problem is specific that file, since I'm not able to reproduce it on any new project I create. I suspect some sort of file corruption. Strangely the project, media pool, and bins look fine in Vegas (excluding the fact that all the media is offline), and my script works fine for all bins except first. I assume you have some means to check veg file integrity (seems like a Windows 'riff' file to me).

I asked permission to share that veg file with you if you are willing to take a look at it. So far, this problem is localized to that project and there is workaround (using non-first bin). So, I guess, it's not critical.

In case you are interested what the bigger script is, it's SlideshowToMarkers.js and is on www.sundancemedia.com site. It's to place subsequent images/events to markers on timeline. Assuming you put markers to the beat of your soundtrack, that produces a nice slideshow synchronized to music.

Thanks for your support.

Alexei
SonyPJM wrote on 4/23/2003, 9:39 AM

I had a feeling it might be a corrupt project. I don't really need
the file... given your description of the problem, I have a pretty
good idea of what is wrong.

I believe a fix for that particular project would be to delete and
recreate the first media bin.
aboukirev wrote on 4/23/2003, 9:50 AM
Yes, recreating bin works.
Shame on me, as a programmer should have figured out that it was that particular file before trying to blame it on Vegas.
Anyway, back in business now.

Alexei