Community Forums Archive

Go Back

Subject:Plugin Query script
Posted by: timaddy
Date:11/1/2006 8:59:11 AM

Below is an example script that I used to query the Sony Express Fx Audio Restoration plugin (Most of this code has been mentioned by other people but I thought its worth including as it has an exact example for a particular plugin that can be modified for use on other plugins.


//Script to check the settings of a preset and query the settings to find out how many bytes
//are required via a preset to configure the plugin preset settings

//Script to check the settings of a preset and query the settings to find out how many bytes
//are required via a preset to configure the plugin preset settings

using System;
using System.IO;
using System.Windows.Forms;
using SoundForge;
public class EntryPoint {
public void Begin(IScriptableApp app) {
ISfGenericEffect fx = app.FindEffect("Sony ExpressFX Audio Restoration");
ISfGenericPreset preset0 = fx.ChoosePreset(IntPtr.Zero, 0);//Change 0 to another number to find out the preset settings
DPF("preset Name='{0}'\r\n byte[] abData = new byte[{1}] {{\r\n ", preset0.Name, preset0.Size);
byte[] abData = preset0.Bytes;
for (int ii = 0; ii < abData.Length; ++ii)
{
DPF("~`{0:d},", abData[ii]);
}
DPF(" };");
}
public void FromSoundForge(IScriptableApp app) {
ForgeApp = app; //execution begins here
app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name));
Begin(app);
app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name));
}
public static IScriptableApp ForgeApp = null;
public static void DPF(string sz) { ForgeApp.OutputText(sz); }
public static void DPF(string fmt, object o) { ForgeApp.OutputText(String.Format(fmt,o)); }
public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); }
public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); }
} //EntryPoint

Message last edited on11/2/2006 2:10:20 AM bytimaddy.

Go Back