Community Forums Archive

Go Back

Subject:Determining if an effect is supported
Posted by: sjm
Date:6/20/2007 11:07:52 AM

I have a script that shows a dialog box with ComboBoxes that let the user choose an effect and a preset. To get the list of available effects, I iterate over IScriptableApp.Effects; when the user chooses an effect, I get the list of presets by iterating over ISfGenericEffect.Presets.

The problem is that there are sometimes effects in the list that are not supported by Sound Forge. I guess they're DirectX plugins registered by other applications; on my machine I have several that were installed by Nero, for example.

When I try to access the preset list for one of these effects, I get an AccessViolationException. I can catch this exception and continue, but it makes me nervous to be blithely ignoring exceptions in native code; it wouldn't surprise me if this is going to cause a crash somewhere down the line.

Is there any way to detect whether one of the ISfGenericEffects in the list is really valid and supported by Sound Forge, apart from querying its preset list and catching the exception? Is it safe to detect them this way?

Subject:RE: Determining if an effect is supported
Reply by: _TJ
Date:6/20/2007 12:33:05 PM

Trapping the AccessViolationException and continuing should be pretty safe. Sound Forge is pretty cautious about how we talk to untrusted code like DirectX plugins. Not everything reported to managed code as an AccessViolation is actually an access violation, the managed layer translates certain types of error returns from unmanaged code as AccessViolations as well.

You could also check the GUID of the plugin against a list of known not-actually-plugins. We have such a list built into Sound Forge, but vendors keep coming up with new plugings that they register as audio transforms that aren't really audio transforms. So we keep adding to our list.

If you send us the GUIDS, we'll get them added to the Sound Forge internal list for the next rev.

Also, if you send the GUID, and if I can find that plugin, I'll do a quick check to see if it's really a crash or just an error return causing the exception in your code.

tj



Go Back