How to cancel "Building peaks"

ingvarai wrote on 3/6/2015, 4:00 AM
Hi,
I want to programmatically do the same, as when the user clicks the Cancel button, when Vegas is building peaks. I can do Vegas.CancelAsynchronousTasks();
But that seems to cancel also some other important operations, because if I invoke this, Vegas behaves strange, both when opening and saving projects.
For example, if I invoke CancelAsynchronousTasks() after the project has been opened, Vegas won't save a project when I press Ctrl+S, I have to press Ctrl+S twice. This is 100% reproducible.
The time after CancelAsynchronousTasks() was invoked is unimportant, I can have dinner, come back, and still Ctrl+S has to be pressed twice.

Please, I beg you, don't ask or discuss why I want to cancel Building Peaks. There are countless threads on the Internet where this is discussed. I want, under certain conditions, to cancel Building Peaks in my extension. Period.

So, is there another way to cancel building peaks programmatically? Or something I have overlooked regarding CancelAsynchronousTasks()? Some Vegas events I can use perhaps?
Any help appreciated, very much :)

-Ingvar

Comments

astar wrote on 3/8/2015, 4:24 PM
I thinking about this. If you do not need the peaks, could you work around it? Maybe write a routine that creates blank .sfk files for each media, that way vegas will not run the peak builder?

Just a thought.
ingvarai wrote on 3/10/2015, 9:52 PM
Hi,
a good idea! But it seems that Vegas will rund the peak builder based on certain criteria, that I have no control over. So the emty file approach will not work.
I wish the Vegas API gave us a little more control over what is happening. For example, you can invoke WaitForIdle(); and it sure waits. Yes, it waits, and waits, and waits, perhaps a century, what do I know, execution never resumes.

I have found a solution which involves using timer(s). But it i shaky. And fragile. And I will never release anyhting shaky. What works on my machine, might crash on another setup.

-Ingvar