newbie C++ & sync questions

dbritta1 wrote on 10/7/2007, 5:20 AM
Questions:
1) I am expert in C++ and Visual Studio, do not know C#. Is there a discussion of how to create Vegas scripts in C++ with examples?

2) I am using dual non-genlocked cameras, and am using a clicker to generate spikes on the audio tracks to time align clips using the Trimmer window. Are there any tools or scripts to automatically time align two audio tracks (and their corresponding video tracks) ?

Comments

DarrenStarr wrote on 10/7/2007, 12:09 PM
This is a pretty interesting question, so I'll try and post a pre-response before actually checking it myself. I develop multicamera HD video conferencing systems myself using C++ and frankly given what you're planning, I'd recommand tinkering with C# anyway. I can spend ages justifying the recommendation, but it's safer to just say, a true C++ developer should see C# as C++ with some Java structure and a "legacy free" object oriented class library instead of LibC. I promise you'll like it. I've even written an HD video camera driver for Linux in it with great success.

Selling is over...

You can in fact develop for Sony Vegas in C++ just as easily as you can in C#.

Create a managed class library (basically a .NET .DLL) project.

Implement your entry point function or inherit from the extensibility API (the API documentation is valid for C++ as well, .NET is .NET). I've written an earlier explanation of doing this with C#, I believe it should make sense to a C++ developer as well.

Just code.

You'll need to program as managed C++ for the most part, but with the exception of ditching delete and using gcnew instead of new, and learning the new "pointer/reference" operators, it's pretty straight forward.

I'm intending on setting up a proper Q&A blog for Vegas development soon. Maybe this would make a good first article.
dbritta1 wrote on 10/7/2007, 5:49 PM
Dear Darren,

I am following you recommendation and starting to use C#.

I downloaded vegaspro8scriptsdk.zip and unziped the sdk.

I followed the instructions in VegasScriptFAQ.html section 1.14 VERY carefully.

Everything worked as instructed until I started the debugger and tried Tools. Scripting.Run Script on the ...\VegasScripts\SampleScript1\bin\Debug\SampleScript1.dll inside Vegas and got the following error message:

Warning: An error occured during execution of the script.
An exception has occured.

The details button revealed:
System.ApplicationException: Failed to create instance of main class: 'EntryPoint'.
at Sony.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
at Sony.Vegas.ScriptHost.PrecompiledScriptManager.Run()
at Sony.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)

With Visual Studio closed, the same error occured when I started Vegas stand alone and tried Tools.Scripting.RunScript on the SampleScript1.dll .

I am using Vegas Version 7.0e (Build 216)
and Microsoft Visual Studio 2005
Version 8.0.50727 (SP.050727-7600)
with
Microsoft .NET Framework
Version 2.0.50727

The Computer is:
Operating System
Platform: Windows XP
Version: 5.01.2600 (Service Pack 2)
Language: English
System locale: English
User locale: English

Processor
Class: Intel(R) Core(TM)2 CPU 6700 @ 2.66GHz
Identifier: GenuineIntel
Number of processors: 2
MMX available: Yes
SSE available: Yes
SSE2 available: Yes
SSE3 available: Yes

Display
Primary: 1280x960x16

Memory
Physical memory: 1,047.0 MB
Paging memory available: 2,518.6 MB
Virtual memory possible: 2,097.0 MB

Any ideas what is wrong?

Dennis
Terje wrote on 10/7/2007, 6:53 PM
You don't have a class called EntryPoint. Scripting has changed a little with .NET 3.0, check some of the other examples out there.
dbritta1 wrote on 10/7/2007, 7:40 PM
Dear Terje,

The contents of Class1.cs in the SampleScript1 project is:

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Sony.Vegas;

namespace SampleScript1
{
public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
MessageBox.Show(vegas.Version);
}
}
}

Exactly from the instructions.

What do you mean "You don't have a class called EntryPoint."?

I do not have .NET 3.0 installed when inspecting ControlPanel:Add delete programs.

Can you please provide links to other .cs examples (I already have the .sc files from vegaspro8scriptsdk).

Removing the following 3 lines from a copy of Class1.cs:
namespace SampleScript1
{
}

allows the modified copy of the script to run correctly from Vegas.

Please, I am C++ & MFC expert, but have no experience with C#,
a more detailed solution would be appreciated.

Dennis
dbritta1 wrote on 10/7/2007, 10:50 PM
OK,

When I recompiled the dll with these 3 lines removed:
namespace SampleScript1
{
}

It works fine!

Question:
Why were those lines in the sample code,
was it an error, or am I missing somthing?

Dennis
JohnnyRoy wrote on 10/8/2007, 4:59 PM
> I downloaded vegaspro
> I am using Vegas Version

The problem is that you are using Vegas Pro 8 Script API with Vegas 7 (which doesn't always work).

> Why were those lines in the sample code,

Because the sample code is for Vegas Pro 8. In Vegas 7 you cannot have your EntryPoint in a namespace.

You should see if Sony has the Vegas 7 script API still available or else you are going to run into a lot of problems like this. There were lots of additions for Vegas Pro 8 that don't work in Vegas 7.

~jr
dbritta1 wrote on 10/9/2007, 1:35 AM
Dear Johnny,

Thanks for the clarification.

I have the debugger working now, and have started generating scripts.

I had downloaded both version 6 and 8 of the SDK, but did not find version 7 in the download section. Version 6 only had .js examples,
while version 8 had some .cs examples, I had to start somewhere.

Dennis