Plug'n Script DSP API
Main processing functions
- // main function to process block data (audio, MIDI, params, transport)
- // simple function to process audio only. If defined, overrides processBlock
- // this function is called when input parameters change
- // it is called for every sample if processSample is used (while param is changing)
- // similar to updateInputParameters, but for block (not for every sample)
- // called if input parameters change, also receives transport info
- // called when it's time to update output data
Click on the function name to see examples and more information.
Additional functions
- // called before any processing, you can set and check params here
- // return true if all ok, false on errors
- // called when quitting the script, useful for freeing resources, etc.
- // can be called when samplerate or buffer size changed, etc.
- // return tail size in samples, -1 for synths, audio or MIDI-generators
- // return latency added by script (if any) in samples
- // is called when next block is silent, return false to skip next processBlock
Read-only variables
- // audio properties
- sampleRate; // (double) The current sample rate
- maxBlockSize; // (int) The maximum number of samples per block (relates to ASIO buffer)
- // channels count (uint)
- audioInputsCount; // The number of audio inputs
- audioOutputsCount; // The number of audio outputs
- auxAudioInputsCount; // The number of (optional) auxiliary audio inputs
- auxAudioOutputsCount; // The number of (optional) auxiliary audio outputs
- // paths (string)
- userDocumentsPath; // The path to the user documents folder (using '/' separators)
- scriptFilePath; // The path of the current dsp script file (using '/' separators)
- scriptDataPath; // The path to user script -data folder (using '/' separators)
Input parameters
- // adding input parameters
- array<string> inputParametersNames={"Gain", "Mix", "Mode"};
- array<string> inputParametersUnits={"dB", "%", ""};
- array<double> inputParametersMin={-20, 0, 0};
- array<double> inputParametersMax={20, 100, 2};
- array<double> inputParametersDefault={0, 50, 1};
- array<string> inputParametersFormats={"+.2",".0", ""}; // value formatting like C "printf"
- array<string> inputParametersEnums={"", "", "Vintage;Neutral;Modern"};
- array<int> inputParametersSteps={-1, 10, 3}; // positions count for auto-layout knobs
- array<double> inputParameters(inputParametersNames.length); // number of input params
Output parameters
- // adding output parameters
- array<string> outputParametersNames={"GR", "Mode"};
- array<string> outputParametersUnits={"dB", ""};
- array<double> outputParametersMin={0, 0};
- array<double> outputParametersMax={50, 2};
- array<double> outputParametersDefault={0, 0};
- array<string> outputParametersFormats={".2", ""}; // value formatting like C "printf"
- array<string> outputParametersEnums={"", "Off;Attack;Release"};
- array<double> outputParameters(outputParametersNames.length); // number of params
Input and output strings
- // adding input string
- array<string> inputStrings(2); // number of strings
- array<string> inputStringsNames={"Filename", "Pattern"};
- // adding output strings
- array<string> outputStrings(2); // number of strings
- array<string> outputStringsNames={"Log", "Data"};
- array<int> outputStringsMaxLengths={4096, 16384}; // maximum length
Script metadata
- string name="Script Name"; // The name of the script
- string description="Script Description"; // The short description of the script
Utility functions
- void print(const string& in message); // prints the content of a string to the log file
- double rand(double min=0, double max=1); // produce a pseudo random number
- // Additional string functions that can be used to convert data without allocating memory
- // They have the exact same behavior as their standard counterpart in Angelscript
- void intToString(int64 val, string& s, const string &in options = "", uint width = 0);
- void uIntToString(uint64 val, string& s, const string &in options = "", uint width = 0);
- void floatToString(double val, string& s, const string &in options = "", uint width = 0, uint precision = 0);