Vegas Version: 17
I've been scripting in Vegas Pro for about 4 years. I've encountered a bizarre scripting exception with the PitchSemis property which I have never seen before, while working with one specific audio file in Vegas Pro. This is the exception text:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component. at ScriptPortal.Vegas.IEventCOM.GetPitchSemis(UInt32 trackID, Int64 eventID, Double& value) at ScriptPortal.Vegas.AudioEvent.get_PitchSemis() --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at ScriptPortal.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName) at ScriptPortal.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)
Steps to reproduce the error:
1. Load this audio file into the zeroth track in Vegas Pro.
2. Run this code:
using ScriptPortal.Vegas; public class EntryPoint { Vegas this_application; public void FromVegas(Vegas vegas) { this_application = vegas; AudioEvent audio_event = (AudioEvent) this_application.Project.Tracks[0].Events[0]; var pitchsemis = audio_event.PitchSemis; } }
This code should assign the PitchSemis property of the zeroth audio event on the zeroth track to a variable.
The code has only raised this exception on the audio event generated from the particular audio file that I linked to (I did not upload the file directly because the forum does not support the upload of FLAC files). This leads me to believe that there is a unique property of this file that is causing an error in Vegas Pro's internal API.
To be clear, I have not tried modifying audio the file, because I am not working on a video project that uses it. I am developing a program that integrates with Vegas Pro, and I'd like my program to be robust, so I need to handle errors like these. Hoping y'all have some insight so I don't have to slap another try{}catch{} into my program! :)