Monitoring transport state from script/extension?

taji wrote on 12/9/2012, 12:23 PM
I'm syncing Vegas 10.0e and Reaper 4.31 together using MTC. Reaper is chasing sync fine except for one irritating issue: If I hit PAUSE in Vegas, playback in Reaper returns to the location of the edit cursor. This means that every time I stop playback in Vegas and toggle to Reaper, I have to hit some keys to move the edit cursor to the same location as Vegas.

I'd like to write a script or extension that monitors the transport state in Vegas and if the transport stops, sends the correct keystrokes to Reaper to have it automatically move the edit cursor to the correct location. I was thinking of providing a configuration parameter in Vegas that enables/disables the feature at will.

I've looked over the scripting faq and the api reference and there is a boolean TransportControl.IsPlaying property but I don't see anything in the api that describes a mechanism for continuously monitoring the property for state change. This could be an event (such as OnPlayingChanged or maybe spawning a thread that blocks on or polls the IsPlaying property, etc.

What would be the best way to approach this issue?

Thanks,

Todd.

Comments

Gary James wrote on 12/9/2012, 5:29 PM
To do what you want you'll need to design a Vegas Command Extension DLL. The Vegas API has two events that you can use: PlaybackStarted, and PlaybackStopped. When the PlabackStopped event fires simply read the Transport Cursor Location and perform your SendKeys operation to your other program.

If you've never designed a Vegas Pro Extension DLL, I have a Sample Project available for Visual Studio 2010 that you can download from my Timeline Tools web sight.

taji wrote on 12/10/2012, 10:41 AM
Exactly what I was looking for. I've looked over your site and the sample project. Perfect.

Thanks!