Edison Script Reference ======================= 1. Global variables ------------------- CRLF string acts as a line feed for showing multiline messages Editor TEditor EditorSample TSample ScriptPath string 2. Global functions ------------------- ProgressMsg procedure ProgressMsg(const Msg:String;Pos,Total:Integer); ShowMessage procedure ShowMessage(const s: string); 3. Delphi/Windows functions --------------------------- Dec procedure dec_(var Value, Decrement: integer); Decreases an integer value FloatToStr function FloatToStr(Value: extended): string; Converts a floating point value to a string Inc procedure inc_(var Value, Increment: integer); Increases an integer value IntToStr function IntToStr(Value: integer): string; Converts an integer value to a string Round function Round(Value: double): integer; Rounds a floating point value to an integer TimeGetTime function timeGetTime: integer; stdcall; Returns the time in ms since Windows was started (can be used to time parts of scripts) 4. Wave related classes ----------------------- // PasteFromTo modes 0: insert 1: replace 2: mix // NormalizeFormat Mode flags (combine as needed) NF_NumChannels : normalize the number of channels NF_Format : normalize the sample format NF_Samplerate : normalize the samplerate NF_All : normalize all (combines all flags) // sample TSample = class constructor Create; function GetSampleAt(Position, Channel: integer): single; procedure SetSampleAt(Position, Channel: integer; Value: single); procedure CenterFromTo(x1, x2: integer); function NormalizeFromTo(x1, x2: integer; Vol: single; OnlyIfAbove: boolean = FALSE): single; procedure AmpFromTo(x1, x2: integer; Vol: single); procedure ReverseFromTo(x1, x2: integer); procedure ReversePolarityFromTo(x1, x2: integer); procedure SwapChannelsFromTo(x1, x2: integer); procedure InsertSilence(x1, x2: integer); procedure SilenceFromTo(x1, x2: integer); procedure NoiseFromTo(x1, x2: integer; Mode: integer = 1; Vol: single = 1); procedure SineFromTo(x1, x2: integer; Freq, Phase: double; Vol: single = 1); procedure PasteFromTo(aSample: TSample; var x1, x2: integer; Mode: integer = 0); procedure LoadFromClipboard; procedure DeleteFromTo(x1, x2: integer; Copy: boolean = FALSE); procedure TrimFromTo(x1, x2: integer); function MsToSamples(Time: double): double; function SamplesToMS(Time: double): double; procedure LoadFromFile(const Filename: string); // loads a full filename (use ScriptPath to complete it) procedure LoadFromFile_Ask; // shows open dialog procedure NormalizeFormat(Source: TSample; Mode: integer = nfAll); property Length: integer; property NumChans: integer; property Samplerate: integer; end; // editor TEditor = class function GetSelectionS(var x1, x2: integer): boolean; function GetSelectionMS(var x1, x2: double): boolean; property Sample: TSample; end; 5. Dialog classes and functions ------------------------------- TInput = class property DefaultValue: single; property Value: single; property ValueAsInt: integer; property Min: single; property Max: single; end; TScriptDialog = class constructor Create; function AddInput(const aName: string; Value: single): TInput; function AddInputKnob(const aName: string; Value, Min, Max: single): TInput; function AddInputCombo(const aName, ValueList: string; Value: integer): TInput; function GetInput(const aName: string): TInput; function GetInputValue(const aName: string): single; function GetInputValueAsInt(const aName: string): integer; function Execute: boolean; end; function CreateScriptDialog(const Title, Description: string): TScriptDialog;
aGrb1994