The following script works to normalize sound in the data window:
using System; using System.IO; using System.Windows.Forms; using SoundForge; public class EntryPoint { public void Begin(IScriptableApp app) { app.CurrentFile.DoEffect("Normalize", "[Sys] Normalize RMS to -16 dB (music)", app.ActiveWindow.EditRegion, EffectOptions.EffectOnly); app.CurrentFile.WaitForDoneOrCancel(); app.DoMenuAndWait("File.Save", false); } 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; }
I can use other built in presets marked as [Sys]. The problem was I couldn't use my own presets. That was until I remembered the post by SP from two years ago:
... This has to be some kind of bug. So I made the following changes.
- I deleted the custom preset and I changed EffectOptions.EffectOnly to EffectOptions.DialogFirst.
- Then I ran the script. The Volume-Dialog opened. I created the preset and saved it under a name.
- Then I canceled the process.
- Then I changed EffectOptions.DialogFirst back to EffectOptions.EffectOnly.
It now works every time without problems. Even after restarting the application.
SP's method worked with the Normalize dialogue as well. This is an extremely annoying bug as it makes making changes to scripts tedious. Moreover, I've had my volume scripts stop working on occasion and I have to go through the whole process of making each one manual and then auto again. I hope this is fixed in some future update.