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)
- pluginUserDataPath; // The path to plugin AppData/Roaming (Library on Mac) folder
- 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
Private Output Parameters
- // Adding private output parameters
- array<string> privateOutputParametersNames={"GR", "Mode"};
- array<string> privateOutputParametersUnits={"dB", ""};
- array<double> privateOutputParametersMin={0, 0};
- array<double> privateOutputParametersMax={50, 2};
- array<double> privateOutputParametersDefault={0, 0};
- array<string> privateOutputParametersFormats={".2", ""};
- array<string> privateOutputParametersEnums={"", "Off;Attack;Release"};
- array<double> privateOutputParameters(privateOutputParametersNames.length);
Input and Output Strings
- // Adding input string
- array<string> inputStrings(2); // Number of strings
- array<string> inputStringsNames={"Filename", "Pattern"};
- array<int> inputStringsPersistency={1, 0}; // Optional persistency flag
- // 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);
Comments
Please, authorize to view and post comments.